增加持久化构建记录、历史 APK 恢复、断点下载、Gradle 缓存复用、系统代理与按工程选择服务端 JDK。 支持已有工程目录、Git 状态检查、原生忽略规则和文本换行等价比较,修复干净检出与历史同步快照不一致时的误拦截。 优化插件设备可选构建、侧栏滚动、左右日志布局、时间显示和构建变体快速选择,并补充部署与协议文档。 验证:17 项 Go 测试、22 项插件测试及 HTTP/HTTPS 两条端到端测试通过;Linux/macOS 服务端交叉编译通过。
36 lines
2.6 KiB
PowerShell
36 lines
2.6 KiB
PowerShell
param([string]$Root='C:\ProgramData\VibeCodingRemoteCompilation',[string]$EnvironmentFile=(Join-Path $PSScriptRoot 'build-environment.json'),[switch]$GrantCacheAccess)
|
|
$ErrorActionPreference='Stop'
|
|
$markers=@(Get-ChildItem -LiteralPath "$Root\data\projects" -Directory -ErrorAction SilentlyContinue | ForEach-Object {Get-Item -LiteralPath (Join-Path $_.FullName 'active-build') -ErrorAction SilentlyContinue})
|
|
if($markers.Count){Write-Output 'Active build IDs (not stopped):';$markers | ForEach-Object{Get-Content -LiteralPath $_.FullName};throw 'Wait for active builds; this upgrade never cancels them automatically.'}
|
|
$configPath="$Root\bin\RemoteCompileService.xml"
|
|
[xml]$config=Get-Content -LiteralPath $configPath -Raw
|
|
$next=Join-Path $PSScriptRoot 'remotecompile-windows-amd64.exe'
|
|
if(-not(Test-Path -LiteralPath $next)){throw 'New binary missing'}
|
|
if(-not(Test-Path -LiteralPath $EnvironmentFile)){throw 'Capture build-environment.json from the intended developer account first'}
|
|
$environment=Get-Content -LiteralPath $EnvironmentFile -Raw | ConvertFrom-Json
|
|
if(-not $environment.gradleUserHome){throw 'Gradle cache path required'}
|
|
New-Item -ItemType Directory -Force -Path $environment.gradleUserHome | Out-Null
|
|
# Traverse parent directories, grant writes only to the explicitly selected Gradle cache.
|
|
if($GrantCacheAccess){
|
|
$parent=Split-Path $environment.gradleUserHome
|
|
while($parent -and $parent -ne [IO.Path]::GetPathRoot($parent)){
|
|
& icacls.exe $parent /grant '*S-1-5-19:(X)' | Out-Null
|
|
if($LASTEXITCODE -ne 0){throw "Cannot grant cache path traversal: $parent"}
|
|
$parent=Split-Path $parent
|
|
}
|
|
& icacls.exe $environment.gradleUserHome /grant '*S-1-5-19:(OI)(CI)M' | Out-Null
|
|
if($LASTEXITCODE -ne 0){throw 'Cannot grant selected Gradle cache permission'}
|
|
}
|
|
Stop-Service RemoteCompile
|
|
(Get-Service RemoteCompile).WaitForStatus('Stopped',[TimeSpan]::FromSeconds(45))
|
|
Copy-Item -LiteralPath "$Root\bin\remotecompile.exe" -Destination "$Root\bin\remotecompile.before-0.2.0.exe" -Force
|
|
Copy-Item -LiteralPath $configPath -Destination "$configPath.before-0.2.0.xml" -Force
|
|
Copy-Item -LiteralPath $next -Destination "$Root\bin\remotecompile.exe" -Force
|
|
$destination="$Root\build-environment.json"
|
|
Copy-Item -LiteralPath $EnvironmentFile -Destination $destination -Force
|
|
$config.service.arguments=([string]$config.service.arguments -replace '\s+-environment-file\s+"[^"]*"','')+" -environment-file `"$destination`""
|
|
[IO.File]::WriteAllText($configPath,$config.OuterXml,(New-Object Text.UTF8Encoding($false)))
|
|
Start-Service RemoteCompile
|
|
Get-Service RemoteCompile | Select-Object Name,Status
|
|
Write-Output 'Updated service. Verify HTTPS health and /api/v1/environment with the existing token and certificate.'
|