Skip to content

Commit

Permalink
Upgrade to nuke 5.1.0 (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-richardson committed Apr 20, 2021
1 parent d6a018b commit 1f388b8
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 22 deletions.
1 change: 0 additions & 1 deletion .nuke

This file was deleted.

138 changes: 138 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Build Schema",
"$ref": "#/definitions/build",
"definitions": {
"build": {
"type": "object",
"properties": {
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI"
]
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"SigningCertificatePassword": {
"type": "string",
"description": "Password for the signing certificate"
},
"SigningCertificatePath": {
"type": "string",
"description": "Pfx certificate to use for signing the files"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"AssertLinuxSelfContainedArtifactsExists",
"AssertPortableArtifactsExists",
"BuildDockerImage",
"CalculateVersion",
"Clean",
"Compile",
"CopyToLocalPackages",
"CreateDockerContainerAndLinuxPackages",
"CreateLinuxPackages",
"Default",
"DotnetPublish",
"MergeOctoExe",
"PackDotNetOctoNuget",
"PackOctopusToolsNuget",
"Restore",
"Test",
"Zip"
]
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"AssertLinuxSelfContainedArtifactsExists",
"AssertPortableArtifactsExists",
"BuildDockerImage",
"CalculateVersion",
"Clean",
"Compile",
"CopyToLocalPackages",
"CreateDockerContainerAndLinuxPackages",
"CreateLinuxPackages",
"Default",
"DotnetPublish",
"MergeOctoExe",
"PackDotNetOctoNuget",
"PackOctopusToolsNuget",
"Restore",
"Test",
"Zip"
]
}
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
"enum": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
]
}
}
}
}
}
4 changes: 4 additions & 0 deletions .nuke/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "./build.schema.json",
"Solution": "source/OctopusCli.sln"
}
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
###########################################################################

$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
$TempDirectory = "$PSScriptRoot\\.tmp"
$TempDirectory = "$PSScriptRoot\\.nuke\temp"

$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
###########################################################################

BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
TEMP_DIRECTORY="$SCRIPT_DIR//.tmp"
TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"

DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
Expand Down
22 changes: 11 additions & 11 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Build : NukeBuild
[Parameter("Pfx certificate to use for signing the files")] readonly AbsolutePath SigningCertificatePath = RootDirectory / "certificates" / "OctopusDevelopment.pfx";
[Parameter("Password for the signing certificate")] readonly string SigningCertificatePassword = "Password01!";

[Solution] readonly Solution Solution;
[Solution(GenerateProjects = true)] readonly Solution Solution;

[NukeOctoVersion] readonly OctoVersionInfo OctoVersionInfo;

Expand Down Expand Up @@ -104,18 +104,16 @@ class Build : NukeBuild
.DependsOn(Test)
.Executes(() =>
{
var projectToPublish = "./source/Octo/Octo.csproj";
DotNetPublish(_ => _
.SetProject(projectToPublish)
.SetProject(Solution.Octo)
.SetFramework("net452")
.SetConfiguration(Configuration)
.SetOutput(OctoPublishDirectory / "netfx")
.SetVersion(OctoVersionInfo.FullSemVer));
var portablePublishDir = OctoPublishDirectory / "portable";
DotNetPublish(_ => _
.SetProject(projectToPublish)
.SetProject(Solution.Octo)
.SetFramework("netcoreapp2.0") /* For compatibility until we gently phase it out. We encourage upgrading to self-contained executable. */
.SetConfiguration(Configuration)
.SetOutput(portablePublishDir)
Expand All @@ -127,15 +125,15 @@ class Build : NukeBuild
CopyFileToDirectory(AssetDirectory / "octo.cmd", portablePublishDir, FileExistsPolicy.Overwrite);
var doc = new XmlDocument();
doc.Load(@".\source\Octo\Octo.csproj");
doc.Load(Solution.Octo.Path);
var selectSingleNode = doc.SelectSingleNode("Project/PropertyGroup/RuntimeIdentifiers");
if (selectSingleNode == null)
throw new ApplicationException("Unable to find Project/PropertyGroup/RuntimeIdentifiers in Octo.csproj");
var rids = selectSingleNode.InnerText;
foreach (var rid in rids.Split(';'))
{
DotNetPublish(_ => _
.SetProject(projectToPublish)
.SetProject(Solution.Octo)
.SetConfiguration(Configuration)
.SetFramework("netcoreapp3.1")
.SetRuntime(rid)
Expand Down Expand Up @@ -367,9 +365,9 @@ class Build : NukeBuild

Target CopyToLocalPackages => _ => _
.OnlyWhenStatic(() => IsLocalBuild)
.DependsOn(PackOctopusToolsNuget)
.DependsOn(PackDotNetOctoNuget)
.DependsOn(Zip)
.TriggeredBy(PackOctopusToolsNuget)
.TriggeredBy(PackDotNetOctoNuget)
.TriggeredBy(Zip)
.Executes(() =>
{
EnsureExistingDirectory(LocalPackagesDirectory);
Expand All @@ -378,7 +376,9 @@ class Build : NukeBuild
});

Target Default => _ => _
.DependsOn(CopyToLocalPackages);
.DependsOn(PackOctopusToolsNuget)
.DependsOn(PackDotNetOctoNuget)
.DependsOn(Zip);

void SignBinaries(string path)
{
Expand Down
6 changes: 3 additions & 3 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
Expand All @@ -11,8 +11,8 @@

<ItemGroup>
<PackageReference Include="ILRepack.Lib" Version="2.0.18" />
<PackageReference Include="Nuke.Common" Version="5.0.2" />
<PackageReference Include="Nuke.OctoVersion" Version="0.2.289" />
<PackageReference Include="Nuke.Common" Version="5.1.0" />
<PackageReference Include="Nuke.OctoVersion" Version="0.2.453" />
<PackageReference Include="SharpCompress" Version="0.28.0" />
</ItemGroup>

Expand Down
10 changes: 5 additions & 5 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "5.0.103",
"rollForward": "latestFeature"
}
}
"sdk": {
"version": "5.0.104",
"rollForward": "latestFeature"
}
}

0 comments on commit 1f388b8

Please sign in to comment.