Skip to content

Commit 03e5339

Browse files
committed
Merge branch 'release/2.0'
2 parents b4913f9 + 4b4e18f commit 03e5339

32 files changed

+1030
-430
lines changed

.appveyor.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
#---------------------------------#
22
# Build Image #
33
#---------------------------------#
4-
image: Visual Studio 2019
4+
image: Visual Studio 2022
5+
6+
#---------------------------------#
7+
# Install .NET #
8+
#---------------------------------#
9+
install:
10+
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
11+
- ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
12+
- ps: Invoke-WebRequest -Uri "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1"
13+
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 2.1.818 -InstallDir $env:DOTNET_INSTALL_DIR'
14+
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 3.1.414 -InstallDir $env:DOTNET_INSTALL_DIR'
15+
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 5.0.402 -InstallDir $env:DOTNET_INSTALL_DIR'
16+
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 6.0.100 -InstallDir $env:DOTNET_INSTALL_DIR'
17+
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
18+
- ps: dotnet --info
519

620
#---------------------------------#
721
# Build Script #
822
#---------------------------------#
923
build_script:
10-
- ps: .\build.ps1 -Target AppVeyor
24+
- ps: .\build.ps1 --target=CI
1125

1226
# Tests
1327
test: off

.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": "0.38.5",
7+
"commands": [
8+
"dotnet-cake"
9+
]
10+
}
11+
}
12+
}

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ updates:
99
ignore:
1010
- dependency-name: Cake.Core
1111
versions:
12-
- "> 1.0.0, < 2"
12+
- "> 1.0.0, < 3"
1313
- dependency-name: Cake.Common
1414
versions:
15-
- "> 1.0.0, < 2"
15+
- "> 1.0.0, < 3"
1616
- dependency-name: Cake.Testing
1717
versions:
18-
- "> 1.0.0, < 2"
18+
- "> 1.0.0, < 3"

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
### Cake ###
44
tools/*
5-
!tools/packages.config
65

76
### VisualStudio ###
87
## Ignore Visual Studio temporary files, build results, and

azure-pipelines.yml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,44 @@ pr:
1212
jobs:
1313
- job: Windows
1414
pool:
15-
vmImage: 'vs2017-win2016'
16-
steps:
15+
vmImage: 'windows-2022'
16+
steps:
1717
- powershell: |
1818
$ENV:CAKE_SKIP_GITVERSION=([string]::IsNullOrEmpty($ENV:SYSTEM_PULLREQUEST_PULLREQUESTID) -eq $False).ToString()
1919
.\build.ps1
2020
exit $LASTEXITCODE
2121
displayName: 'Cake Build'
22+
2223
- job: macOS
2324
pool:
24-
vmImage: 'macOS-10.14'
25+
vmImage: 'macOS-10.15'
2526
steps:
26-
# To manually select a Xamarin SDK version on the Hosted macOS agent, enable this script with the SDK version you want to target
27-
# https://go.microsoft.com/fwlink/?linkid=871629
28-
- bash: |
29-
sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_18_1
30-
displayName: 'Select Mono 5.18.1'
27+
- task: UseDotNet@2
28+
inputs:
29+
version: '6.x'
30+
- task: UseDotNet@2
31+
inputs:
32+
version: '5.x'
33+
- task: UseDotNet@2
34+
inputs:
35+
version: '3.x'
3136
- bash: |
3237
./build.sh
3338
displayName: 'Cake Build'
39+
3440
- job: Ubuntu
3541
pool:
36-
vmImage: 'ubuntu-16.04'
42+
vmImage: 'ubuntu-18.04'
3743
steps:
44+
- task: UseDotNet@2
45+
inputs:
46+
version: '6.x'
47+
- task: UseDotNet@2
48+
inputs:
49+
version: '5.x'
50+
- task: UseDotNet@2
51+
inputs:
52+
version: '3.x'
3853
- bash: |
39-
mono --version
40-
displayName: 'Show Mono version'
41-
# Use Mono 6.6.0 until Cake.Recipe is compatible with Cake 0.37.0 which fixes this issue
42-
- bash: |
43-
sudo apt-get remove mono-complete mono-devel mono-gac mono-runtime-common monodoc-manual \
44-
&& sudo apt-get autoremove \
45-
&& echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial/snapshots/6.6.0.161 main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list \
46-
&& sudo apt-get update \
47-
&& sudo apt-get install -y --no-install-recommends mono-complete \
48-
&& mono --version
49-
displayName: 'Downgrade Mono to 6.6.0'
50-
- bash: |
51-
./build.sh --verbosity diagnostic
54+
./build.sh --verbosity=diagnostic
5255
displayName: 'Cake Build'

build.ps1

Lines changed: 10 additions & 230 deletions
Original file line numberDiff line numberDiff line change
@@ -1,233 +1,13 @@
1-
##########################################################################
2-
# This is the Cake bootstrapper script for PowerShell.
3-
# This file was downloaded from https://github.com/cake-build/resources
4-
# Feel free to change this file to fit your needs.
5-
##########################################################################
1+
$SCRIPT_NAME = "recipe.cake"
62

7-
<#
3+
Write-Host "Restoring .NET Core tools"
4+
dotnet tool restore
5+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
86

9-
.SYNOPSIS
10-
This is a Powershell script to bootstrap a Cake build.
7+
Write-Host "Bootstrapping Cake"
8+
dotnet cake $SCRIPT_NAME --bootstrap
9+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
1110

12-
.DESCRIPTION
13-
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
14-
and execute your Cake build script with the parameters you provide.
15-
16-
.PARAMETER Script
17-
The build script to execute.
18-
.PARAMETER Target
19-
The build script target to run.
20-
.PARAMETER Configuration
21-
The build configuration to use.
22-
.PARAMETER Verbosity
23-
Specifies the amount of information to be displayed.
24-
.PARAMETER ShowDescription
25-
Shows description about tasks.
26-
.PARAMETER DryRun
27-
Performs a dry run.
28-
.PARAMETER Experimental
29-
Uses the nightly builds of the Roslyn script engine.
30-
.PARAMETER Mono
31-
Uses the Mono compiler rather than the Roslyn script engine.
32-
.PARAMETER SkipToolPackageRestore
33-
Skips restoring of packages.
34-
.PARAMETER ScriptArgs
35-
Remaining arguments are added here.
36-
37-
.LINK
38-
https://cakebuild.net
39-
40-
#>
41-
42-
[CmdletBinding()]
43-
Param(
44-
[string]$Script = "recipe.cake",
45-
[string]$Target = "Default",
46-
[ValidateSet("Release", "Debug")]
47-
[string]$Configuration = "Release",
48-
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
49-
[string]$Verbosity = "Verbose",
50-
[switch]$ShowDescription,
51-
[Alias("WhatIf", "Noop")]
52-
[switch]$DryRun,
53-
[switch]$Experimental,
54-
[switch]$Mono,
55-
[switch]$SkipToolPackageRestore,
56-
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
57-
[string[]]$ScriptArgs
58-
)
59-
60-
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
61-
function MD5HashFile([string] $filePath)
62-
{
63-
if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
64-
{
65-
return $null
66-
}
67-
68-
[System.IO.Stream] $file = $null;
69-
[System.Security.Cryptography.MD5] $md5 = $null;
70-
try
71-
{
72-
$md5 = [System.Security.Cryptography.MD5]::Create()
73-
$file = [System.IO.File]::OpenRead($filePath)
74-
return [System.BitConverter]::ToString($md5.ComputeHash($file))
75-
}
76-
finally
77-
{
78-
if ($file -ne $null)
79-
{
80-
$file.Dispose()
81-
}
82-
}
83-
}
84-
85-
function GetProxyEnabledWebClient
86-
{
87-
$wc = New-Object System.Net.WebClient
88-
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
89-
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
90-
$wc.Proxy = $proxy
91-
return $wc
92-
}
93-
94-
Write-Host "Preparing to run build script..."
95-
96-
if(!$PSScriptRoot){
97-
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
98-
}
99-
100-
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
101-
$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
102-
$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
103-
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
104-
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
105-
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
106-
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
107-
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
108-
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
109-
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
110-
111-
# Make sure tools folder exists
112-
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
113-
Write-Verbose -Message "Creating tools directory..."
114-
New-Item -Path $TOOLS_DIR -Type directory | out-null
115-
}
116-
117-
# Make sure that packages.config exist.
118-
if (!(Test-Path $PACKAGES_CONFIG)) {
119-
Write-Verbose -Message "Downloading packages.config..."
120-
try {
121-
$wc = GetProxyEnabledWebClient
122-
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
123-
Throw "Could not download packages.config."
124-
}
125-
}
126-
127-
# Try find NuGet.exe in path if not exists
128-
if (!(Test-Path $NUGET_EXE)) {
129-
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
130-
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
131-
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
132-
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
133-
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
134-
$NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
135-
}
136-
}
137-
138-
# Try download NuGet.exe if not exists
139-
if (!(Test-Path $NUGET_EXE)) {
140-
Write-Verbose -Message "Downloading NuGet.exe..."
141-
try {
142-
$wc = GetProxyEnabledWebClient
143-
$wc.DownloadFile($NUGET_URL, $NUGET_EXE)
144-
} catch {
145-
Throw "Could not download NuGet.exe."
146-
}
147-
}
148-
149-
# Save nuget.exe path to environment to be available to child processed
150-
$ENV:NUGET_EXE = $NUGET_EXE
151-
152-
# Restore tools from NuGet?
153-
if(-Not $SkipToolPackageRestore.IsPresent) {
154-
Push-Location
155-
Set-Location $TOOLS_DIR
156-
157-
# Check for changes in packages.config and remove installed tools if true.
158-
[string] $md5Hash = MD5HashFile($PACKAGES_CONFIG)
159-
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
160-
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
161-
Write-Verbose -Message "Missing or changed package.config hash..."
162-
Remove-Item * -Recurse -Exclude packages.config,nuget.exe
163-
}
164-
165-
Write-Verbose -Message "Restoring tools from NuGet..."
166-
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
167-
168-
if ($LASTEXITCODE -ne 0) {
169-
Throw "An error occurred while restoring NuGet tools."
170-
}
171-
else
172-
{
173-
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
174-
}
175-
Write-Verbose -Message ($NuGetOutput | out-string)
176-
177-
Pop-Location
178-
}
179-
180-
# Restore addins from NuGet
181-
if (Test-Path $ADDINS_PACKAGES_CONFIG) {
182-
Push-Location
183-
Set-Location $ADDINS_DIR
184-
185-
Write-Verbose -Message "Restoring addins from NuGet..."
186-
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
187-
188-
if ($LASTEXITCODE -ne 0) {
189-
Throw "An error occurred while restoring NuGet addins."
190-
}
191-
192-
Write-Verbose -Message ($NuGetOutput | out-string)
193-
194-
Pop-Location
195-
}
196-
197-
# Restore modules from NuGet
198-
if (Test-Path $MODULES_PACKAGES_CONFIG) {
199-
Push-Location
200-
Set-Location $MODULES_DIR
201-
202-
Write-Verbose -Message "Restoring modules from NuGet..."
203-
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
204-
205-
if ($LASTEXITCODE -ne 0) {
206-
Throw "An error occurred while restoring NuGet modules."
207-
}
208-
209-
Write-Verbose -Message ($NuGetOutput | out-string)
210-
211-
Pop-Location
212-
}
213-
214-
# Make sure that Cake has been installed.
215-
if (!(Test-Path $CAKE_EXE)) {
216-
Throw "Could not find Cake.exe at $CAKE_EXE"
217-
}
218-
219-
# Build Cake arguments
220-
$cakeArguments = @("$Script");
221-
if ($Target) { $cakeArguments += "-target=$Target" }
222-
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
223-
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
224-
if ($ShowDescription) { $cakeArguments += "-showdescription" }
225-
if ($DryRun) { $cakeArguments += "-dryrun" }
226-
if ($Experimental) { $cakeArguments += "-experimental" }
227-
if ($Mono) { $cakeArguments += "-mono" }
228-
$cakeArguments += $ScriptArgs
229-
230-
# Start Cake
231-
Write-Host "Running build script..."
232-
&$CAKE_EXE $cakeArguments
233-
exit $LASTEXITCODE
11+
Write-Host "Running Build"
12+
dotnet cake $SCRIPT_NAME @args
13+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

0 commit comments

Comments
 (0)