This commit is contained in:
@@ -2,16 +2,51 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "=============================================" -ForegroundColor Cyan
|
||||
Write-Host " BUILDING WAILS CLIENT " -ForegroundColor Cyan
|
||||
Write-Host " BUILDING SECURE WAILS CLIENT " -ForegroundColor Cyan
|
||||
Write-Host "=============================================" -ForegroundColor Cyan
|
||||
|
||||
# Setup Go path for tools like garble
|
||||
try {
|
||||
$goPath = go env GOPATH
|
||||
if ($goPath) {
|
||||
$goBin = Join-Path $goPath "bin"
|
||||
if (Test-Path $goBin) {
|
||||
if ($env:PATH -notlike "*$goBin*") {
|
||||
$env:PATH = "$goBin;$env:PATH"
|
||||
Write-Host "[*] Added $goBin to PATH temporarily" -ForegroundColor Gray
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Host "[!] Could not resolve GOPATH. Proceeding with default PATH..." -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# Ensure Garble is installed
|
||||
$garbleInstalled = $null -ne (Get-Command garble -ErrorAction SilentlyContinue)
|
||||
if (-not $garbleInstalled) {
|
||||
Write-Host "[*] Garble is not installed. Installing mvdan.cc/garble@latest..." -ForegroundColor Cyan
|
||||
try {
|
||||
go install mvdan.cc/garble@latest
|
||||
Write-Host "[+] Garble installed successfully!" -ForegroundColor Green
|
||||
} catch {
|
||||
Write-Host "[!] Failed to install Garble. Will fall back to standard Go compiler." -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# Check if wails is installed
|
||||
$wailsInstalled = $null -ne (Get-Command wails -ErrorAction SilentlyContinue)
|
||||
|
||||
if ($wailsInstalled) {
|
||||
Write-Host "[*] Found Wails CLI. Building via Wails..." -ForegroundColor Green
|
||||
Write-Host "[*] Found Wails CLI. Building via Wails with Obfuscation..." -ForegroundColor Green
|
||||
try {
|
||||
wails build
|
||||
$garbleInstalled = $null -ne (Get-Command garble -ErrorAction SilentlyContinue)
|
||||
if ($garbleInstalled) {
|
||||
Write-Host "[*] Compiling using Garble compiler..." -ForegroundColor Green
|
||||
wails build -clean -compiler garble -obfuscated -trimpath -m -ldflags "-s -w"
|
||||
} else {
|
||||
Write-Host "[!] Garble not available. Compiling with default Go compiler..." -ForegroundColor Yellow
|
||||
wails build -clean -ldflags "-s -w"
|
||||
}
|
||||
Write-Host "[+] Build completed successfully using Wails CLI!" -ForegroundColor Green
|
||||
exit 0
|
||||
} catch {
|
||||
@@ -53,8 +88,14 @@ try {
|
||||
Write-Host "[*] Building Go application..." -ForegroundColor Cyan
|
||||
|
||||
try {
|
||||
# -H windowsgui: prevents console window from flashing on startup
|
||||
go build -ldflags="-s -w -H windowsgui" -o client.exe main.go app.go
|
||||
$garbleInstalled = $null -ne (Get-Command garble -ErrorAction SilentlyContinue)
|
||||
if ($garbleInstalled) {
|
||||
Write-Host "[*] Compiling manual build with Garble..." -ForegroundColor Green
|
||||
garble build -ldflags="-s -w -H windowsgui" -o client.exe main.go app.go
|
||||
} else {
|
||||
Write-Host "[!] Garble not available. Compiling manual build with standard Go..." -ForegroundColor Yellow
|
||||
go build -ldflags="-s -w -H windowsgui" -o client.exe main.go app.go
|
||||
}
|
||||
Write-Host "[+] Build completed successfully! Generated client.exe" -ForegroundColor Green
|
||||
} catch {
|
||||
Write-Host "[-] Go build failed." -ForegroundColor Red
|
||||
|
||||
Reference in New Issue
Block a user