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

51 lines
3.3 KiB
PowerShell

param(
[Parameter(Mandatory = $true)][string]$VCRedist,
[string]$Iscc,
[switch]$UseCurrentVersion
)
$ErrorActionPreference = 'Stop'
$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
$pubspec = Join-Path $root 'flutter_sender/pubspec.yaml'
$versionText = Get-Content -LiteralPath $pubspec -Raw
$match = [regex]::Match($versionText, '(?m)^version:\s*(\d+)\.(\d+)\.(\d+)\+(\d+)')
if (-not $match.Success) { throw 'Flutter version must be major.minor.patch+build' }
$version = "$($match.Groups[1]).$($match.Groups[2]).$($match.Groups[3])"
$build = [int]$match.Groups[4].Value
if (-not $UseCurrentVersion) {
$version = "$($match.Groups[1]).$($match.Groups[2]).$([int]$match.Groups[3].Value + 1)"
$build++
$utf8 = [Text.UTF8Encoding]::new($false)
[IO.File]::WriteAllText($pubspec, [regex]::Replace($versionText, '(?m)^version:.*$', "version: $version+$build"), $utf8)
$android = Join-Path $root 'android_receiver/app/build.gradle.kts'
$text = Get-Content -LiteralPath $android -Raw
$text = [regex]::Replace($text, 'versionCode = \d+', "versionCode = $build")
$text = [regex]::Replace($text, 'versionName = "[^"]+"', "versionName = `"$version`"")
[IO.File]::WriteAllText($android, $text, $utf8)
$cargo = Join-Path $root 'rust_core/Cargo.toml'
$text = Get-Content -LiteralPath $cargo -Raw
[IO.File]::WriteAllText($cargo, [regex]::Replace($text, '(?m)^version = "[^"]+"', "version = `"$version`""), $utf8)
}
function Invoke-Checked([string]$Directory, [string]$Command, [string[]]$Arguments) {
Push-Location $Directory
try { & $Command @Arguments; if ($LASTEXITCODE -ne 0) { throw "$Command failed ($LASTEXITCODE)" } }
finally { Pop-Location }
}
$android = Join-Path $root 'android_receiver'
Invoke-Checked $android './gradlew.bat' @(':app:compileNeutralDebugKotlin', ':app:compileAospDebugKotlin', ':app:assembleNeutralRelease', ':app:assembleAospRelease', ':app:assembleZhanxunRelease', '--offline')
Invoke-Checked "$root/flutter_sender" flutter @('pub', 'get', '--offline')
Invoke-Checked "$root/flutter_sender" flutter @('test')
& "$PSScriptRoot/windows/setup.ps1" -VCRedist $VCRedist -Iscc $Iscc -Version $version
# setup.ps1 throws on a failed build; do not remove previous packages until all outputs exist.
$release = Join-Path $root "dist/releases/v$version"
New-Item -ItemType Directory -Force -Path $release | Out-Null
Copy-Item -LiteralPath "$root/dist/windows/TTSTDConnect-$version-windows-x64-setup.exe" -Destination $release
foreach ($flavor in @('neutral', 'aosp', 'zhanxun')) {
Copy-Item -LiteralPath "$android/app/build/outputs/apk/$flavor/release/app-$flavor-release.apk" -Destination "$release/TTSTDConnect-Receiver-$version-$flavor.apk"
}
Get-ChildItem -LiteralPath $release -File | Where-Object { $_.Extension -in '.apk', '.exe' } | ForEach-Object {
'{0} {1}' -f (Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant(), $_.Name
} | Set-Content -LiteralPath "$release/SHA256SUMS" -Encoding ascii
@{ version = $version; build = $build; baseCommit = (git -C $root rev-parse HEAD); workingTreeModified = [bool](git -C $root status --porcelain); builtAt = [DateTimeOffset]::Now.ToString('o') } | ConvertTo-Json | Set-Content -LiteralPath "$release/BUILD-INFO.json" -Encoding utf8
& "$PSScriptRoot/prune-artifacts.ps1" -KeepVersion $version
Write-Output "Release ready: $release"