AstroFrame/Build.ps1

22 lines
1.1 KiB
PowerShell

param([switch]$Publish,[switch]$Test,[switch]$Package)
$ErrorActionPreference='Stop'
Set-Location $PSScriptRoot
$env:DOTNET_CLI_HOME=Join-Path $PSScriptRoot '.tools/home'
$env:NUGET_PACKAGES=Join-Path $PSScriptRoot '.tools/packages'
$env:DOTNET_CLI_TELEMETRY_OPTOUT='1'
New-Item -ItemType Directory -Force '.tools/feed' | Out-Null
$sdk=Join-Path $PSScriptRoot '.tools/dotnet/dotnet.exe'
if (!(Test-Path $sdk)) { $sdk='dotnet' }
& $sdk build src/AstroFrame.Desktop -c Release
if ($LASTEXITCODE) { throw 'Build failed' }
& $sdk build tests/AstroFrame.Validation -c Release
if ($LASTEXITCODE) { throw 'Validation build failed' }
if ($Test) {
& $sdk run --project tests/AstroFrame.Validation -c Release --no-build; if ($LASTEXITCODE) {throw 'Validation failed'}
& $sdk run --project tests/AstroFrame.Updates.Validation -c Release; if ($LASTEXITCODE) {throw 'Update validation failed'}
}
if ($Publish) {
& $sdk publish src/AstroFrame.Desktop -c Release -r win-x64 --self-contained true -o artifacts/AstroFrame
if ($LASTEXITCODE) { throw 'Publish failed' }
}
if ($Package) { & ./packaging/Release.ps1; if ($LASTEXITCODE) { throw 'Packaging failed' } }