mirror of
https://github.com/layue13/MoonBridge.git
synced 2026-10-25 18:46:18 +00:00
发行包去掉 bin/ 启动脚本和 lib/ 下的 42 个依赖 jar,改为与其他代理服务端一样 用 java -jar moonbridge.jar 启动: - proxy-core 用 shadow 打出含全部依赖的 moonbridge.jar(合并 META-INF/services, 清单写入 Main-Class、Multi-Release 与 Enable-Native-Access: ALL-UNNAMED) - 泄漏检测默认关闭改由 ProxyMain 在加载 Netty 前设置,显式 -D 仍优先 - 移除不再使用的 application 约定插件 - 安装包检查、烟测与基准脚本改用发行包根目录作 classpath;文档同步 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.8 KiB
PowerShell
44 lines
1.8 KiB
PowerShell
param(
|
|
[ValidateRange(1, 10)][int]$Repeats = 5,
|
|
[switch]$RecordJfr,
|
|
[switch]$OnlyNoSubscriber,
|
|
[string]$RuntimeLibDirectory
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$repoRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
|
|
$installLib = Join-Path $repoRoot "proxy\core\build\install\moonbridge"
|
|
$classes = Join-Path $PSScriptRoot "build"
|
|
|
|
Push-Location $repoRoot
|
|
try {
|
|
& .\gradlew.bat :proxy-core:installDist
|
|
if ($LASTEXITCODE -ne 0) { throw "installDist failed with exit code $LASTEXITCODE" }
|
|
|
|
New-Item -ItemType Directory -Path $classes -Force | Out-Null
|
|
& javac -cp "$installLib\*" -d $classes `
|
|
(Join-Path $PSScriptRoot "TransferPathBenchmark.java") `
|
|
(Join-Path $PSScriptRoot "TransferParticipantPlugin.java")
|
|
if ($LASTEXITCODE -ne 0) { throw "javac failed with exit code $LASTEXITCODE" }
|
|
|
|
$runtimeLib = $installLib
|
|
if ($RuntimeLibDirectory) {
|
|
$runtimeLib = (Resolve-Path -LiteralPath $RuntimeLibDirectory).Path
|
|
if (-not (Test-Path -LiteralPath $runtimeLib -PathType Container)) {
|
|
throw "runtime library directory does not exist: $runtimeLib"
|
|
}
|
|
}
|
|
$javaArgs = @()
|
|
if ($RecordJfr) {
|
|
$recording = Join-Path $env:TEMP ("moonbridge-transfer-{0}.jfr" -f (Get-Date -Format "yyyyMMdd-HHmmss"))
|
|
$javaArgs += "-XX:StartFlightRecording=filename=$recording,settings=profile,dumponexit=true"
|
|
Write-Host "JFR profile recording: $recording"
|
|
}
|
|
$javaArgs += @("-cp", "$classes;$runtimeLib\*", "dev.moonbridge.core.session.TransferPathBenchmark", "--repeats", "$Repeats")
|
|
if ($OnlyNoSubscriber) { $javaArgs += "--only-no-subscriber" }
|
|
& java @javaArgs
|
|
if ($LASTEXITCODE -ne 0) { throw "benchmark failed with exit code $LASTEXITCODE" }
|
|
} finally {
|
|
Pop-Location
|
|
}
|