Preserve tested Verify source, authoritative READY checks, bounded bridge retries, diagnostics and failure-only reporting. Include 336-test suite and packaging assets; exclude live Mentor samples, field logs, backups and distributions.
27 lines
1.5 KiB
PowerShell
27 lines
1.5 KiB
PowerShell
param(
|
|
[string]$PythonExecutable,
|
|
[string]$OutputDirectory = 'dist'
|
|
)
|
|
$ErrorActionPreference='Stop'
|
|
$root=Split-Path $PSScriptRoot -Parent
|
|
$py = if($PythonExecutable){$PythonExecutable}elseif(Test-Path "$root\.venv\Scripts\python.exe"){"$root\.venv\Scripts\python.exe"}else{(Get-Command python).Source}
|
|
$distRoot = if ([IO.Path]::IsPathRooted($OutputDirectory)) {
|
|
[IO.Path]::GetFullPath($OutputDirectory)
|
|
} else {
|
|
[IO.Path]::GetFullPath((Join-Path $root $OutputDirectory))
|
|
}
|
|
Push-Location $root
|
|
try {
|
|
& $py -m PyInstaller --noconfirm --clean --distpath $distRoot packaging\CbbRefreshVerify.spec
|
|
if ($LASTEXITCODE -ne 0) { throw "PyInstaller failed: $LASTEXITCODE" }
|
|
$exe = Join-Path $distRoot 'CbbRefreshVerify-Background\CbbRefreshVerify.exe'
|
|
if (-not (Test-Path -LiteralPath $exe)) { throw 'PyInstaller 未生成 exe' }
|
|
$smokeRoot = Join-Path $root ('build\frozen-smoke-' + [guid]::NewGuid().ToString('N'))
|
|
$process = Start-Process -FilePath $exe -ArgumentList ('--smoke-test --data-root "' + $smokeRoot + '"') -WindowStyle Hidden -PassThru
|
|
if (-not $process.WaitForExit(30000)) { Stop-Process -Id $process.Id; throw 'Frozen UI smoke timeout' }
|
|
if ($process.ExitCode -ne 0) { throw "Frozen UI smoke failed: $($process.ExitCode)" }
|
|
$log = Get-Content -Raw -LiteralPath (Join-Path $smokeRoot 'logs\application.log')
|
|
if ($log -notmatch 'gui_smoke_window_created' -or $log -notmatch 'application_clean_shutdown exit_code=0') { throw 'Frozen UI lifecycle incomplete' }
|
|
Write-Output $exe
|
|
} finally { Pop-Location }
|