Skip to content

Commit 7756f64

Browse files
committed
Merge branch 'release/3.0.0'
2 parents e6ff244 + 1e5f14d commit 7756f64

File tree

144 files changed

+4874
-4623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+4874
-4623
lines changed

.appveyor.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,23 @@ environment:
99
image: Visual Studio 2022
1010

1111
#---------------------------------#
12-
# Build Script #
12+
# Install .NET #
1313
#---------------------------------#
1414
install:
15-
# Update to latest NuGet version since we require 5.3.0 for embedded icon
16-
- ps: nuget update -self
15+
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
16+
- ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
17+
- ps: Invoke-WebRequest -Uri "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1"
18+
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 5.0.408 -InstallDir $env:DOTNET_INSTALL_DIR'
19+
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 6.0.405 -InstallDir $env:DOTNET_INSTALL_DIR'
20+
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 7.0.102 -InstallDir $env:DOTNET_INSTALL_DIR'
21+
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
22+
- ps: dotnet --info
1723

24+
#---------------------------------#
25+
# Build Script #
26+
#---------------------------------#
1827
build_script:
19-
- ps: .\build.ps1 -Target CI
28+
- ps: .\build.ps1 --target=CI
2029

2130
# Tests
2231
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": "1.3.0",
7+
"commands": [
8+
"dotnet-cake"
9+
]
10+
}
11+
}
12+
}

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ updates:
99
ignore:
1010
- dependency-name: Cake.Core
1111
versions:
12-
- "> 1.0.0, < 2"
12+
- "(,4.0)"
1313
- dependency-name: Cake.Testing
1414
versions:
15-
- "> 1.0.0, < 2"
15+
- "(,4.0)"

azure-pipelines.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,15 @@ jobs:
1414
pool:
1515
vmImage: 'windows-2022'
1616
steps:
17+
# .NET 5 required for GitVersion
18+
- task: UseDotNet@2
19+
inputs:
20+
version: '5.x'
21+
- task: UseDotNet@2
22+
inputs:
23+
version: '6.x'
24+
- task: UseDotNet@2
25+
inputs:
26+
version: '7.x'
1727
- powershell: ./build.ps1
1828
displayName: 'Cake Build'

build.ps1

Lines changed: 11 additions & 257 deletions
Original file line numberDiff line numberDiff line change
@@ -1,261 +1,15 @@
1-
##########################################################################
2-
# This is the Cake bootstrapper script for PowerShell.
3-
# Based on boostrapper from https://github.com/cake-build/resources
4-
##########################################################################
1+
$ErrorActionPreference = 'Stop'
52

6-
<#
3+
$SCRIPT_NAME = "recipe.cake"
74

8-
.SYNOPSIS
9-
This is a Powershell script to bootstrap a Cake build.
5+
Write-Host "Restoring .NET Core tools"
6+
dotnet tool restore
7+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
108

11-
.DESCRIPTION
12-
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
13-
and execute your Cake build script with the parameters you provide.
9+
Write-Host "Bootstrapping Cake"
10+
dotnet cake $SCRIPT_NAME --bootstrap
11+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
1412

15-
.PARAMETER Script
16-
The build script to execute.
17-
.PARAMETER Target
18-
The build script target to run.
19-
.PARAMETER Configuration
20-
The build configuration to use.
21-
.PARAMETER Verbosity
22-
Specifies the amount of information to be displayed.
23-
.PARAMETER ShowDescription
24-
Shows description about tasks.
25-
.PARAMETER DryRun
26-
Performs a dry run.
27-
.PARAMETER SkipToolPackageRestore
28-
Skips restoring of packages.
29-
.PARAMETER ScriptArgs
30-
Remaining arguments are added here.
31-
32-
.LINK
33-
https://cakebuild.net
34-
35-
#>
36-
37-
[CmdletBinding()]
38-
Param(
39-
[string]$Script = "recipe.cake",
40-
[string]$Target,
41-
[string]$Configuration,
42-
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
43-
[string]$Verbosity,
44-
[switch]$ShowDescription,
45-
[Alias("WhatIf", "Noop")]
46-
[switch]$DryRun,
47-
[switch]$SkipToolPackageRestore,
48-
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
49-
[string[]]$ScriptArgs
50-
)
51-
52-
# Attempt to set highest encryption available for SecurityProtocol.
53-
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
54-
# will typically produce a message for PowerShell v2 (just an info
55-
# message though)
56-
try {
57-
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
58-
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
59-
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
60-
# installed (.NET 4.5 is an in-place upgrade).
61-
# PowerShell Core already has support for TLS 1.2 so we can skip this if running in that.
62-
if (-not $IsCoreCLR) {
63-
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
64-
}
65-
} catch {
66-
Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
67-
}
68-
69-
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
70-
function MD5HashFile([string] $filePath)
71-
{
72-
if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
73-
{
74-
return $null
75-
}
76-
77-
[System.IO.Stream] $file = $null;
78-
[System.Security.Cryptography.MD5] $md5 = $null;
79-
try
80-
{
81-
$md5 = [System.Security.Cryptography.MD5]::Create()
82-
$file = [System.IO.File]::OpenRead($filePath)
83-
return [System.BitConverter]::ToString($md5.ComputeHash($file))
84-
}
85-
finally
86-
{
87-
if ($file -ne $null)
88-
{
89-
$file.Dispose()
90-
}
91-
}
92-
}
93-
94-
function GetProxyEnabledWebClient
95-
{
96-
$wc = New-Object System.Net.WebClient
97-
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
98-
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
99-
$wc.Proxy = $proxy
100-
return $wc
101-
}
102-
103-
Write-Host "Preparing to run build script..."
104-
105-
if(!$PSScriptRoot){
106-
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
107-
}
108-
109-
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
110-
$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
111-
$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
112-
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
113-
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
114-
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
115-
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
116-
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
117-
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
118-
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
119-
120-
# Make sure tools folder exists
121-
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
122-
Write-Verbose -Message "Creating tools directory..."
123-
New-Item -Path $TOOLS_DIR -Type Directory | Out-Null
124-
}
125-
126-
# Make sure that packages.config exist.
127-
if (!(Test-Path $PACKAGES_CONFIG)) {
128-
Write-Verbose -Message "Downloading packages.config..."
129-
try {
130-
$wc = GetProxyEnabledWebClient
131-
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG)
132-
} catch {
133-
Throw "Could not download packages.config."
134-
}
135-
}
136-
137-
# Try find NuGet.exe in path if not exists
138-
if (!(Test-Path $NUGET_EXE)) {
139-
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
140-
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
141-
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
142-
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
143-
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
144-
$NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
145-
}
146-
}
147-
148-
# Try download NuGet.exe if not exists
149-
if (!(Test-Path $NUGET_EXE)) {
150-
Write-Verbose -Message "Downloading NuGet.exe..."
151-
try {
152-
$wc = GetProxyEnabledWebClient
153-
$wc.DownloadFile($NUGET_URL, $NUGET_EXE)
154-
} catch {
155-
Throw "Could not download NuGet.exe."
156-
}
157-
}
158-
159-
# Save nuget.exe path to environment to be available to child processed
160-
$env:NUGET_EXE = $NUGET_EXE
161-
$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
162-
"mono `"$NUGET_EXE`""
163-
} else {
164-
"`"$NUGET_EXE`""
165-
}
166-
167-
# Restore tools from NuGet?
168-
if(-Not $SkipToolPackageRestore.IsPresent) {
169-
Push-Location
170-
Set-Location $TOOLS_DIR
171-
172-
# Check for changes in packages.config and remove installed tools if true.
173-
[string] $md5Hash = MD5HashFile $PACKAGES_CONFIG
174-
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
175-
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
176-
Write-Verbose -Message "Missing or changed package.config hash..."
177-
Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
178-
Remove-Item -Recurse -Force
179-
}
180-
181-
Write-Verbose -Message "Restoring tools from NuGet..."
182-
183-
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
184-
185-
if ($LASTEXITCODE -ne 0) {
186-
Throw "An error occurred while restoring NuGet tools."
187-
}
188-
else
189-
{
190-
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
191-
}
192-
Write-Verbose -Message ($NuGetOutput | Out-String)
193-
194-
Pop-Location
195-
}
196-
197-
# Restore addins from NuGet
198-
if (Test-Path $ADDINS_PACKAGES_CONFIG) {
199-
Push-Location
200-
Set-Location $ADDINS_DIR
201-
202-
Write-Verbose -Message "Restoring addins from NuGet..."
203-
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
204-
205-
if ($LASTEXITCODE -ne 0) {
206-
Throw "An error occurred while restoring NuGet addins."
207-
}
208-
209-
Write-Verbose -Message ($NuGetOutput | Out-String)
210-
211-
Pop-Location
212-
}
213-
214-
# Restore modules from NuGet
215-
if (Test-Path $MODULES_PACKAGES_CONFIG) {
216-
Push-Location
217-
Set-Location $MODULES_DIR
218-
219-
Write-Verbose -Message "Restoring modules from NuGet..."
220-
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
221-
222-
if ($LASTEXITCODE -ne 0) {
223-
Throw "An error occurred while restoring NuGet modules."
224-
}
225-
226-
Write-Verbose -Message ($NuGetOutput | Out-String)
227-
228-
Pop-Location
229-
}
230-
231-
# Make sure that Cake has been installed.
232-
if (!(Test-Path $CAKE_EXE)) {
233-
Throw "Could not find Cake.exe at $CAKE_EXE"
234-
}
235-
236-
$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
237-
"mono `"$CAKE_EXE`""
238-
} else {
239-
"`"$CAKE_EXE`""
240-
}
241-
242-
# Build an array (not a string) of Cake arguments to be joined later
243-
$cakeArguments = @()
244-
if ($Script) { $cakeArguments += "`"$Script`"" }
245-
if ($Target) { $cakeArguments += "-target=`"$Target`"" }
246-
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
247-
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
248-
if ($ShowDescription) { $cakeArguments += "-showdescription" }
249-
if ($DryRun) { $cakeArguments += "-dryrun" }
250-
$cakeArguments += $ScriptArgs
251-
252-
# Bootstrap & start Cake
253-
Write-Host "Bootstrapping Cake..."
254-
Invoke-Expression "& $CAKE_EXE_INVOCATION $Script --bootstrap"
255-
if ($LASTEXITCODE -eq 0)
256-
{
257-
Write-Host "Running build script..."
258-
Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")"
259-
}
260-
261-
exit $LASTEXITCODE
13+
Write-Host "Running Build"
14+
dotnet cake $SCRIPT_NAME @args
15+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

0 commit comments

Comments
 (0)