-
-
Notifications
You must be signed in to change notification settings - Fork 345
/
Copy pathbuild.ps1
38 lines (32 loc) · 977 Bytes
/
build.ps1
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
Param (
[Parameter(Position = 0)]
[string]$Arg0,
[Parameter(ValueFromRemainingArguments = $true)]
[Object[]]$RemainingArgs
)
# PSScriptRoot isn't set in PowerShell 2
$minPSVer = [version]"3.0"
if (($PSVersionTable.PSVersion -lt $minPSVer)) {
[Console]::ForegroundColor = 'red'
[Console]::Error.WriteLine("This script does not support PowerShell $($PSVersionTable.PSVersion).")
[Console]::Error.WriteLine("Please upgrade to PowerShell $minPSVer or later.")
[Console]::ResetColor()
exit
}
# Globals
$RootDir = "${PSScriptRoot}"
$ScriptFile = "${RootDir}/build/Build.csproj"
$BuildDir = "${RootDir}/_build"
$ToolsDir = "${BuildDir}/tools"
# Build args
$cakeArgs = @()
if ($Arg0) {
if ($Arg0[0] -eq "-") {
$cakeArgs += "${Arg0}"
} else {
$cakeArgs += "--target=${Arg0}"
}
}
# Run Cake
dotnet run --project "${ScriptFile}" -- ${cakeArgs} ${RemainingArgs}
exit $LASTEXITCODE