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

Bumps up Cake to v2.0.0 #921

Merged
merged 2 commits into from
Feb 13, 2022
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
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "2.0.0",
"commands": [
"dotnet-cake"
]
}
}
}
29 changes: 15 additions & 14 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ var configuration = Argument<string>("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
Expand Down Expand Up @@ -94,7 +95,7 @@ Task("__Clean")
foreach(var path in solutionPaths)
{
Information("Cleaning {0}", path);
DotNetCoreClean(path.ToString());
DotNetClean(path.ToString());
}
});

Expand All @@ -104,7 +105,7 @@ Task("__RestoreNugetPackages")
foreach(var solution in solutions)
{
Information("Restoring NuGet Packages for {0}", solution);
DotNetCoreRestore(solution.ToString());
DotNetRestore(solution.ToString());
}
});

Expand Down Expand Up @@ -201,22 +202,22 @@ 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);
}
});

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
});
Expand All @@ -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);
});

//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -273,4 +274,4 @@ RunTarget(target);
string ToolsExePath(string exeFileName) {
var exePath = System.IO.Directory.GetFiles(@"./tools", exeFileName, SearchOption.AllDirectories).FirstOrDefault();
return exePath;
}
}
13 changes: 5 additions & 8 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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
Expand All @@ -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