$ErrorActionPreference = 'Stop' $ridTools = 'D:/Rust_Contact/util/tools/rid-map-downloader/0.1.0' $env:GOCACHE = 'D:/Rust_Contact/util/tools/go-cache' $env:GOMODCACHE = 'D:/Rust_Contact/util/tools/go-modules' New-Item -ItemType Directory -Force $ridTools | Out-Null Push-Location (Join-Path $PSScriptRoot 'map-downloader') try { go test ./... if ($LASTEXITCODE -ne 0) { throw 'Go map downloader tests failed' } go build -trimpath -ldflags '-s -w' -o (Join-Path $ridTools 'rid-map-downloader.exe') . if ($LASTEXITCODE -ne 0) { throw 'Go map downloader build failed' } Copy-Item -LiteralPath 'LICENSE-upstream.txt' -Destination $ridTools $env:RID_MAP_DOWNLOADER = Join-Path $ridTools 'rid-map-downloader.exe' Write-Output $env:RID_MAP_DOWNLOADER } finally { Pop-Location }