-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.ps1
More file actions
85 lines (70 loc) · 2.44 KB
/
Copy pathbuild.ps1
File metadata and controls
85 lines (70 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#Requires -Version 5.1
<#
.SYNOPSIS
fuseraft CLI build bootstrapper (Windows PowerShell / pwsh)
.DESCRIPTION
Restores the cake.tool local tool and runs the Cake build script.
.PARAMETER Target
The Cake target to run. Defaults to "Default" (full pipeline).
.PARAMETER Configuration
Build configuration: Release (default) or Debug.
.PARAMETER Runtime
.NET runtime identifier for a self-contained publish, e.g. win-x64.
.PARAMETER SkipTests
When set, skip the Test task.
.EXAMPLE
.\build.ps1
.\build.ps1 -Target Build
.\build.ps1 -Target Pack -Runtime win-x64
.\build.ps1 -Configuration Debug -Target Test
#>
[CmdletBinding()]
param(
[string] $Target = "Default",
[string] $Configuration = "Release",
[string] $Runtime = "",
[switch] $SkipTests
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
Push-Location $PSScriptRoot
try {
###########################################################################
# 1. Require dotnet SDK
###########################################################################
if (-not (Get-Command dotnet -ErrorAction SilentlyContinue)) {
Write-Error "ERROR: 'dotnet' not found. Install the .NET SDK from https://dot.net"
exit 1
}
$dotnetVersion = dotnet --version
Write-Host "Using .NET SDK $dotnetVersion"
###########################################################################
# 2. Restore local tools (includes cake.tool)
###########################################################################
Write-Host "Restoring local dotnet tools..."
dotnet tool restore --verbosity quiet
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
###########################################################################
# 3. Build argument list for Cake
###########################################################################
$cakeArgs = @(
"build.cake"
"--target=$Target"
"--configuration=$Configuration"
)
if ($Runtime) {
$cakeArgs += "--runtime=$Runtime"
}
if ($SkipTests) {
$cakeArgs += "--skipTests=true"
}
###########################################################################
# 4. Run Cake
###########################################################################
Write-Host "Starting Cake build (target: $Target)..."
dotnet cake @cakeArgs
exit $LASTEXITCODE
}
finally {
Pop-Location
}