Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to NUKE 8 #96

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Build Schema",
"$ref": "#/definitions/build",
"title": "Build Schema",
"definitions": {
"build": {
"type": "object",
Expand Down Expand Up @@ -131,4 +131,4 @@
}
}
}
}
}
Empty file modified build.cmd
100644 → 100755
Empty file.
11 changes: 8 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ $TempDirectory = "$PSScriptRoot\\.nuke\temp"

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

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:DOTNET_MULTILEVEL_LOOKUP = 0
$env:DOTNET_NOLOGO = 1

###########################################################################
# EXECUTION
Expand Down Expand Up @@ -61,9 +60,15 @@ else {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
$env:PATH = "$DotNetDirectory;$env:PATH"
}

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

if (Test-Path env:NUKE_ENTERPRISE_TOKEN) {
& $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null
& $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null
}

ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
11 changes: 8 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"

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

export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_MULTILEVEL_LOOKUP=0
export DOTNET_NOLOGO=1

###########################################################################
# EXECUTION
Expand Down Expand Up @@ -54,9 +53,15 @@ else
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
fi
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
export PATH="$DOTNET_DIRECTORY:$PATH"
fi

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

if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then
"$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true
"$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true
fi

"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
16 changes: 9 additions & 7 deletions nuke/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using System.Linq;
using Nuke.Common.Tooling;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.NuGet.NuGetTasks;
using Project = Nuke.Common.ProjectModel.Project;
Expand Down Expand Up @@ -100,7 +99,7 @@ protected override void OnBuildInitialized()

Log.Information("Building version: {Version}", Version);

TargetProject = Solution.GetProject(SourceDirectory / TargetProjectName / $"{TargetLibName}.csproj" );
TargetProject = Solution.GetProject(TargetLibName);
TargetProject.NotNull("TargetProject could not be loaded!");

TargetFrameworks = TargetProject.GetTargetFrameworks();
Expand All @@ -113,7 +112,7 @@ protected override void OnBuildInitialized()
.Before(Restore)
.Executes(() =>
{
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory());
});

Target Restore => _ => _
Expand All @@ -130,6 +129,7 @@ protected override void OnBuildInitialized()
DotNetBuild(s => s
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.SetContinuousIntegrationBuild(IsServerBuild)
.EnableNoRestore());
});

Expand All @@ -143,6 +143,7 @@ protected override void OnBuildInitialized()
.EnableNoRestore()
.EnableNoBuild()
.SetProcessEnvironmentVariable("prefetched", "false")
.When(GitHubActions.Instance is not null, x => x.SetLoggers("GitHubActions"))
);

DotNetTest(s => s
Expand All @@ -151,6 +152,7 @@ protected override void OnBuildInitialized()
.EnableNoRestore()
.EnableNoBuild()
.SetProcessEnvironmentVariable("prefetched", "true")
.When(GitHubActions.Instance is not null, x => x.SetLoggers("GitHubActions"))
);
});

Expand Down Expand Up @@ -183,9 +185,9 @@ protected override void OnBuildInitialized()
.SetTargetPath(nuspec)
.SetVersion(Version)
.SetOutputDirectory(NugetDirectory)
.SetSymbols(true)
.SetSymbolPackageFormat("snupkg")
.AddProperty("Configuration", Configuration)
.EnableSymbols()
.SetSymbolPackageFormat(NuGetSymbolPackageFormat.snupkg)
.SetConfiguration(Configuration)
);
});

Expand All @@ -202,7 +204,7 @@ protected override void OnBuildInitialized()
throw new BuildAbortedException("Could not resolve the NuGet API key.");
}

foreach (var nupkg in GlobFiles(NugetDirectory, "*.nupkg"))
foreach (var nupkg in NugetDirectory.GlobFiles("*.nupkg"))
{
NuGetPush(s => s
.SetTargetPath(nupkg)
Expand Down
4 changes: 2 additions & 2 deletions nuke/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
Expand All @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="6.2.1" />
<PackageReference Include="Nuke.Common" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/AngleSharp.Js.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AngleSharp.Js", "AngleSharp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AngleSharp.Js.Tests", "AngleSharp.Js.Tests\AngleSharp.Js.Tests.csproj", "{18B0B97B-8795-4DC2-A1E7-8070255BE718}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_build", "..\nuke\_build.csproj", "{07DA52AA-8F6F-4F43-B09E-6AE899E95E43}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
Loading