dragonflight/services/premiere-plugin/build/build-installer.ps1
Zac Gaetano 8aece9cbc4 fix(premiere-plugin): make build pipeline portable to Windows PowerShell 5.1
End-to-end verification on a fresh Windows machine surfaced three issues:

1. pwsh isn't installed by default — Windows ships powershell.exe (5.1).
   Switched all script invocations + docs from `pwsh` to `powershell`.
2. .NET's strict XML parser rejects manifest.xml because the <Resources>
   comment legally contains `--` (inside `--enable-nodejs`/`--mixed-context`
   CEF flag names). Switched build-installer.ps1 to regex extraction,
   matching what build-zxp.mjs already does.
3. winget installs Inno Setup 6 to %LOCALAPPDATA%\Programs by default, not
   Program Files (x86). Added the user-scope path to the ISCC.exe fallback
   list.

Verified: `powershell -File build-all.ps1` produces both artifacts —
dragonflight-premiere-panel-1.0.0.zxp (35 KB, signature valid)
dragonflight-premiere-panel-1.0.0-windows-setup.exe (2 MB).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 16:22:46 -04:00

56 lines
2.1 KiB
PowerShell

# Dragonflight Premiere panel — Windows installer build
#
# Parses the version from ../CSXS/manifest.xml and hands it to ISCC.exe.
# Requires Inno Setup 6 on PATH (winget install JRSoftware.InnoSetup).
#
# Usage: pwsh -File build-installer.ps1
$ErrorActionPreference = 'Stop'
Set-Location $PSScriptRoot
$manifestPath = Join-Path $PSScriptRoot '..\CSXS\manifest.xml'
if (-not (Test-Path $manifestPath)) {
throw "Manifest not found at $manifestPath"
}
# Regex over XML because the manifest's <Resources> comment contains '--'
# (the --enable-nodejs/--mixed-context CEF flags), which is illegal per the
# XML spec — .NET's strict parser rejects the doc even though Adobe CEP
# tolerates it.
$manifestRaw = Get-Content -Raw -Path $manifestPath
if ($manifestRaw -notmatch '<ExtensionBundleVersion>([^<]+)</ExtensionBundleVersion>') {
throw 'Could not read <ExtensionBundleVersion> from manifest.xml'
}
$version = $Matches[1].Trim()
Write-Host "Dragonflight Premiere panel - Windows installer build v$version"
$iscc = Get-Command 'ISCC.exe' -ErrorAction SilentlyContinue
if (-not $iscc) {
# Common Inno Setup 6 install locations. winget user-scope drops it in
# %LOCALAPPDATA%\Programs; machine-wide installs land in Program Files.
$fallbacks = @(
"${env:LOCALAPPDATA}\Programs\Inno Setup 6\ISCC.exe",
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
"${env:ProgramFiles}\Inno Setup 6\ISCC.exe"
)
foreach ($p in $fallbacks) {
if (Test-Path $p) { $iscc = Get-Command $p; break }
}
if (-not $iscc) {
throw "ISCC.exe not found. Install Inno Setup 6: winget install JRSoftware.InnoSetup"
}
}
$distDir = Join-Path $PSScriptRoot 'dist'
New-Item -ItemType Directory -Force -Path $distDir | Out-Null
& $iscc.Source "/DMyAppVersion=$version" "installer.iss"
if ($LASTEXITCODE -ne 0) {
throw "ISCC failed with exit code $LASTEXITCODE"
}
$output = Join-Path $distDir "dragonflight-premiere-panel-$version-windows-setup.exe"
if (-not (Test-Path $output)) {
throw "Expected output not found: $output"
}
$size = [math]::Round((Get-Item $output).Length / 1KB, 1)
Write-Host "Built $output ($size KB)"