From 0d1f29c5fb0633a821f63361df367a862c757cba Mon Sep 17 00:00:00 2001 From: Eoin Motherway <25342760+YuKitsune@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:08:15 +1000 Subject: [PATCH] Bump --- build/Build.cs | 20 ++++++++++---------- build/_build.csproj | 3 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/build/Build.cs b/build/Build.cs index 28eda0c..9cc38f0 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -8,6 +8,7 @@ using static Nuke.Common.IO.FileSystemTasks; using static Nuke.Common.Tools.DotNet.DotNetTasks; using Nuke.Common.Tools.OctoVersion; +using Serilog; [UnsetVisualStudioEnvironmentVariables] class Build : NukeBuild @@ -16,12 +17,12 @@ class Build : NukeBuild readonly Configuration Configuration = Configuration.Release; - [Solution] readonly Solution Solution; + [Solution] readonly Solution Solution = null!; // assigned by Nuke via reflection [Parameter] readonly bool? OctoVersionAutoDetectBranch = NukeBuild.IsLocalBuild; [Parameter("Branch name for OctoVersion to use to calculate the version number. Can be set via the environment variable " + CiBranchNameEnvVariable + ".", Name = CiBranchNameEnvVariable)] - readonly string OctoVersionBranch; + readonly string OctoVersionBranch = null!; // assigned by Nuke via reflection [Parameter] readonly string? OctoVersionFullSemVer; [Parameter] readonly int? OctoVersionMajor; @@ -37,8 +38,7 @@ class Build : NukeBuild MinorMember = nameof(OctoVersionMinor), PatchMember = nameof(OctoVersionPatch), Framework = "net8.0")] - - readonly OctoVersionInfo OctoVersionInfo; + readonly OctoVersionInfo OctoVersionInfo = null!; // assigned by Nuke via reflection static AbsolutePath SourceDirectory => RootDirectory / "source"; static AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts"; @@ -49,9 +49,9 @@ class Build : NukeBuild .Before(Restore) .Executes(() => { - SourceDirectory.GlobDirectories("**/bin", "**/obj", "**/TestResults").ForEach(DeleteDirectory); - EnsureCleanDirectory(ArtifactsDirectory); - EnsureCleanDirectory(PublishDirectory); + SourceDirectory.GlobDirectories("**/bin", "**/obj", "**/TestResults").ForEach(x => x.DeleteDirectory()); + ArtifactsDirectory.CreateOrCleanDirectory(); + PublishDirectory.CreateOrCleanDirectory(); }); Target Restore => _ => _ @@ -67,7 +67,7 @@ class Build : NukeBuild .DependsOn(Restore) .Executes(() => { - Logger.Info("Building Octopus Versioning v{0}", OctoVersionInfo.FullSemVer); + Log.Information("Building Octopus Versioning v{0}", OctoVersionInfo.FullSemVer); DotNetBuild(_ => _ .SetProjectFile(Solution) @@ -93,7 +93,7 @@ class Build : NukeBuild .Produces(ArtifactsDirectory / "*.nupkg") .Executes(() => { - Logger.Info("Packing Octopus Versioning v{0}", OctoVersionInfo.FullSemVer); + Log.Information("Packing Octopus Versioning v{0}", OctoVersionInfo.FullSemVer); // This is done to pass the data to github actions Console.Out.WriteLine($"::set-output name=semver::{OctoVersionInfo.FullSemVer}"); @@ -115,7 +115,7 @@ class Build : NukeBuild .TriggeredBy(Pack) .Executes(() => { - EnsureExistingDirectory(LocalPackagesDir); + LocalPackagesDir.CreateDirectory(); ArtifactsDirectory.GlobFiles("*.nupkg") .ForEach(package => { diff --git a/build/_build.csproj b/build/_build.csproj index 0806f98..1a22a74 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -10,6 +10,7 @@ 1 true + enable @@ -17,7 +18,7 @@ - +