Files
thor-watcher/installer/build.ps1

31 lines
1.1 KiB
PowerShell

$ErrorActionPreference = "Stop"
$WixBin = $env:WIX
if (-not $WixBin) {
Write-Error "WIX environment variable not set. Set WIX to your WiX Toolset bin path (e.g., C:\Program Files (x86)\WiX Toolset v3.11\bin)."
}
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$InstallerDir = $ScriptDir
$RootDir = Resolve-Path (Join-Path $InstallerDir "..")
$ProductWxs = Join-Path $InstallerDir "Product.wxs"
$DistDir = Join-Path $RootDir "dist"
$NssmPath = Join-Path $InstallerDir "tools\nssm.exe"
if (-not (Test-Path $DistDir)) {
Write-Error "dist folder not found. Build the EXE with PyInstaller first."
}
if (-not (Test-Path $NssmPath)) {
Write-Error "Missing nssm.exe at $NssmPath. Place the NSSM binary there before building."
}
$candle = Join-Path $WixBin "candle.exe"
$light = Join-Path $WixBin "light.exe"
& $candle -nologo $ProductWxs -out (Join-Path $InstallerDir "Product.wixobj")
& $light -nologo -ext WixUIExtension -ext WixUtilExtension -out (Join-Path $InstallerDir "ThorIngest.msi") (Join-Path $InstallerDir "Product.wixobj")
Write-Host "Built MSI: $InstallerDir\ThorIngest.msi"