Files
tongtong 3cd72d70e1 feat(desktop): 支持粘贴配对并修复串流与设备切换
- 支持 Ctrl+V 粘贴配对文本和二维码图片,预览确认后识别校验
- 修复控制发送阻塞、TLS 读写争锁、设备切换沿用旧连接及串流误关窗
- 优化媒体加密上下文、UDP 接收缓冲和异步诊断日志
- 安装器按路径停止主控与信令进程,统一递增版本、打包和清理旧产物
- 发布 0.1.3+4,通过三端编译、20 项 Flutter 测试和 58 项 Rust 单元测试
2026-11-28 16:08:07 +08:00

56 lines
3.1 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
Get-ChildItem "$root/flutter_sender/build/windows/x64/runner/Release" -File |
Where-Object { $_.Extension -in '.exe', '.dll' } | Copy-Item -Destination $Bundle
Copy-Item "$root/flutter_sender/build/windows/x64/runner/Release/data" $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"