Skip to content

Commit e3d1962

Browse files
committed
Updated nuke to latest. Fixes for .NET 6.0 release.
1 parent b62760c commit e3d1962

21 files changed

+229
-53
lines changed

.nuke

-1
This file was deleted.

.nuke/build.schema.json

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "Build Schema",
4+
"$ref": "#/definitions/build",
5+
"definitions": {
6+
"build": {
7+
"type": "object",
8+
"properties": {
9+
"Configuration": {
10+
"type": "string",
11+
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
12+
"enum": [
13+
"Debug",
14+
"Release"
15+
]
16+
},
17+
"Continue": {
18+
"type": "boolean",
19+
"description": "Indicates to continue a previously failed build attempt"
20+
},
21+
"Help": {
22+
"type": "boolean",
23+
"description": "Shows the help text for this build assembly"
24+
},
25+
"Host": {
26+
"type": "string",
27+
"description": "Host for execution. Default is 'automatic'",
28+
"enum": [
29+
"AppVeyor",
30+
"AzurePipelines",
31+
"Bamboo",
32+
"Bitrise",
33+
"GitHubActions",
34+
"GitLab",
35+
"Jenkins",
36+
"Rider",
37+
"SpaceAutomation",
38+
"TeamCity",
39+
"Terminal",
40+
"TravisCI",
41+
"VisualStudio",
42+
"VSCode"
43+
]
44+
},
45+
"NoLogo": {
46+
"type": "boolean",
47+
"description": "Disables displaying the NUKE logo"
48+
},
49+
"NugetApiKey": {
50+
"type": "string",
51+
"description": "API Key for the NuGet server"
52+
},
53+
"NugetSource": {
54+
"type": "string",
55+
"description": "NuGet server URL"
56+
},
57+
"PackageVersion": {
58+
"type": "string",
59+
"description": "NuGet package version"
60+
},
61+
"Partition": {
62+
"type": "string",
63+
"description": "Partition to use on CI"
64+
},
65+
"Plan": {
66+
"type": "boolean",
67+
"description": "Shows the execution plan (HTML)"
68+
},
69+
"Profile": {
70+
"type": "array",
71+
"description": "Defines the profiles to load",
72+
"items": {
73+
"type": "string"
74+
}
75+
},
76+
"Root": {
77+
"type": "string",
78+
"description": "Root directory during build execution"
79+
},
80+
"Skip": {
81+
"type": "array",
82+
"description": "List of targets to be skipped. Empty list skips all dependencies",
83+
"items": {
84+
"type": "string",
85+
"enum": [
86+
"Clean",
87+
"Compile",
88+
"Docs",
89+
"Pack",
90+
"Push",
91+
"Restore",
92+
"Test"
93+
]
94+
}
95+
},
96+
"Solution": {
97+
"type": "string",
98+
"description": "Path to a solution file that is automatically loaded"
99+
},
100+
"Target": {
101+
"type": "array",
102+
"description": "List of targets to be invoked. Default is '{default_target}'",
103+
"items": {
104+
"type": "string",
105+
"enum": [
106+
"Clean",
107+
"Compile",
108+
"Docs",
109+
"Pack",
110+
"Push",
111+
"Restore",
112+
"Test"
113+
]
114+
}
115+
},
116+
"Verbosity": {
117+
"type": "string",
118+
"description": "Logging verbosity during build execution. Default is 'Normal'",
119+
"enum": [
120+
"Minimal",
121+
"Normal",
122+
"Quiet",
123+
"Verbose"
124+
]
125+
},
126+
"Version": {
127+
"type": "string",
128+
"description": "Version to use for package"
129+
}
130+
}
131+
}
132+
}
133+
}

.nuke/parameters.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./build.schema.json",
3+
"Solution": "CsvHelper.sln"
4+
}

.nuke/temp/build-attempt.log

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
a71f1116ad45e5e9cfd6afd27e26bc30
2+
Clean
3+
Restore
4+
Compile
5+
Test
6+
Pack

build.cmd

100644100755
+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
:; set -eo pipefail
2-
:; ./build.sh "$@"
2+
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
3+
:; ${SCRIPT_DIR}/build.sh "$@"
34
:; exit $?
45

56
@ECHO OFF
6-
powershell -ExecutionPolicy ByPass -NoProfile %0\..\build.ps1 %*
7+
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*

build.ps1

+17-17
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
1414
###########################################################################
1515

1616
$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
17-
$TempDirectory = "$PSScriptRoot\\.tmp"
17+
$TempDirectory = "$PSScriptRoot\\.nuke\temp"
1818

1919
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
2020
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
2121
$DotNetChannel = "Current"
2222

2323
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
2424
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
25+
$env:DOTNET_MULTILEVEL_LOOKUP = 0
2526

2627
###########################################################################
2728
# EXECUTION
@@ -32,38 +33,37 @@ function ExecSafe([scriptblock] $cmd) {
3233
if ($LASTEXITCODE) { exit $LASTEXITCODE }
3334
}
3435

35-
# If global.json exists, load expected version
36-
if (Test-Path $DotNetGlobalFile) {
37-
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
38-
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
39-
$DotNetVersion = $DotNetGlobal.sdk.version
40-
}
41-
}
42-
43-
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
36+
# If dotnet CLI is installed globally and it matches requested version, use for execution
4437
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
45-
(!(Test-Path variable:DotNetVersion) -or $(& dotnet --version) -eq $DotNetVersion)) {
38+
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
4639
$env:DOTNET_EXE = (Get-Command "dotnet").Path
4740
}
4841
else {
49-
$DotNetDirectory = "$TempDirectory\dotnet-win"
50-
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
51-
5242
# Download install script
5343
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
5444
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
5545
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
5646
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
5747

48+
# If global.json exists, load expected version
49+
if (Test-Path $DotNetGlobalFile) {
50+
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
51+
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
52+
$DotNetVersion = $DotNetGlobal.sdk.version
53+
}
54+
}
55+
5856
# Install by channel or version
57+
$DotNetDirectory = "$TempDirectory\dotnet-win"
5958
if (!(Test-Path variable:DotNetVersion)) {
60-
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
59+
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
6160
} else {
62-
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
61+
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
6362
}
63+
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
6464
}
6565

6666
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
6767

68-
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false -nologo -clp:NoSummary --verbosity quiet }
68+
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
6969
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }

build.sh

100644100755
+17-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
echo $(bash --version 2>&1 | head -n 1)
3+
bash --version 2>&1 | head -n 1
44

55
set -eo pipefail
66
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
@@ -10,53 +10,53 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
1010
###########################################################################
1111

1212
BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
13-
TEMP_DIRECTORY="$SCRIPT_DIR//.tmp"
13+
TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"
1414

1515
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
1616
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
1717
DOTNET_CHANNEL="Current"
1818

1919
export DOTNET_CLI_TELEMETRY_OPTOUT=1
2020
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
21+
export DOTNET_MULTILEVEL_LOOKUP=0
2122

2223
###########################################################################
2324
# EXECUTION
2425
###########################################################################
2526

2627
function FirstJsonValue {
27-
perl -nle 'print $1 if m{"'$1'": "([^"]+)",?}' <<< ${@:2}
28+
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
2829
}
2930

30-
# If global.json exists, load expected version
31-
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
32-
DOTNET_VERSION=$(FirstJsonValue "version" $(cat "$DOTNET_GLOBAL_FILE"))
33-
if [[ "$DOTNET_VERSION" == "" ]]; then
34-
unset DOTNET_VERSION
35-
fi
36-
fi
37-
38-
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
39-
if [[ -x "$(command -v dotnet)" && (-z ${DOTNET_VERSION+x} || $(dotnet --version 2>&1) == "$DOTNET_VERSION") ]]; then
31+
# If dotnet CLI is installed globally and it matches requested version, use for execution
32+
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
4033
export DOTNET_EXE="$(command -v dotnet)"
4134
else
42-
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
43-
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
44-
4535
# Download install script
4636
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
4737
mkdir -p "$TEMP_DIRECTORY"
4838
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
4939
chmod +x "$DOTNET_INSTALL_FILE"
5040

41+
# If global.json exists, load expected version
42+
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
43+
DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")")
44+
if [[ "$DOTNET_VERSION" == "" ]]; then
45+
unset DOTNET_VERSION
46+
fi
47+
fi
48+
5149
# Install by channel or version
50+
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
5251
if [[ -z ${DOTNET_VERSION+x} ]]; then
5352
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
5453
else
5554
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
5655
fi
56+
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
5757
fi
5858

5959
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
6060

61-
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false -nologo -clp:NoSummary --verbosity quiet
61+
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
6262
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"

build/Build.cs

-4
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@
1313
using Nuke.Common.Tooling;
1414
using Nuke.Common.Tools.DotNet;
1515
using Nuke.Common.Tools.GitVersion;
16-
using Nuke.Common.Tools.Npm;
1716
using Nuke.Common.Utilities.Collections;
18-
using static Nuke.Common.ChangeLog.ChangelogTasks;
19-
using static Nuke.Common.EnvironmentInfo;
2017
using static Nuke.Common.IO.FileSystemTasks;
2118
using static Nuke.Common.IO.PathConstruction;
2219
using static Nuke.Common.Tools.DotNet.DotNetTasks;
23-
using static Nuke.Common.Tools.Npm.NpmTasks;
2420

2521
[CheckBuildProjectConfigurations]
2622
[UnsetVisualStudioEnvironmentVariables]

build/Configuration.cs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.Linq;
4+
using Nuke.Common.Tooling;
5+
6+
[TypeConverter(typeof(TypeConverter<Configuration>))]
7+
public class Configuration : Enumeration
8+
{
9+
public static Configuration Debug = new Configuration { Value = nameof(Debug) };
10+
public static Configuration Release = new Configuration { Value = nameof(Release) };
11+
12+
public static implicit operator string(Configuration configuration)
13+
{
14+
return configuration.Value;
15+
}
16+
}

build/Directory.Build.props

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<!-- This file prevents unintended imports of unrelated MSBuild files -->
5+
<!-- Uncomment to include parent Directory.Build.props file -->
6+
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />-->
7+
8+
</Project>

build/Directory.Build.targets

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<!-- This file prevents unintended imports of unrelated MSBuild files -->
5+
<!-- Uncomment to include parent Directory.Build.targets file -->
6+
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />-->
7+
8+
</Project>

build/_build.csproj

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net50</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
66
<RootNamespace></RootNamespace>
77
<NoWarn>CS0649;CS0169</NoWarn>
88
<NukeRootDirectory>..</NukeRootDirectory>
99
<NukeScriptDirectory>..</NukeScriptDirectory>
10+
<NukeTelemetryVersion>1</NukeTelemetryVersion>
1011
</PropertyGroup>
1112

1213
<ItemGroup>
13-
<PackageDownload Include="GitVersion.Tool" Version="[5.1.1]" />
14-
<PackageReference Include="Nuke.Common" Version="0.24.11" />
14+
<PackageDownload Include="GitVersion.Tool" Version="[5.6.10]" />
15+
<PackageReference Include="Nuke.Common" Version="5.3.0" />
1516
</ItemGroup>
1617

1718
<ItemGroup>

global.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"sdk": {
3-
"rollForward": "latestMajor",
4-
"allowPrerelease": true
5-
}
6-
}
2+
"sdk": {
3+
"rollForward": "latestMinor",
4+
"version": "6.0.100"
5+
}
6+
}

0 commit comments

Comments
 (0)