* refactor(engine): 语音独立工具改用原生托盘菜单,移除 WebView2 托盘菜单改用 Win32 弹出菜单,设置项改为用关联编辑器打开 config.toml,关于页改为消息框。删除 window_webview2 与两份 HTML 资源,windows-app 特性不再依赖 webview2 端口。 * refactor(server): 移除 WebView2,候选窗、工具栏、托盘菜单与设置窗口只保留 Direct2D 删除 src/webview2 与 webview_utils,小窗口的置顶、皮肤重载和工具栏状态缓存移到 window/small_windows,presenter 成为唯一路径,D2D 下的置顶时序与 cloak 行为保持不变。设置进程去掉 WebView2 宿主、鼠标转发与启动图,只构建原生窗口;旧快捷方式传入的 --d2d / --webview2 被忽略。删除 appearance.ui_backend 与 appearance.settings_ui_backend(读取、写入、设置页下拉框与两份配置模板),升级时由模板合并丢弃旧值。设置窗口的图片资源移到 server/assets/settings,安装到数据目录的 assets\settings。不再链接 WebView2Loader,vcpkg 去掉 webview2 端口。 * build(installer): 打包与 CI 不再处理 WebView2 页面和运行时 Prepare-PackageFiles 去掉 -UiHtmlDirectory 与 html 暂存,改为暂存 server/assets/settings;安装器不再检查 WebView2 Runtime、不再创建 ProgramData 下的 WebView2 用户数据目录,升级和卸载时清理旧版留下的 webview2 / webview2-settings 与数据目录里的 html。CI 删除设置页构建、契约同步检查和候选窗 DOM 测试,release 的打包任务不再依赖网页产物;dependabot 去掉 npm。第三方声明去掉 WebView2Loader。 * refactor(ui-html): 删除 WebView2 页面与设置页前端工程 候选窗、工具栏、托盘菜单、设置页、主题和契约副本都已没有使用者;设置窗口用到的图片资源已移到 server/assets/settings。sync-contracts.py 与 pnpm/Vite/TypeScript 工程一并删除,契约仍以 engine/contracts/webview 为唯一来源。 * docs(server): 文档改为只描述 Direct2D 界面 仓库地图去掉 ui-html,组件边界、uiAccess 与置顶时序、设置窗口和配置读写的说明改写为 Direct2D 唯一界面;安装说明去掉 WebView2 Runtime 检查,打包命令去掉 -UiHtmlDirectory;engine/contracts/webview 的说明改为设置窗口是唯一使用者,名字是历史遗留。 * docs(skins): 皮肤说明不再区分 WebView2 与 D2D 渲染器 v2 字段去掉「仅 WebView2」,改为说明由 Direct2D 原生渲染、部分字段仍在补全;颜色必须带 # 改为清单格式约定。随包的 skins/niya-demo/skin.toml 不改,免得用户机器上的同名皮肤在升级时被当成已修改而改名备份。 * docs(ui): demo 说明文字不再提 WebView2
79 lines
4.4 KiB
PowerShell
79 lines
4.4 KiB
PowerShell
# 本地测试安装流程的共用实现:编译本仓组件 → 收集安装文件 → 本机自签名 →
|
||
# Inno Setup 打包 → 签安装包 → 启动安装程序。
|
||
#
|
||
# 三个入口都是这个脚本的薄包装:
|
||
# test.ps1 完整包(含词库),不含 PDB
|
||
# test-light.ps1 轻量包(不含词库),不含 PDB
|
||
# test-symbols.ps1 带 PDB,默认轻量,加 -Full 走完整包
|
||
#
|
||
# 编译是增量的:build-release / build{32,64}-release 已有 CMake 缓存时不再重跑 configure
|
||
# (Visual Studio 生成器的 ZERO_CHECK 会在 CMakeLists.txt 变化时自己重新生成),并且只构建
|
||
# 打包用的目标,不构建那些打完包又被删掉的测试可执行文件。-Reconfigure 可强制重跑 configure。
|
||
|
||
[CmdletBinding()]
|
||
param(
|
||
# 轻量包:跳过词库、辅助码、拼音表和出厂配置,只刷新 TSF、Server 和设置窗口图片资源。
|
||
# 适用:只改了 TSF 或 Server,本机已有完整安装(词库已在
|
||
# %LOCALAPPDATA%\metasequoiaime)。不要用轻量包做首次安装。
|
||
[switch]$Light,
|
||
# 把 PDB 打进安装包。PDB 有 ~140 MB,而真正的二进制只有 ~20 MB,Inno Setup 还要对它们做
|
||
# 固实 LZMA2 压缩,所以默认不打包;只有需要在装好的机器上直接做崩溃分析时才加这个开关。
|
||
[switch]$IncludeSymbols,
|
||
# 强制重跑 CMake configure(改了 preset、换了工具链或怀疑缓存不对时用)。
|
||
[switch]$Reconfigure
|
||
)
|
||
|
||
$ErrorActionPreference = 'Stop'
|
||
Set-StrictMode -Version Latest
|
||
|
||
# Every build step below uses its own Push-Location and absolute paths ($repoRoot / $PSScriptRoot),
|
||
# so the script never relies on the process cwd. Push/pop it here too, inside try/finally, so the
|
||
# caller's shell is left where it started instead of stranded in installer\ when the script exits.
|
||
Push-Location $PSScriptRoot
|
||
try {
|
||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||
$tsfCompile = Join-Path $repoRoot 'windows\scripts\lcompile-release-both.ps1'
|
||
$serverCompile = Join-Path $repoRoot 'server\scripts\lcompile-release.ps1'
|
||
|
||
# Both 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)) {
|
||
if (-not (Test-Path -LiteralPath $required -PathType Leaf)) {
|
||
throw "缺少组件构建入口:$required"
|
||
}
|
||
}
|
||
|
||
Push-Location (Join-Path $repoRoot 'windows')
|
||
try { & $tsfCompile -Reconfigure:$Reconfigure } finally { Pop-Location }
|
||
|
||
Push-Location (Join-Path $repoRoot 'server')
|
||
try { & $serverCompile -Reconfigure:$Reconfigure } finally { Pop-Location }
|
||
|
||
|
||
# 轻量包不带任何数据文件,所以只有完整包需要语言模型。脚本是幂等的:摘要对得上时
|
||
# 直接返回,不重下也不重转,因此这里无条件调用不会让日常 test.ps1 变慢。首次运行
|
||
# 要下 ~75 MB 并转换一次,之后都是秒回。
|
||
if (-not $Light) {
|
||
& (Join-Path $repoRoot 'scripts\build-language-model.ps1')
|
||
# 词库同理:从本仓同级的 msime-dictionary 构建,不下载 Release。源数据提交和构建脚本
|
||
# 都没变、工作区干净时直接跳过;有变化就整套重建(约 45 秒)。
|
||
# 词库构建需要 pypinyin,首次运行时自动安装。
|
||
python -m pip install -q pypinyin
|
||
if ($LASTEXITCODE -ne 0) { throw "安装 pypinyin 依赖失败($LASTEXITCODE)" }
|
||
python (Join-Path $repoRoot 'scripts\build-dictionary.py') --if-stale
|
||
if ($LASTEXITCODE -ne 0) { throw "从 msime-dictionary 构建词库失败($LASTEXITCODE)" }
|
||
# 神经整句模型:从 chinese-ime-lm Release 下载。幂等脚本,摘要对上时直接返回。
|
||
& (Join-Path $repoRoot 'scripts\download-neural-model.ps1')
|
||
}
|
||
|
||
& (Join-Path $PSScriptRoot 'Prepare-PackageFiles.ps1') -Light:$Light -IncludeSymbols:$IncludeSymbols `
|
||
-RepoRoot $repoRoot -TsfDirectory windows -ServerDirectory server -NoticesDirectory .
|
||
& (Join-Path $PSScriptRoot 'Sign-PackageBinaries-Local.ps1')
|
||
& (Join-Path $PSScriptRoot 'Compile-Installer.ps1') -Light:$Light
|
||
& (Join-Path $PSScriptRoot 'Sign-Installer-Local.ps1') -Light:$Light
|
||
& (Join-Path $PSScriptRoot 'Install.ps1') -Light:$Light
|
||
} finally {
|
||
Pop-Location
|
||
}
|