Skip to content

Commit 977f3e1

Browse files
Merge pull request #996 from martincostello/xplat-ci
Build on Linux and macOS
2 parents d3c4e1d + 18528b8 commit 977f3e1

File tree

5 files changed

+20
-60
lines changed

5 files changed

+20
-60
lines changed

.config/dotnet-tools.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
"commands": [
88
"dotnet-cake"
99
]
10+
},
11+
"GitVersion.Tool": {
12+
"version": "5.11.1",
13+
"commands": [
14+
"dotnet-gitversion"
15+
]
1016
}
1117
}
1218
}

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
matrix:
1818
os: [ windows-latest ]
1919
include:
20-
#- os: macos-latest
21-
# os_name: macos
22-
#- os: ubuntu-latest
23-
# os_name: linux
20+
- os: macos-latest
21+
os_name: macos
22+
- os: ubuntu-latest
23+
os_name: linux
2424
- os: windows-latest
2525
os_name: windows
2626

build.cake

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

12-
#Tool "GitVersion.CommandLine&version=5.11.1"
1312
#Tool "xunit.runner.console&version=2.4.2"
1413

1514
//////////////////////////////////////////////////////////////////////
@@ -113,12 +112,13 @@ Task("__UpdateAssemblyVersionInformation")
113112
.Does(() =>
114113
{
115114
var gitVersionSettings = new ProcessSettings()
116-
.SetRedirectStandardOutput(true);
115+
.SetRedirectStandardOutput(true)
116+
.WithArguments(args => args.Append("gitversion"));
117117

118118
try
119119
{
120120
IEnumerable<string> outputLines;
121-
StartProcess(gitVersionPath, gitVersionSettings, out outputLines);
121+
StartProcess("dotnet", gitVersionSettings, out outputLines);
122122

123123
var output = string.Join("\n", outputLines);
124124
gitVersionOutput = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(output);

build.ps1

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<#
33
44
.SYNOPSIS
5-
This is a Powershell script to bootstrap a Cake build.
5+
This is a PowerShell script to bootstrap a Cake build.
66
77
.DESCRIPTION
8-
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
8+
This PowerShell script will restore NuGet tools (including Cake)
99
and execute your Cake build script with the parameters you provide.
1010
1111
.PARAMETER Script
@@ -16,13 +16,9 @@ The build script target to run.
1616
The build configuration to use.
1717
.PARAMETER Verbosity
1818
Specifies the amount of information to be displayed.
19-
.PARAMETER Experimental
20-
Tells Cake to use the latest Roslyn release.
2119
.PARAMETER WhatIf
2220
Performs a dry run of the build script.
2321
No tasks will be executed.
24-
.PARAMETER Mono
25-
Tells Cake to use the Mono scripting engine.
2622
2723
.LINK
2824
http://cakebuild.net
@@ -34,10 +30,8 @@ Param(
3430
[string]$Configuration = "Release",
3531
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
3632
[string]$Verbosity = "Verbose",
37-
[switch]$Experimental,
3833
[Alias("DryRun","Noop")]
3934
[switch]$WhatIf,
40-
[switch]$Mono,
4135
[switch]$SkipToolPackageRestore,
4236
[switch]$Verbose
4337
)
@@ -54,23 +48,6 @@ if ($Verbose.IsPresent)
5448
}
5549

5650
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
57-
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
58-
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
59-
$DOTNET = "dotnet.exe"
60-
61-
# Should we use mono?
62-
$UseMono = "";
63-
if ($Mono.IsPresent) {
64-
Write-Verbose -Message "Using the Mono based scripting engine."
65-
$UseMono = "-mono"
66-
}
67-
68-
# Should we use the new Roslyn?
69-
$UseExperimental = "";
70-
if ($Experimental.IsPresent -and !($Mono.IsPresent)) {
71-
Write-Verbose -Message "Using experimental version of Roslyn."
72-
$UseExperimental = "-experimental"
73-
}
7451

7552
# Is this a dry run?
7653
$UseDryRun = "";
@@ -83,20 +60,6 @@ if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
8360
New-Item -Path $TOOLS_DIR -Type directory | out-null
8461
}
8562

86-
# Try download NuGet.exe if not exists
87-
if (!(Test-Path $NUGET_EXE)) {
88-
Write-Verbose -Message "Downloading NuGet.exe..."
89-
Invoke-WebRequest -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile $NUGET_EXE
90-
}
91-
92-
# Make sure NuGet exists where we expect it.
93-
if (!(Test-Path $NUGET_EXE)) {
94-
Throw "Could not find NuGet.exe"
95-
}
96-
97-
# Save nuget.exe path to environment to be available to child processed
98-
$ENV:NUGET_EXE = $NUGET_EXE
99-
10063
# Restore tools from NuGet?
10164
if (-Not $SkipToolPackageRestore.IsPresent)
10265
{
@@ -106,18 +69,9 @@ if (-Not $SkipToolPackageRestore.IsPresent)
10669

10770
Write-Verbose -Message "Restoring tools from NuGet..."
10871

109-
# Restore packages
110-
if (Test-Path $PACKAGES_CONFIG)
111-
{
112-
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion"
113-
Write-Verbose ($NuGetOutput | Out-String)
114-
}
115-
# Install just Cake if missing config
116-
else
117-
{
118-
$NuGetOutput = Invoke-Expression "&`"$DOTNET`" tool install Cake.Tool --version 3.0.0"
119-
Write-Verbose ($NuGetOutput | Out-String)
120-
}
72+
$NuGetOutput = Invoke-Expression "& dotnet tool restore"
73+
Write-Verbose ($NuGetOutput | Out-String)
74+
12175
Pop-Location
12276
if ($LASTEXITCODE -ne 0)
12377
{
@@ -127,5 +81,5 @@ if (-Not $SkipToolPackageRestore.IsPresent)
12781

12882
# Start Cake
12983
Write-Host "Running build script..."
130-
Invoke-Expression "dotnet dotnet-cake `"$Script`" --target=`"$Target`" --configuration=`"$Configuration`" --verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental"
84+
Invoke-Expression "dotnet dotnet-cake `"$Script`" --target=`"$Target`" --configuration=`"$Configuration`" --verbosity=`"$Verbosity`" $UseDryRun"
13185
exit $LASTEXITCODE

src/Polly.Specs/Polly.Specs.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0</TargetFrameworks>
55
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(TargetFrameworks);net472</TargetFrameworks>
66
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
77
</PropertyGroup>

0 commit comments

Comments
 (0)