-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
25 lines (22 loc) · 907 Bytes
/
Copy pathbuild.ps1
File metadata and controls
25 lines (22 loc) · 907 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
#!/usr/bin/env pwsh
# ScanAlign build/test helper. Usage: ./build.ps1 [restore|build|test|all]
param([string]$Task = "all")
$ErrorActionPreference = "Stop"
$dotnet = "dotnet"
function Invoke-Step($name, $cmd) {
Write-Host "==> $name" -ForegroundColor Cyan
& $cmd
if ($LASTEXITCODE -ne 0) { throw "$name failed (exit $LASTEXITCODE)" }
}
switch ($Task) {
"restore" { Invoke-Step "restore" { & $dotnet restore } }
"build" { Invoke-Step "build" { & $dotnet build -c Debug --nologo } }
"test" { Invoke-Step "test" { & $dotnet test -c Debug --nologo } }
"all" {
Invoke-Step "restore" { & $dotnet restore }
Invoke-Step "build" { & $dotnet build -c Debug --nologo }
Invoke-Step "test" { & $dotnet test -c Debug --nologo }
}
default { throw "Unknown task '$Task'. Use restore|build|test|all." }
}
Write-Host "OK" -ForegroundColor Green