23 lines
1.2 KiB
PowerShell
23 lines
1.2 KiB
PowerShell
param([switch]$DebugBuild)
|
|
$ErrorActionPreference = 'Stop'
|
|
$projectRoot = Split-Path $PSScriptRoot -Parent
|
|
$configuration = if ($DebugBuild) { 'debug' } else { 'release' }
|
|
Push-Location $projectRoot
|
|
try {
|
|
if ($DebugBuild) { cargo build --workspace --locked }
|
|
else { cargo build --workspace --release --locked }
|
|
if ($LASTEXITCODE -ne 0) { throw 'Rust build failed' }
|
|
New-Item -ItemType Directory -Force -Path (Join-Path $projectRoot 'bin') | Out-Null
|
|
foreach ($name in @('ads-agent', 'ads-client', 'ads-usb')) {
|
|
Copy-Item -LiteralPath (Join-Path $projectRoot "target/$configuration/$name.exe") -Destination (Join-Path $projectRoot "bin/$name.exe") -Force
|
|
}
|
|
Push-Location (Join-Path $projectRoot 'server')
|
|
try {
|
|
go build -trimpath -o (Join-Path $projectRoot 'bin/ads-server.exe') .
|
|
if ($LASTEXITCODE -ne 0) { throw 'Go build failed' }
|
|
go build -trimpath -o (Join-Path $projectRoot 'bin/ads-relay.exe') ./cmd/ads-relay
|
|
if ($LASTEXITCODE -ne 0) { throw 'Relay build failed' }
|
|
} finally { Pop-Location }
|
|
} finally { Pop-Location }
|
|
Write-Host "Built control server, relay node, agent, client and optional USB bridge in $projectRoot/bin"
|