From 8e2462e3a2b1187bb5264f844aad87c6029ab926 Mon Sep 17 00:00:00 2001 From: neptune Date: Sun, 13 Feb 2022 12:30:50 +0300 Subject: [PATCH 1/2] Bump up cake to v2.0.0 --- .config/dotnet-tools.json | 12 ++++++++++++ build.cake | 9 +++++---- build.ps1 | 13 +++++-------- 3 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 .config/dotnet-tools.json diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 00000000000..31e896e989b --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "cake.tool": { + "version": "2.0.0", + "commands": [ + "dotnet-cake" + ] + } + } +} \ No newline at end of file diff --git a/build.cake b/build.cake index a18ca7ce761..2f0f4e59f50 100644 --- a/build.cake +++ b/build.cake @@ -16,9 +16,10 @@ var configuration = Argument("configuration", "Release"); // EXTERNAL NUGET LIBRARIES ////////////////////////////////////////////////////////////////////// -#addin nuget:?package=Cake.FileHelpers&version=3.3.0 -#addin nuget:?package=Cake.Yaml&version=3.1.1 -#addin nuget:?package=YamlDotNet&version=5.2.1 +#addin nuget:?package=Cake.FileHelpers&version=5.0.0 +#addin nuget:?package=Cake.Yaml&version=4.0.0 +#addin nuget:?package=Newtonsoft.Json&version=13.0.1 +#addin nuget:?package=YamlDotNet&version=11.2.1 /////////////////////////////////////////////////////////////////////////////// // GLOBAL VARIABLES @@ -273,4 +274,4 @@ RunTarget(target); string ToolsExePath(string exeFileName) { var exePath = System.IO.Directory.GetFiles(@"./tools", exeFileName, SearchOption.AllDirectories).FirstOrDefault(); return exePath; -} +} \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 5d095556f4d..e27195feb14 100644 --- a/build.ps1 +++ b/build.ps1 @@ -51,8 +51,9 @@ if($Verbose.IsPresent) $TOOLS_DIR = Join-Path $PSScriptRoot "tools" $NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" -$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" +$CAKE_EXE = "dotnet dotnet-cake" $PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" +$DOTNET = "dotnet.exe" # Should we use mono? $UseMono = ""; @@ -111,7 +112,7 @@ if(-Not $SkipToolPackageRestore.IsPresent) # Install just Cake if missing config else { - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install Cake -Version 0.38.5 -ExcludeVersion" # Pin Cake version to 0.38.5; see https://github.com/App-vNext/Polly/issues/416 + $NuGetOutput = Invoke-Expression "&`"$DOTNET`" tool install Cake.Tool --version 2.0.0" Write-Verbose ($NuGetOutput | Out-String) } Pop-Location @@ -121,12 +122,8 @@ if(-Not $SkipToolPackageRestore.IsPresent) } } -# Make sure that Cake has been installed. -if (!(Test-Path $CAKE_EXE)) { - Throw "Could not find Cake.exe" -} # Start Cake Write-Host "Running build script..." -Invoke-Expression "$CAKE_EXE `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental" -exit $LASTEXITCODE +Invoke-Expression "$CAKE_EXE `"$Script`" --target=`"$Target`" --configuration=`"$Configuration`" --verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental" +exit $LASTEXITCODE \ No newline at end of file From 0d8ba745108d408aa187ef86ce75df4b3634ae9d Mon Sep 17 00:00:00 2001 From: neptune Date: Sun, 13 Feb 2022 12:36:42 +0300 Subject: [PATCH 2/2] Target the tools to a specific version --- build.cake | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/build.cake b/build.cake index 2f0f4e59f50..af25202dc10 100644 --- a/build.cake +++ b/build.cake @@ -9,8 +9,8 @@ var configuration = Argument("configuration", "Release"); // EXTERNAL NUGET TOOLS ////////////////////////////////////////////////////////////////////// -#Tool "xunit.runner.console" -#Tool "GitVersion.CommandLine" +#Tool "xunit.runner.console&version=2.4.1" +#Tool "GitVersion.CommandLine&version=5.8.1" ////////////////////////////////////////////////////////////////////// // EXTERNAL NUGET LIBRARIES @@ -95,7 +95,7 @@ Task("__Clean") foreach(var path in solutionPaths) { Information("Cleaning {0}", path); - DotNetCoreClean(path.ToString()); + DotNetClean(path.ToString()); } }); @@ -105,7 +105,7 @@ Task("__RestoreNugetPackages") foreach(var solution in solutions) { Information("Restoring NuGet Packages for {0}", solution); - DotNetCoreRestore(solution.ToString()); + DotNetRestore(solution.ToString()); } }); @@ -202,14 +202,14 @@ Task("__BuildSolutions") { Information("Building {0}", solution); - var dotNetCoreBuildSettings = new DotNetCoreBuildSettings { + var dotNetCoreBuildSettings = new DotNetBuildSettings { Configuration = configuration, Verbosity = DotNetCoreVerbosity.Minimal, NoRestore = true, - MSBuildSettings = new DotNetCoreMSBuildSettings { TreatAllWarningsAs = MSBuildTreatAllWarningsAs.Error } + MSBuildSettings = new DotNetMSBuildSettings { TreatAllWarningsAs = MSBuildTreatAllWarningsAs.Error } }; - DotNetCoreBuild(solution.ToString(), dotNetCoreBuildSettings); + DotNetBuild(solution.ToString(), dotNetCoreBuildSettings); } }); @@ -217,7 +217,7 @@ Task("__RunTests") .Does(() => { foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj")) { - DotNetCoreTest(specsProj.FullPath, new DotNetCoreTestSettings { + DotNetTest(specsProj.FullPath, new DotNetTestSettings { Configuration = configuration, NoBuild = true }); @@ -231,13 +231,13 @@ Task("__CreateSignedNugetPackage") Information("Building {0}.{1}.nupkg", packageName, nugetVersion); - var dotNetCorePackSettings = new DotNetCorePackSettings { + var dotNetCorePackSettings = new DotNetPackSettings { Configuration = configuration, NoBuild = true, OutputDirectory = nupkgDestDir }; - DotNetCorePack($@"{srcDir}\{projectName}.sln", dotNetCorePackSettings); + DotNetPack($@"{srcDir}\{projectName}.sln", dotNetCorePackSettings); }); //////////////////////////////////////////////////////////////////////