Skip to content

Commit c36712e

Browse files
authored
Bump Cake to v2.0.0 (#921)
* Bump up cake to v2.0.0 * Target the tools to a specific version
1 parent 98f7429 commit c36712e

File tree

3 files changed

+32
-22
lines changed

3 files changed

+32
-22
lines changed

.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"cake.tool": {
6+
"version": "2.0.0",
7+
"commands": [
8+
"dotnet-cake"
9+
]
10+
}
11+
}
12+
}

build.cake

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ var configuration = Argument<string>("configuration", "Release");
99
// EXTERNAL NUGET TOOLS
1010
//////////////////////////////////////////////////////////////////////
1111

12-
#Tool "xunit.runner.console"
13-
#Tool "GitVersion.CommandLine"
12+
#Tool "xunit.runner.console&version=2.4.1"
13+
#Tool "GitVersion.CommandLine&version=5.8.1"
1414

1515
//////////////////////////////////////////////////////////////////////
1616
// EXTERNAL NUGET LIBRARIES
1717
//////////////////////////////////////////////////////////////////////
1818

19-
#addin nuget:?package=Cake.FileHelpers&version=3.3.0
20-
#addin nuget:?package=Cake.Yaml&version=3.1.1
21-
#addin nuget:?package=YamlDotNet&version=5.2.1
19+
#addin nuget:?package=Cake.FileHelpers&version=5.0.0
20+
#addin nuget:?package=Cake.Yaml&version=4.0.0
21+
#addin nuget:?package=Newtonsoft.Json&version=13.0.1
22+
#addin nuget:?package=YamlDotNet&version=11.2.1
2223

2324
///////////////////////////////////////////////////////////////////////////////
2425
// GLOBAL VARIABLES
@@ -94,7 +95,7 @@ Task("__Clean")
9495
foreach(var path in solutionPaths)
9596
{
9697
Information("Cleaning {0}", path);
97-
DotNetCoreClean(path.ToString());
98+
DotNetClean(path.ToString());
9899
}
99100
});
100101

@@ -104,7 +105,7 @@ Task("__RestoreNugetPackages")
104105
foreach(var solution in solutions)
105106
{
106107
Information("Restoring NuGet Packages for {0}", solution);
107-
DotNetCoreRestore(solution.ToString());
108+
DotNetRestore(solution.ToString());
108109
}
109110
});
110111

@@ -201,22 +202,22 @@ Task("__BuildSolutions")
201202
{
202203
Information("Building {0}", solution);
203204

204-
var dotNetCoreBuildSettings = new DotNetCoreBuildSettings {
205+
var dotNetCoreBuildSettings = new DotNetBuildSettings {
205206
Configuration = configuration,
206207
Verbosity = DotNetCoreVerbosity.Minimal,
207208
NoRestore = true,
208-
MSBuildSettings = new DotNetCoreMSBuildSettings { TreatAllWarningsAs = MSBuildTreatAllWarningsAs.Error }
209+
MSBuildSettings = new DotNetMSBuildSettings { TreatAllWarningsAs = MSBuildTreatAllWarningsAs.Error }
209210
};
210211

211-
DotNetCoreBuild(solution.ToString(), dotNetCoreBuildSettings);
212+
DotNetBuild(solution.ToString(), dotNetCoreBuildSettings);
212213
}
213214
});
214215

215216
Task("__RunTests")
216217
.Does(() =>
217218
{
218219
foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj")) {
219-
DotNetCoreTest(specsProj.FullPath, new DotNetCoreTestSettings {
220+
DotNetTest(specsProj.FullPath, new DotNetTestSettings {
220221
Configuration = configuration,
221222
NoBuild = true
222223
});
@@ -230,13 +231,13 @@ Task("__CreateSignedNugetPackage")
230231

231232
Information("Building {0}.{1}.nupkg", packageName, nugetVersion);
232233

233-
var dotNetCorePackSettings = new DotNetCorePackSettings {
234+
var dotNetCorePackSettings = new DotNetPackSettings {
234235
Configuration = configuration,
235236
NoBuild = true,
236237
OutputDirectory = nupkgDestDir
237238
};
238239

239-
DotNetCorePack($@"{srcDir}\{projectName}.sln", dotNetCorePackSettings);
240+
DotNetPack($@"{srcDir}\{projectName}.sln", dotNetCorePackSettings);
240241
});
241242

242243
//////////////////////////////////////////////////////////////////////
@@ -273,4 +274,4 @@ RunTarget(target);
273274
string ToolsExePath(string exeFileName) {
274275
var exePath = System.IO.Directory.GetFiles(@"./tools", exeFileName, SearchOption.AllDirectories).FirstOrDefault();
275276
return exePath;
276-
}
277+
}

build.ps1

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ if($Verbose.IsPresent)
5151

5252
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
5353
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
54-
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
54+
$CAKE_EXE = "dotnet dotnet-cake"
5555
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
56+
$DOTNET = "dotnet.exe"
5657

5758
# Should we use mono?
5859
$UseMono = "";
@@ -111,7 +112,7 @@ if(-Not $SkipToolPackageRestore.IsPresent)
111112
# Install just Cake if missing config
112113
else
113114
{
114-
$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
115+
$NuGetOutput = Invoke-Expression "&`"$DOTNET`" tool install Cake.Tool --version 2.0.0"
115116
Write-Verbose ($NuGetOutput | Out-String)
116117
}
117118
Pop-Location
@@ -121,12 +122,8 @@ if(-Not $SkipToolPackageRestore.IsPresent)
121122
}
122123
}
123124

124-
# Make sure that Cake has been installed.
125-
if (!(Test-Path $CAKE_EXE)) {
126-
Throw "Could not find Cake.exe"
127-
}
128125

129126
# Start Cake
130127
Write-Host "Running build script..."
131-
Invoke-Expression "$CAKE_EXE `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental"
132-
exit $LASTEXITCODE
128+
Invoke-Expression "$CAKE_EXE `"$Script`" --target=`"$Target`" --configuration=`"$Configuration`" --verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental"
129+
exit $LASTEXITCODE

0 commit comments

Comments
 (0)