-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
43 lines (34 loc) · 1.48 KB
/
build.ps1
File metadata and controls
43 lines (34 loc) · 1.48 KB
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
41
42
43
# Build script for Custos on Windows
Write-Host "Building Custos for Windows..."
# Ensure we are in the project root
$exclude = "-ldflags '-s -w'"
$platform = "windows/amd64"
# Clean build directory if needed (Wails handles this usually, but good to be sure if we want a fresh start)
# Remove-Item -Path "build/bin" -Recurse -ErrorAction SilentlyContinue
# various options:
# -clean: cleans the build directory
# -platform: target platform
# -ldflags: linker flags to reduce binary size and strip debug info
# -nsis: generate installer
# Build the adblock Rust library first
& ".\lib\adblock\build.ps1"
if ($LASTEXITCODE -ne 0) {
Write-Host "Failed to build adblock library. Aborting." -ForegroundColor Red
exit 1
}
wails build -clean -platform $platform -ldflags "-s -w -H windowsgui" -nsis
if ($LASTEXITCODE -eq 0) {
# Get version from app.json
$appConfig = Get-Content "app.json" | ConvertFrom-Json
$version = $appConfig.version
$installerName = "Custos-$version.exe"
$generatedInstaller = "build/bin/Custos-amd64-installer.exe"
if (Test-Path $generatedInstaller) {
Rename-Item -Path $generatedInstaller -NewName $installerName -Force
Write-Host "Build successful! Installer located at build/bin/$installerName" -ForegroundColor Green
} else {
Write-Host "Build successful! Executable located at build/bin/Custos.exe (Installer not found)" -ForegroundColor Yellow
}
} else {
Write-Host "Build failed." -ForegroundColor Red
}