|
| 1 | +<# |
| 2 | +.SYNOPSIS |
| 3 | + Builds a Windows installer/executable for Wave Terminal. |
| 4 | +
|
| 5 | +.DESCRIPTION |
| 6 | + Wraps the project's Task-based build pipeline (`task package`) to produce |
| 7 | + Windows artifacts (.exe / .msi / .zip) in the `make/` directory. |
| 8 | +
|
| 9 | + This script must be run on a Windows machine. Cross-compiling a working |
| 10 | + Windows installer from Linux/macOS is not supported by this project's |
| 11 | + build tooling. |
| 12 | +
|
| 13 | + Prerequisites (see BUILD.md for full details): |
| 14 | + - Node.js 22 LTS https://nodejs.org/en/download |
| 15 | + - Go https://go.dev/doc/install |
| 16 | + - Zig (for CGO) https://ziglang.org/learn/getting-started/#managers |
| 17 | + - Task https://taskfile.dev/installation/ |
| 18 | +
|
| 19 | + The resulting build is unsigned unless you set the code-signing |
| 20 | + environment variables electron-builder expects (CSC_LINK / CSC_KEY_PASSWORD, |
| 21 | + or the DigiCert Keylocker SM_* variables used in CI - see |
| 22 | + .github/workflows/build-helper.yml for reference). |
| 23 | +
|
| 24 | +.PARAMETER Clean |
| 25 | + Remove the `make/` and `dist/` directories before building. |
| 26 | +
|
| 27 | +.EXAMPLE |
| 28 | + ./scripts/build-windows.ps1 |
| 29 | +
|
| 30 | +.EXAMPLE |
| 31 | + ./scripts/build-windows.ps1 -Clean |
| 32 | +#> |
| 33 | + |
| 34 | +[CmdletBinding()] |
| 35 | +param( |
| 36 | + [switch]$Clean |
| 37 | +) |
| 38 | + |
| 39 | +$ErrorActionPreference = "Stop" |
| 40 | + |
| 41 | +function Test-Command { |
| 42 | + param([string]$Name) |
| 43 | + return [bool](Get-Command $Name -ErrorAction SilentlyContinue) |
| 44 | +} |
| 45 | + |
| 46 | +if ($env:OS -ne "Windows_NT") { |
| 47 | + Write-Host "This script must be run on Windows (it builds a native Windows installer)." -ForegroundColor Red |
| 48 | + exit 1 |
| 49 | +} |
| 50 | + |
| 51 | +Write-Host "==> Checking prerequisites..." -ForegroundColor Cyan |
| 52 | + |
| 53 | +$missing = @() |
| 54 | +if (-not (Test-Command "node")) { $missing += "Node.js 22 LTS - https://nodejs.org/en/download" } |
| 55 | +if (-not (Test-Command "go")) { $missing += "Go - https://go.dev/doc/install" } |
| 56 | +if (-not (Test-Command "zig")) { $missing += "Zig - https://ziglang.org/learn/getting-started/#managers" } |
| 57 | +if (-not (Test-Command "task")) { $missing += "Task - https://taskfile.dev/installation/" } |
| 58 | + |
| 59 | +if ($missing.Count -gt 0) { |
| 60 | + Write-Host "Missing required tools:" -ForegroundColor Red |
| 61 | + foreach ($m in $missing) { Write-Host " - $m" -ForegroundColor Red } |
| 62 | + Write-Host "" |
| 63 | + Write-Host "See BUILD.md ('Windows' section) for setup instructions." -ForegroundColor Yellow |
| 64 | + exit 1 |
| 65 | +} |
| 66 | + |
| 67 | +# Repo root is one directory up from this script. |
| 68 | +$repoRoot = Split-Path -Parent $PSScriptRoot |
| 69 | +Push-Location $repoRoot |
| 70 | +try { |
| 71 | + if ($Clean) { |
| 72 | + Write-Host "==> Cleaning make/ and dist/..." -ForegroundColor Cyan |
| 73 | + task clean |
| 74 | + } |
| 75 | + |
| 76 | + Write-Host "==> Building and packaging Wave Terminal for Windows (task package)..." -ForegroundColor Cyan |
| 77 | + Write-Host " This installs npm/go dependencies, builds wavesrv + wsh, then runs electron-builder." -ForegroundColor DarkGray |
| 78 | + task package |
| 79 | + |
| 80 | + Write-Host "" |
| 81 | + $artifacts = Get-ChildItem -Path (Join-Path $repoRoot "make") -Include *.exe, *.msi, *.zip -File -Recurse -ErrorAction SilentlyContinue |
| 82 | + if ($artifacts) { |
| 83 | + Write-Host "==> Build complete. Artifacts:" -ForegroundColor Green |
| 84 | + foreach ($a in $artifacts) { Write-Host " $($a.FullName)" -ForegroundColor Green } |
| 85 | + } |
| 86 | + else { |
| 87 | + Write-Host "==> Build finished, but no .exe/.msi/.zip files were found under make/." -ForegroundColor Yellow |
| 88 | + Write-Host " Check the output above for errors." -ForegroundColor Yellow |
| 89 | + } |
| 90 | +} |
| 91 | +finally { |
| 92 | + Pop-Location |
| 93 | +} |
0 commit comments