4
This commit is contained in:
@@ -1,12 +1,54 @@
|
||||
# 编译脚本(位于 scripts/):源码在 src/go/,产物输出到 build/relay.exe
|
||||
# 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 # 仓库根目录(scripts/ 的上一级)
|
||||
$out = Join-Path $root 'build\relay.exe'
|
||||
$root = Split-Path $PSScriptRoot -Parent # repo root (parent of scripts/)
|
||||
|
||||
Push-Location (Join-Path $root 'src\go')
|
||||
$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 {
|
||||
go build -o $out .
|
||||
Write-Host "Built: $out"
|
||||
& $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/."
|
||||
|
||||
Reference in New Issue
Block a user