Files
msime-windows/scripts/ci/probe-server.ps1
T
Evan Hu b48dc82652 fix(ci): resolve the pipe probe contracts from the repository, not the server
The probe took its include directory from $ServerRoot/MetasequoiaImeEngine/contracts, which is where the engine sat when it was a submodule of Server. It is a submodule of the repository now, so the path does not move with -ServerRoot. A missing include directory is not a configure error, so this surfaced minutes later as C1083 on a header nobody had moved; the script now checks and says so before building.

The local packaging rehearsals had the same stale assumption, looking for MetasequoiaImeTsf, MetasequoiaImeServer and MetasequoiaImeUiHtml beside the installer. Worse, they skipped the build when a neighbour was absent, which in this layout means every build is skipped and whatever binaries are lying around get packaged into an installer you then run on your own machine. The three components are directories of this repository, so a missing one is now a hard failure, and Prepare-PackageFiles.ps1 is passed the directory names it needs.

Both were missed because the sweep that moved the submodules read its own output through head, so a truncated list looked like a complete one. Re-checked by resolving every relative path literal in every tracked file with no filtering.
2026-09-06 03:28:13 +09:00

40 lines
1.9 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 submodule of the repository, not of the server, so the contracts do not move with
# -ServerRoot.
$contracts = Join-Path $automationRoot 'vendor/MetasequoiaImeEngine/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; run git submodule update --init"
}
$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.
$process = Start-Process -FilePath $binary -ArgumentList '--watchdog-managed' -WorkingDirectory (Split-Path $binary) -PassThru
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
}
}