55 lines
1.8 KiB
PowerShell
55 lines
1.8 KiB
PowerShell
# Build script (in scripts/):
|
|
# 1) generate proto code (calls genproto.ps1)
|
|
# 2) build kernel entry cmd/relay -> build/relay.exe
|
|
# 3) build all plugins -> build/plugins/<name>.exe
|
|
# Source in src/go/, artifacts output to build/.
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path $PSScriptRoot -Parent # repo root (parent of scripts/)
|
|
|
|
$goExe = 'D:\RJ\Basic\GO\bin\go.exe'
|
|
$gopath = 'C:\Users\Administrator\go'
|
|
$env:GOPATH = $gopath
|
|
$env:PATH = "$gopath\bin;$env:PATH"
|
|
|
|
$srcGo = Join-Path $root 'src\go'
|
|
$relayOut = Join-Path $root 'build\relay.exe'
|
|
$pluginOut = Join-Path $root 'build\plugins'
|
|
|
|
# 1) generate proto code
|
|
& (Join-Path $PSScriptRoot 'genproto.ps1')
|
|
|
|
# 2) build kernel entry
|
|
Push-Location $srcGo
|
|
try {
|
|
& $goExe build -o $relayOut ./cmd/relay
|
|
if ($LASTEXITCODE -ne 0) { throw "build relay failed (exit $LASTEXITCODE)" }
|
|
Write-Host "Built: $relayOut"
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
# 3) build all plugins (output name matches manifest plugin name)
|
|
New-Item -ItemType Directory -Force $pluginOut | Out-Null
|
|
$plugins = @(
|
|
@{ dir = 'echo'; out = 'echo-base.exe' },
|
|
@{ dir = 'transform'; out = 'transform-mid.exe' },
|
|
@{ dir = 'streaming'; out = 'streaming-demo.exe' },
|
|
@{ dir = 'recorder'; out = 'recorder-base.exe' },
|
|
@{ dir = 'usage'; out = 'usage-base.exe' },
|
|
@{ dir = 'proxy'; out = 'proxy.exe' },
|
|
@{ dir = 'dashboard'; out = 'dashboard.exe' }
|
|
)
|
|
Push-Location $srcGo
|
|
try {
|
|
foreach ($p in $plugins) {
|
|
$target = Join-Path $pluginOut $p.out
|
|
& $goExe build -o $target ('./plugins/' + $p.dir)
|
|
if ($LASTEXITCODE -ne 0) { throw ("build plugin " + $p.dir + " failed (exit $LASTEXITCODE)") }
|
|
Write-Host "Built plugin: $target"
|
|
}
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
Write-Host "All artifacts built under build/."
|