$ErrorActionPreference = 'Stop' $projectRoot = Split-Path $PSScriptRoot -Parent $output = Join-Path $projectRoot 'bin/flutter-win-x64' Push-Location (Join-Path $projectRoot 'flutter_manager') try { flutter build windows --release if ($LASTEXITCODE -ne 0) { throw 'Flutter publish failed' } } finally { Pop-Location } New-Item -ItemType Directory -Force -Path $output | Out-Null Copy-Item -Path (Join-Path $projectRoot 'flutter_manager/build/windows/x64/runner/Release/*') -Destination $output -Recurse -Force foreach ($name in @('ads-client','ads-agent','adsctl')) { $tool = Join-Path $projectRoot "bin/$name.exe" if (-not (Test-Path -LiteralPath $tool)) { throw "先运行 scripts/build.ps1:缺少 $name" } Copy-Item -LiteralPath $tool -Destination $output -Force } $tools = Join-Path $output 'tools/scrcpy' New-Item -ItemType Directory -Force -Path $tools | Out-Null Copy-Item -Path (Join-Path $projectRoot 'bin/tools/scrcpy/*') -Destination $tools -Recurse -Force # Private credentials are deliberately excluded from distributable artifacts. Write-Host "Flutter published to $output (credentials excluded)"