Files
fanlusky a7779d2b05 refactor(engine): 将 engine 从 submodule 内嵌为仓内一等组件
`vendor/MetasequoiaImeEngine` submodule 改为 `engine/` 目录,导入的是
product-lock.json 原本钉住的提交 c810d201,逐文件核对过 blob,因此这是一次
搬迁而不是引擎升级。引擎自己的嵌套 submodule(googlepinyinime-rev、utfcpp、
miniaudio)按各自 gitlink 一并展开,来源与提交见 engine/UPSTREAM.md。

Windows 专门化裁掉了不属于本产品的部分:whisper.cpp 与本地推理 provider、
macOS 示例宿主、整个 dictionary/ 建库流水线、上游 CI 与 release-please 配置。
词库仍按 product-lock.json 在构建时取发布产物。

引擎不再进 product-lock.json:没有 gitlink 就没有可比对的东西,锁里写一个上游
commit 等于宣称这棵树仍等于上游,而第一个 Windows 专门化改动落地时这句话就假了。
verify-contracts / verify-checkout 随之移除,verify-published 保留。

CI 与工具链:引擎源码并入根 scripts/format.sh(删掉引擎自己的那份,避免两套排除
列表分叉);引擎 voice.yml 里的 silero_vad.onnx 摘要校验移到本仓 lock job;
engine-bump-triage 工作流与其测试删除;gitsubmodule 的 dependabot 频率由 daily
改为 monthly。

README、README.en、AGENTS.md、CONTRIBUTING、docs/product-release.md 及各子目录
文档同步说明新的位置与边界。
2026-09-12 03:40:48 +08:00

50 lines
2.5 KiB
PowerShell

param(
[Parameter(Mandatory = $true)][string]$ServerRoot,
[string]$BuildDir = 'build'
)
$ErrorActionPreference = 'Stop'
$automationRoot = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
$server = (Resolve-Path $ServerRoot).Path
$binary = Join-Path $server "$BuildDir/bin/Release/MetasequoiaImeServer.exe"
# The engine is a component of the repository, not of the server, so the contracts do not move with
# -ServerRoot.
$contracts = Join-Path $automationRoot 'engine/contracts'
# An include directory that does not exist is not a configure error; it surfaces minutes later as
# C1083 on a header nobody moved. Say what is actually wrong, before building anything.
if (-not (Test-Path -LiteralPath (Join-Path $contracts 'ipc_negotiation.h') -PathType Leaf)) {
throw "Engine contracts not found at $contracts; the engine is vendored in-tree, so this is an incomplete checkout"
}
$probes = @()
foreach ($architecture in @('Win32', 'x64')) {
$output = Join-Path $env:RUNNER_TEMP "msime-pipe-probe-$architecture"
cmake -S (Join-Path $automationRoot 'tests/pipe-probe') -B $output -A $architecture "-DMSIME_CONTRACTS_DIR=$contracts"
if ($LASTEXITCODE -ne 0) { throw "Probe configure failed: $architecture" }
cmake --build $output --config Release --parallel
if ($LASTEXITCODE -ne 0) { throw "Probe build failed: $architecture" }
$probes += Join-Path $output 'Release/msime-ipc-probe.exe'
}
# CI owns the process lifetime. The existing marker prevents the watchdog from
# restarting it after the probe; no DLL is registered and no IME is installed.
# On a persistent self-hosted runner a Server left behind by an earlier job wins
# the single-instance mutex, the one started here returns 0 immediately, and the
# probe silently handshakes with the older build instead. Clear the field first.
Get-Process -Name 'MetasequoiaImeServer', 'MetasequoiaImeWatchdog' -ErrorAction SilentlyContinue |
Stop-Process -Force
$process = Start-Process -FilePath $binary -ArgumentList '--watchdog-managed --pipe-probe' `
-WorkingDirectory (Split-Path $binary) -PassThru
Start-Sleep -Milliseconds 200
if ($process.HasExited) {
throw "Server exited immediately with code $($process.ExitCode); another instance holds the single-instance mutex"
}
try {
foreach ($probe in $probes) {
& $probe
if ($LASTEXITCODE -ne 0) { throw "Native pipe probe failed: $probe" }
}
} finally {
if (-not $process.HasExited) {
Stop-Process -Id $process.Id -Force
$process.WaitForExit(10000) | Out-Null
}
}