AstroFrame/Build.ps1
2026-10-03 18:29:15 -07:00

17 lines
860 B
PowerShell

param([switch]$Publish,[switch]$Test)
$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'
$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'} }
if ($Publish) {
& $sdk publish src/AstroFrame.Desktop -c Release -r win-x64 --self-contained true -o artifacts/AstroFrame
if ($LASTEXITCODE) { throw 'Publish failed' }
}