dragonflight/services/premiere-plugin/build/build-installer.ps1

57 lines
2.1 KiB
PowerShell
Raw Normal View History

# 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)"