Files
msime-windows/installer/test.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

39 lines
1.8 KiB
PowerShell

# 本地测试安装流程:编译相邻源码仓库(若存在)→ 收集安装文件 →
# 本机自签名 → Inno Setup 打包 → 签安装包 → 启动安装程序。
#
# 不使用任何预置证书。签名脚本会在本机生成并复用自签名测试证书。
# 只改 TSF / Server / HTML、且本机已有词库时,用 .\test-light.ps1。
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
Set-Location $PSScriptRoot
$repoRoot = Split-Path -Parent $PSScriptRoot
$tsfCompile = Join-Path $repoRoot 'windows\scripts\lcompile-release-both.ps1'
$serverCompile = Join-Path $repoRoot 'server\scripts\lcompile-release.ps1'
$settingsDir = Join-Path $repoRoot 'ui-html\webview2\settings\ime-settings'
# All three are directories of this repository now, so a missing one is a broken checkout rather
# than a neighbour nobody cloned. Skipping the build and packaging whatever binaries happen to be
# lying around would produce an installer you then run on your own machine.
foreach ($required in @($tsfCompile, $serverCompile, (Join-Path $settingsDir 'package.json'))) {
if (-not (Test-Path -LiteralPath $required -PathType Leaf)) {
throw "缺少组件构建入口:$required"
}
}
Push-Location (Join-Path $repoRoot 'windows')
try { & $tsfCompile } finally { Pop-Location }
Push-Location (Join-Path $repoRoot 'server')
try { & $serverCompile } finally { Pop-Location }
Push-Location $settingsDir
try { pnpm run build } finally { Pop-Location }
& (Join-Path $PSScriptRoot 'Prepare-PackageFiles.ps1') -RepoRoot $repoRoot -TsfDirectory windows -ServerDirectory server -UiHtmlDirectory ui-html -NoticesDirectory .
& (Join-Path $PSScriptRoot 'Sign-PackageBinaries-Local.ps1')
& (Join-Path $PSScriptRoot 'Compile-Installer.ps1')
& (Join-Path $PSScriptRoot 'Sign-Installer-Local.ps1')
& (Join-Path $PSScriptRoot 'Install.ps1')