From c8a2e15a29044b5e2796f3251bfc61c1f697813e Mon Sep 17 00:00:00 2001 From: Dylan Lerch Date: Fri, 10 Jun 2022 12:24:33 +1000 Subject: [PATCH] Update to .NET 6 --- .nuke/build.schema.json | 18 +++++++++++++++++- build/Build.cs | 22 +++++++++++++--------- build/_build.csproj | 7 ++++--- global.json | 2 +- source/Tests/Tests.csproj | 2 +- 5 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 1c5473b..5eba280 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -6,6 +6,10 @@ "build": { "type": "object", "properties": { + "AutoDetectBranch": { + "type": "boolean", + "description": "Whether to auto-detect the branch name - this is okay for a local build, but should not be used under CI" + }, "Configuration": { "type": "string", "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", @@ -29,20 +33,32 @@ "AppVeyor", "AzurePipelines", "Bamboo", + "Bitbucket", "Bitrise", "GitHubActions", "GitLab", "Jenkins", + "Rider", "SpaceAutomation", "TeamCity", "Terminal", - "TravisCI" + "TravisCI", + "VisualStudio", + "VSCode" ] }, "NoLogo": { "type": "boolean", "description": "Disables displaying the NUKE logo" }, + "OCTOVERSION_CurrentBranch": { + "type": "string", + "description": "Branch name for OctoVersion to use to calculate the version number. Can be set via the environment variable OCTOVERSION_CurrentBranch" + }, + "Partition": { + "type": "string", + "description": "Partition to use on CI" + }, "Plan": { "type": "boolean", "description": "Shows the execution plan (HTML)" diff --git a/build/Build.cs b/build/Build.cs index 9e6655c..4c8423a 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -1,18 +1,13 @@ -// ReSharper disable RedundantUsingDirective - -using System; using Nuke.Common; using Nuke.Common.Execution; using Nuke.Common.IO; using Nuke.Common.ProjectModel; using Nuke.Common.Tools.DotNet; +using Nuke.Common.Tools.OctoVersion; using Nuke.Common.Utilities.Collections; -using Nuke.OctoVersion; -using OctoVersion.Core; using static Nuke.Common.IO.FileSystemTasks; using static Nuke.Common.Tools.DotNet.DotNetTasks; -[CheckBuildProjectConfigurations] [UnsetVisualStudioEnvironmentVariables] class Build : NukeBuild { @@ -20,7 +15,16 @@ class Build : NukeBuild [Solution] readonly Solution Solution; - [NukeOctoVersion] readonly OctoVersionInfo OctoVersionInfo; + [Parameter("Branch name for OctoVersion to use to calculate the version number. Can be set via the environment variable OCTOVERSION_CurrentBranch.", + Name = "OCTOVERSION_CurrentBranch")] + readonly string BranchName; + + [Parameter("Whether to auto-detect the branch name - this is okay for a local build, but should not be used under CI.")] + readonly bool AutoDetectBranch = IsLocalBuild; + + [OctoVersion(UpdateBuildNumber = true, BranchParameter = nameof(BranchName), + AutoDetectBranchParameter = nameof(AutoDetectBranch), Framework = "net6.0")] + readonly OctoVersionInfo OctoVersionInfo; AbsolutePath SourceDirectory => RootDirectory / "source"; AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts"; @@ -53,8 +57,8 @@ class Build : NukeBuild .DependsOn(Restore) .Executes(() => { - Logger.Info("Building Octopus.Ocl v{0}", OctoVersionInfo.NuGetVersion); - Logger.Info("Informational Version {0}", OctoVersionInfo.InformationalVersion); + Serilog.Log.Information("Building Octopus.Ocl v{0}", OctoVersionInfo.NuGetVersion); + Serilog.Log.Information("Informational Version {0}", OctoVersionInfo.InformationalVersion); DotNetBuild(_ => _ .SetProjectFile(Solution) diff --git a/build/_build.csproj b/build/_build.csproj index fdad1a3..f11e0fe 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -2,15 +2,16 @@ Exe - net5.0 + net6.0 CS0649;CS0169 .. .. + 1 - - + + diff --git a/global.json b/global.json index e26fc2e..1388a0d 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.104", + "version": "6.0.301", "rollForward": "latestFeature" } } diff --git a/source/Tests/Tests.csproj b/source/Tests/Tests.csproj index 3f16fe7..0697201 100644 --- a/source/Tests/Tests.csproj +++ b/source/Tests/Tests.csproj @@ -3,7 +3,7 @@ Tests Tests - netcoreapp3.1 + net6.0 enable true