-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
29 lines (24 loc) · 745 Bytes
/
build.ps1
File metadata and controls
29 lines (24 loc) · 745 Bytes
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
[CmdletBinding()]
param (
[Parameter(ValueFromRemainingArguments=$True)]
[string[]] $Arguments
)
$ErrorActionPreference = "Stop"
$ToolsPath = Join-Path $PSScriptRoot "build" -Resolve | Join-Path -ChildPath "tools"
$Cake = Join-Path $ToolsPath "dotnet-cake"
$CakeVersion = "1.1.0"
$CakeArgs = @("--paths_tools=$ToolsPath")
function Exec {
param ([ScriptBlock] $ScriptBlock)
& $ScriptBlock
If ($LASTEXITCODE -ne 0) {
Write-Error "Execution failed with exit code $LASTEXITCODE"
}
}
# bootstrap cake
If (!(Test-Path "$ToolsPath/.store/cake.tool")) {
Exec { & dotnet tool install --tool-path $ToolsPath Cake.Tool --version $CakeVersion }
Exec { & $Cake @CakeArgs --bootstrap }
}
# build
Exec { & $Cake @CakeArgs @Arguments }