Skip to content

Commit

Permalink
Merge pull request #118 from OctopusDeploy/dylan/upgrade-dotnet
Browse files Browse the repository at this point in the history
Update to .NET 6
  • Loading branch information
dylanlerch authored Jul 14, 2022
2 parents 09fbd90 + c8a2e15 commit 477838b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 15 deletions.
18 changes: 17 additions & 1 deletion .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand All @@ -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)"
Expand Down
22 changes: 13 additions & 9 deletions build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
// 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
{
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;

[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";
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="5.3.0" />
<PackageReference Include="Nuke.OctoVersion" Version="0.2.453" />
<PackageReference Include="Nuke.Common" Version="6.1.2" />
<PackageDownload Include="OctoVersion.Tool" Version="[0.3.49]" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "5.0.104",
"version": "6.0.301",
"rollForward": "latestFeature"
}
}
2 changes: 1 addition & 1 deletion source/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyName>Tests</AssemblyName>
<RootNamespace>Tests</RootNamespace>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
Expand Down

0 comments on commit 477838b

Please sign in to comment.