Files
mfd-monitor-agent/scripts/build-windows.ps1
codex 89d5e27874 💥 feat(agent)!: 添加主机监控代理首版
* 实现周期采集、快照缓存、本地 HTTP API 和主动上报

* 补齐 Linux 和 Windows 主机、网络、资源、进程和 TCP 采集

* 添加服务生命周期管理、配置加载、构建脚本和测试覆盖

BREAKING CHANGE: network.ips 拆分为 network.ipv4s 和 network.ipv6s。
2026-05-18 15:25:51 +00:00

23 lines
859 B
PowerShell

$ErrorActionPreference = "Stop"
$RootDir = Resolve-Path (Join-Path $PSScriptRoot "..")
$OutDir = if ($env:OUT_DIR) { $env:OUT_DIR } else { Join-Path $RootDir "dist" }
$Version = if ($env:VERSION) { $env:VERSION } else { "0.1.0" }
$GoosTarget = if ($env:GOOS_TARGET) { $env:GOOS_TARGET } else { "windows" }
$GoarchTarget = if ($env:GOARCH_TARGET) { $env:GOARCH_TARGET } else { "amd64" }
$OutputName = if ($env:OUTPUT_NAME) { $env:OUTPUT_NAME } else { "agent-$GoosTarget-$GoarchTarget.exe" }
New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
$env:CGO_ENABLED = if ($env:CGO_ENABLED) { $env:CGO_ENABLED } else { "0" }
$env:GOOS = $GoosTarget
$env:GOARCH = $GoarchTarget
go build `
-trimpath `
-ldflags "-s -w -X main.version=$Version" `
-o (Join-Path $OutDir $OutputName) `
./cmd/agent
Write-Host "built $(Join-Path $OutDir $OutputName)"