-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
40 lines (32 loc) · 991 Bytes
/
build.ps1
File metadata and controls
40 lines (32 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Build script for Duso - PowerShell equivalent to build.sh local binary build
# Ensure we're in the project root
if (-not (Test-Path "go.mod") -or -not (Test-Path "cmd/duso")) {
Write-Error "Error: build.ps1 must be run from project root"
exit 1
}
# Get version from git tag or use "dev"
$VERSION = git describe --tags 2>$null
if ($LASTEXITCODE -ne 0) {
$VERSION = "dev"
}
# Local platform build
Write-Host "Building for current platform..."
# Generate embedded files
go generate ./cmd/duso
if ($LASTEXITCODE -ne 0) {
Write-Error "go generate failed"
exit 1
}
# Create bin directory if it doesn't exist
if (-not (Test-Path "bin")) {
New-Item -ItemType Directory -Path "bin" | Out-Null
}
# Build the binary
$outputPath = "bin/duso.exe"
$ldflags = "-s -w -X main.Version=$VERSION"
go build -ldflags $ldflags -trimpath -o $outputPath ./cmd/duso
if ($LASTEXITCODE -ne 0) {
Write-Error "Build failed"
exit 1
}
Write-Host "[OK] Built $outputPath $VERSION"