-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
executable file
·34 lines (27 loc) · 1.05 KB
/
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
[CmdletBinding(PositionalBinding=$false)]
param(
[switch]$RunTests
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
$PSNativeCommandUseErrorActionPreference = $true
Write-Host "Run Parameters:" -ForegroundColor Cyan
Write-Host "`tPSScriptRoot: $PSScriptRoot"
Write-Host "`tRunTests: $RunTests"
Write-Host "`tdotnet --version: $(dotnet --version)"
Write-Host "Building all projects (Build.csproj traversal)..." -ForegroundColor "Magenta"
New-Variable -Name build_csproj_file -Option Constant `
-Value (Join-Path -Path $PSScriptRoot -ChildPath 'Build.csproj')
dotnet build $build_csproj_file
Write-Host "Done building." -ForegroundColor "Green"
if ($RunTests) {
Write-Host "Running tests: Build.csproj traversal (all frameworks)" -ForegroundColor "Magenta"
dotnet test $build_csproj_file --no-build --logger 'console;verbosity=detailed'
if ($LastExitCode -ne 0)
{
Write-Host "Error with tests, aborting build." -Foreground "Red"
Exit 1
}
Write-Host "Tests passed!" -ForegroundColor "Green"
}
Write-Host "Done."