# Builds Kaleido for Windows: the NSIS installer plus signed updater artifacts. # .\scripts\build.ps1 # release installer # .\scripts\build.ps1 -Debug # faster unoptimized build param([switch]$Debug) $ErrorActionPreference = "Stop" $root = Split-Path -Parent $PSScriptRoot Set-Location $root & "$PSScriptRoot\fetch-libmpv.ps1" # The updater signing key stays outside git (.tools/). CI provides it as a secret. if (-not $env:TAURI_SIGNING_PRIVATE_KEY) { $keyFile = Join-Path $root ".tools\updater.key" if (Test-Path $keyFile) { $env:TAURI_SIGNING_PRIVATE_KEY = Get-Content $keyFile -Raw if (-not $env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD) { $env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = "" } } else { Write-Warning "No updater signing key; building without update artifacts." $env:TAURI_CONFIG = '{"bundle":{"createUpdaterArtifacts":false}}' } } if (-not (Test-Path (Join-Path $root "node_modules"))) { npm ci } # Symbols for reading hang and crash dumps (diagnostics.rs): keep function names # and line tables in kaleido.pdb. They stay out of the executable. $env:CARGO_PROFILE_RELEASE_STRIP = "none" $env:CARGO_PROFILE_RELEASE_DEBUG = "line-tables-only" $buildArgs = @("tauri", "build") if ($Debug) { $buildArgs += "--debug" } npx @buildArgs if ($LASTEXITCODE -ne 0) { throw "Build failed" } $profile = if ($Debug) { "debug" } else { "release" } # Keep this version's executable and symbols: a dump can only be read with the # exact build that wrote it (.tools/ is ignored). if (-not $Debug) { $version = (Get-Content (Join-Path $root "src-tauri\tauri.conf.json") -Raw | ConvertFrom-Json).version $symbols = Join-Path $root ".tools\symbols\$version" New-Item -ItemType Directory -Force $symbols | Out-Null Copy-Item (Join-Path $root "src-tauri\target\release\kaleido.exe"), (Join-Path $root "src-tauri\target\release\kaleido.pdb") $symbols -Force Write-Host "Symbols kept in $symbols" } Get-ChildItem (Join-Path $root "src-tauri\target\$profile\bundle\nsis") | Select-Object Name, Length