Files
MoonBridge/smoke/channel-java8.ps1
T
Claude d836f6c3d3 build: 统一 release 入口,CI 覆盖客户端 mod,文档同步新结构
- 根任务 release:build/release/ 下收集服务器包、后端插件 JAR 与客户端 mod
  (经 client-mod 自身 wrapper 构建,-PskipClientMod 可跳过),附安装位置说明
  docs/release-layout.md
- verify.yml:-Pluckperms check,并新增 client-mod 构建测试 job;
  ci.yml:-Pluckperms check release,上传 build/release/,发布带 -Pluckperms
- gradlew 加可执行位
- README、CLAUDE.md、架构/发布/测试/权限/后端接入文档与 smoke 脚本改用新模块、
  新坐标与发行包 backend/ 目录

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GGL9BudzWm4dUQgBsQw4Qr
2026-10-21 10:13:06 +00:00

72 lines
3.6 KiB
PowerShell

param(
[Parameter(Mandatory = $true)][string]$Java8Home,
[Parameter(Mandatory = $true)][string]$Java25Home
)
$ErrorActionPreference = 'Stop'
$repo = Split-Path -Parent $PSScriptRoot
$fixtureClasses = Join-Path $repo 'build/channel-smoke/router'
$probeClasses = Join-Path $repo 'build/channel-smoke/probe'
$proxyClasspath = Join-Path $repo 'proxy-core/build/install/moonbridge/lib/*'
$backendClasspath = Join-Path $repo 'proxy-core/build/install/moonbridge/backend/*'
if (-not (Test-Path (Join-Path $repo 'proxy-core/build/install/moonbridge/lib'))) {
throw 'Run gradlew :proxy-core:installDist first.'
}
New-Item -ItemType Directory -Force $fixtureClasses, $probeClasses | Out-Null
& (Join-Path $Java25Home 'bin/javac.exe') -cp $proxyClasspath -d $fixtureClasses (Join-Path $PSScriptRoot 'ChannelRouterFixture.java')
if ($LASTEXITCODE -ne 0) { throw 'Router fixture compilation failed.' }
& (Join-Path $Java8Home 'bin/javac.exe') -cp $backendClasspath -d $probeClasses (Join-Path $PSScriptRoot 'ChannelJava8Probe.java')
if ($LASTEXITCODE -ne 0) { throw 'Java 8 probe compilation failed.' }
function Start-ProbeProcess([string]$Executable, [string[]]$Arguments) {
$info = New-Object System.Diagnostics.ProcessStartInfo
$info.FileName = $Executable
$info.UseShellExecute = $false
$info.CreateNoWindow = $true
$info.RedirectStandardInput = $true
$info.RedirectStandardOutput = $true
$info.RedirectStandardError = $true
# JVM paths on Windows cannot contain quotes. Arguments here are local paths/class names/numeric ports.
$info.Arguments = ($Arguments | ForEach-Object { '"' + $_ + '"' }) -join ' '
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $info
[void]$process.Start()
return $process
}
$router = $null
$probe = $null
try {
$router = Start-ProbeProcess (Join-Path $Java25Home 'bin/java.exe') @('-cp', "$fixtureClasses;$proxyClasspath", 'ChannelRouterFixture')
$routerErrors = $router.StandardError.ReadToEndAsync()
$readyDeadline = [DateTime]::UtcNow.AddSeconds(15)
do {
$ready = $router.StandardOutput.ReadLineAsync()
$remainingMillis = [int]($readyDeadline - [DateTime]::UtcNow).TotalMilliseconds
if ($remainingMillis -le 0 -or -not $ready.Wait($remainingMillis)) {
throw 'Router did not become ready within 15 seconds.'
}
$line = $ready.Result
if ($null -eq $line) { throw "Router exited before readiness: $($routerErrors.Result)" }
} until ($line -match '^CHANNEL_FIXTURE_READY (\d+)$')
$port = $Matches[1]
Write-Output $line
$routerOutput = $router.StandardOutput.ReadToEndAsync()
$probe = Start-ProbeProcess (Join-Path $Java8Home 'bin/java.exe') @('-cp', "$probeClasses;$backendClasspath", 'ChannelJava8Probe', $port)
$probeOutput = $probe.StandardOutput.ReadToEndAsync()
$probeErrors = $probe.StandardError.ReadToEndAsync()
if (-not $probe.WaitForExit(25000)) { throw 'Java 8 probe exceeded its 25 second deadline.' }
Write-Output $probeOutput.Result.Trim()
if ($probe.ExitCode -ne 0) { throw "Java 8 probe failed: $($probeErrors.Result)" }
$router.StandardInput.WriteLine()
$router.StandardInput.Flush()
if (-not $router.WaitForExit(5000)) { throw 'Router did not shut down cleanly.' }
if ($router.ExitCode -ne 0) { throw "Router failed: $($routerErrors.Result)" }
} finally {
foreach ($ownedProcess in @($probe, $router)) {
if ($null -ne $ownedProcess) {
if (-not $ownedProcess.HasExited) { $ownedProcess.Kill(); [void]$ownedProcess.WaitForExit(5000) }
$ownedProcess.Dispose()
}
}
}