diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000000..31e896e989 --- /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 a18ca7ce76..af25202dc1 100644 --- a/build.cake +++ b/build.cake @@ -9,16 +9,17 @@ 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 ////////////////////////////////////////////////////////////////////// -#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 @@ -94,7 +95,7 @@ Task("__Clean") foreach(var path in solutionPaths) { Information("Cleaning {0}", path); - DotNetCoreClean(path.ToString()); + DotNetClean(path.ToString()); } }); @@ -104,7 +105,7 @@ Task("__RestoreNugetPackages") foreach(var solution in solutions) { Information("Restoring NuGet Packages for {0}", solution); - DotNetCoreRestore(solution.ToString()); + DotNetRestore(solution.ToString()); } }); @@ -201,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); } }); @@ -216,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 }); @@ -230,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); }); ////////////////////////////////////////////////////////////////////// @@ -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 5d095556f4..e27195feb1 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