- 增加 Inno Setup 安装器及运行库安装支持 - 增加 deb、rpm、AppImage 打包与完整 Release 目录校验 - 修复 WSL 打包权限和安装路径,补充构建说明及换行规则
54 lines
2.9 KiB
PowerShell
54 lines
2.9 KiB
PowerShell
param(
|
|
[string]$Bundle,
|
|
[string]$Iscc,
|
|
[string]$Version,
|
|
[Parameter(Mandatory = $true)][string]$VCRedist
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
|
|
if (-not $Version) {
|
|
$Version = ([regex]::Match((Get-Content "$root/flutter_sender/pubspec.yaml" -Raw), '(?m)^version:\s*(\d+\.\d+\.\d+)')).Groups[1].Value
|
|
}
|
|
if ($Version -notmatch '^\d+\.\d+\.\d+$') { throw 'Version must be major.minor.patch' }
|
|
if (-not $Iscc) {
|
|
$command = Get-Command ISCC.exe -ErrorAction SilentlyContinue
|
|
if ($command) { $Iscc = $command.Source }
|
|
else {
|
|
foreach ($base in @(${env:ProgramFiles(x86)}, $env:ProgramFiles)) {
|
|
if ($base -and (Test-Path "$base/Inno Setup 6/ISCC.exe")) { $Iscc = "$base/Inno Setup 6/ISCC.exe"; break }
|
|
}
|
|
}
|
|
}
|
|
if (-not $Iscc -or -not (Test-Path -LiteralPath $Iscc)) { throw 'Install Inno Setup 6 or supply -Iscc path/to/ISCC.exe' }
|
|
$VCRedist = (Resolve-Path -LiteralPath $VCRedist).Path
|
|
function Invoke-Step([string]$Directory, [string]$Command, [string[]]$Arguments) {
|
|
Push-Location $Directory
|
|
try {
|
|
& $Command @Arguments
|
|
if ($LASTEXITCODE -ne 0) { throw "$Command failed: $LASTEXITCODE" }
|
|
} finally { Pop-Location }
|
|
}
|
|
$output = "$root/dist/windows"
|
|
New-Item -ItemType Directory -Force -Path $output | Out-Null
|
|
if (-not $Bundle) {
|
|
Invoke-Step "$root/rust_core" cargo @('check', '--offline')
|
|
Invoke-Step "$root/rust_core" cargo @('test', '--offline', '--lib')
|
|
Invoke-Step "$root/rust_core" cargo @('build', '--release', '--offline', '--target', 'x86_64-pc-windows-msvc', '--target-dir', "$root/rust_core/target")
|
|
Invoke-Step "$root/flutter_sender" flutter @('pub', 'get')
|
|
Invoke-Step "$root/flutter_sender" dart @('analyze', 'lib')
|
|
Invoke-Step "$root/flutter_sender" flutter @('build', 'windows', '--debug')
|
|
Invoke-Step "$root/flutter_sender" flutter @('build', 'windows', '--release')
|
|
$Bundle = Join-Path $output ('stage-' + [guid]::NewGuid().ToString('N'))
|
|
New-Item -ItemType Directory -Path $Bundle | Out-Null
|
|
Copy-Item "$root/flutter_sender/build/windows/x64/runner/Release/*" $Bundle -Recurse
|
|
Copy-Item "$root/rust_core/target/x86_64-pc-windows-msvc/release/ttstdconnect_core.dll" $Bundle
|
|
Invoke-Step "$root/signaling_server" go @('build', '-o', "$Bundle/signaling_server.exe", '.')
|
|
}
|
|
$Bundle = (Resolve-Path -LiteralPath $Bundle).Path
|
|
foreach ($file in @('ttstd_sender.exe', 'flutter_windows.dll', 'ttstdconnect_core.dll', 'signaling_server.exe', 'data/app.so', 'data/flutter_assets')) {
|
|
if (-not (Test-Path -LiteralPath (Join-Path $Bundle $file))) { throw "Incomplete Release bundle: $file" }
|
|
}
|
|
& $Iscc "/DAppVersion=$Version" "/DBundleDir=$Bundle" "/DOutputDir=$output" "/DVCRedist=$VCRedist" "$PSScriptRoot/setup.iss"
|
|
if ($LASTEXITCODE -ne 0) { throw "Inno Setup failed: $LASTEXITCODE" }
|
|
Write-Host "Installer: $output/TTSTDConnect-$Version-windows-x64-setup.exe"
|