Files
goaiapi/scripts/README.md
2026-06-03 14:09:58 +08:00

28 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# scripts — 构建与代码生成脚本
PowerShell 脚本,需在 Windows PowerShell 5.1 下运行。脚本内对 Go 工具链与 protoc 的路径做了硬编码,换机时按本机实际调整。
| 脚本 | 作用 |
|---|---|
| `build.ps1` | 全量构建:① 调 `genproto.ps1` 生成 proto 代码 → ② 编译内核入口 `cmd/relay``build/relay.exe` → ③ 逐个编译全部插件到 `build/plugins/<name>.exe` |
| `genproto.ps1` | 从 `src/go/proto/contract/v1/contract.proto` 生成 Go 代码(`*.pb.go` / `*_grpc.pb.go`,已入库)。仅在改契约时需要重跑 |
## 用法
```powershell
.\scripts\build.ps1 # 完整构建(含 codegen
.\scripts\genproto.ps1 # 仅重新生成 proto 代码
```
## 产物
`build.ps1` 产出:
- `build/relay.exe` — 内核入口
- `build/plugins/{echo-base,transform-mid,streaming-demo,recorder-base,usage-base,proxy,dashboard}.exe` — 七个插件(产物名与各自 manifest 中的插件名一致)
## 注意
- 脚本注释一律用 ASCII。PowerShell 5.1 对含中文注释的脚本可能因 GBK/UTF-8 解码不一致而误判 token导致解析错误`build.ps1` 全用英文注释。
- `protoc-gen-go` / `protoc-gen-go-grpc` 须先 `go install``GOPATH\bin`,脚本会把该目录加到 PATH 供 protoc 发现。