Skip to content

chore(release-prep): 清理 #268/#279 双 NSIS 方案残留#280

Merged
appergb merged 2 commits into
mainfrom
chore/release-prep-dedupe-nsis
May 6, 2026
Merged

chore(release-prep): 清理 #268/#279 双 NSIS 方案残留#280
appergb merged 2 commits into
mainfrom
chore/release-prep-dedupe-nsis

Conversation

@appergb
Copy link
Copy Markdown
Collaborator

@appergb appergb commented May 6, 2026

User description

背景

main 上 #268 (millionart/codex) 和 #279 (本人) 修同一个 bug(NSIS 注册 TSF DLL)。merge #279 时没手动解决冲突,导致 `tauri.conf.json` 出现两个 `windows.nsis` block——后者覆盖前者,#268 的更优实现被废,#279 的 installer.nsh 被激活;并留下了死文件、死代码、死目录。

现况快照

现状
`tauri.conf.json` line 92-95 `installerHooks: nsis/openless-ime-hooks.nsh` ← 被覆盖;line 105-108 `installerHooks: installer.nsh` ← 实际生效
`bundle.resources` 把 dll 装到 `$INSTDIR\tsf-ime\`
`installer.nsh` (#279) 实际跑的 hook,路径用 `$INSTDIR\tsf-ime\`
`nsis/openless-ime-hooks.nsh` (#268) 死代码(被 JSON 重复 key 丢弃)
`openless-ime-payload/{x64,x86}/OpenLessIme.dll` 0 字节占位,CI 复制真 dll 进去

选哪个保留?

保留 #268

  • x64 注册带 `Sysnative` + `DisableX64FSRedirection` 双保险(fallback 路径覆盖更全)
  • 有 `NSIS_HOOK_POSTUNINSTALL` 清理 `$INSTDIR\windows-ime\` 子目录
  • 已有测试覆盖(4a7a1b6b、933e014a、b303ea40 等)
  • 用 PREINSTALL `File` 命令直接拷 dll,不污染 MSI(fix(windows): NSIS 安装包注册 TSF DLL + local-asr RAM 真正归还 #279 的 bundle.resources 让 MSI 多带一份冗余 dll)

清理

  • 删 `tauri.conf.json` 重复 nsis block + bundle.resources
  • 删 `installer.nsh`
  • 删 `openless-ime-payload/` 整个目录

`release-tauri.yml` 里"复制 dll 到 openless-ime-payload"步骤、`build-mac.sh` 与 Linux build step 的 `--config '{"bundle":{"resources":{}}}'` override 在没有 bundle.resources 后退化为 noop,不会破坏 build;当前 token 缺 workflow scope,下次再清。

Test plan

  • CI `Windows Tauri checks` 跑通
  • `pr_agent_job` 跑通
  • cargo check / npm build 本地已过
  • 合并后 dispatch `release-tauri.yml` workflow_dispatch 验证 NSIS / MSI / DMG / deb 全产出

PR Type

Bug fix, Enhancement


Description

  • Build IME DLLs during Windows release

  • Wire NSIS to packaged IME hooks

  • Remove stale installer hook and payload mapping

  • Simplify mac packaging resource handling


Diagram Walkthrough

flowchart LR
  A["windows-build-gnu.ps1"] -- "builds x64/x86 OpenLessIme.dll" --> B["DLL env vars"]
  B -- "consumed by" --> C["NSIS / WiX packaging"]
  D["tauri.conf.json"] -- "keeps perMachine NSIS hook" --> C
  E["installer.nsh"] -- "removed obsolete hook" --> C
  F["build-mac.sh"] -- "drops empty resources override" --> G["mac build"]
Loading

File Walkthrough

Relevant files
Enhancement
windows-build-gnu.ps1
Build and export IME DLL paths                                                     

openless-all/app/scripts/windows-build-gnu.ps1

  • Builds OpenLessIme.dll for both x64 and Win32.
  • Resolves the produced DLL paths and exports them as env vars.
  • Fails fast if either IME build does not produce a DLL.
  • Reuses the same artifacts for NSIS and WiX packaging.
+22/-0   
Configuration changes
build-mac.sh
Simplify mac Tauri build arguments                                             

openless-all/app/scripts/build-mac.sh

  • Removes the bundle.resources override from tauri build.
  • Keeps the updater-artifact config when signing is enabled.
  • Avoids carrying Windows-only resource handling into mac builds.
+1/-3     
tauri.conf.json
Consolidate NSIS and bundle settings                                         

openless-all/app/src-tauri/tauri.conf.json

  • Removes the bundle.resources IME DLL mappings.
  • Keeps NSIS configured for perMachine installs.
  • Points NSIS to nsis/openless-ime-hooks.nsh.
  • Leaves WiX component references intact.
+0/-8     
Bug fix
installer.nsh
Remove obsolete NSIS installer hook                                           

openless-all/app/src-tauri/installer.nsh

  • Deletes the old NSIS installer hook implementation.
  • Removes the previous regsvr32 register and unregister flow.
  • Eliminates now-obsolete duplicate IME registration logic.
+0/-52   

main 上 #268 (millionart/codex/register-windows-ime-nsis-installer) 与 #279
(本人) 都修了 NSIS 注册 TSF DLL,merge #279 时未手动解决冲突,导致:

1. tauri.conf.json 出现两个 windows.nsis block(line 92-95 和 105-108),
   serde_json 用最后写入的覆盖前面,结果 #268 的 nsis/openless-ime-hooks.nsh
   被丢弃,实际生效的是 #279 的 installer.nsh。
2. #279 的 bundle.resources 把 dll 多打一份到 $INSTDIR\tsf-ime\,与 #268
   PREINSTALL File 直接装到 $INSTDIR\windows-ime\ 并存。
3. installer.nsh 与 openless-ime-payload/ 残留为死代码。

#268 方案更稳:x64 注册带 Sysnative + DisableX64FSRedirection 双保险,有
POSTUNINSTALL 清理 hook,有测试覆盖(4a7a1b6b/test、933e014a/test),且
不污染 MSI(不用 bundle.resources,避免 dll 重复)。

清理:
- 删除 tauri.conf.json 重复 nsis block,保留 nsis/openless-ime-hooks.nsh
- 删除 bundle.resources(#268 不需要)
- 删除死文件 installer.nsh
- 删除死目录 openless-ime-payload/

release-tauri.yml 里"复制 dll 到 openless-ime-payload"步骤、build-mac.sh
与 Linux build 的 --config '{"bundle":{"resources":{}}}' override 暂留 —
没有 bundle.resources 后这些是 noop,不会破坏 build;当前 token 没有
workflow scope,等下一次有需求再清。
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7799b5e0d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 97 to 100
"OpenLessImeDllX64Component",
"OpenLessImeDllX86Component"
]
},
"nsis": {
"installMode": "perMachine",
"installerHooks": "installer.nsh"
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve a path for GNU Windows bundling

This removal makes the documented scripts/windows-build-gnu.ps1 path switch from the self-contained installer.nsh/payload setup to nsis/openless-ime-hooks.nsh; that hook embeds File "$%OPENLESS_IME_DLL_X64%" and _X86, but the GNU script still reaches npm run tauri build -- --target x86_64-pc-windows-gnu --bundles msi nsis without building those DLLs or exporting either env var. In that context the NSIS compile fails before the script can produce the advertised Windows GNU bundle artifacts, so this cleanup needs either a GNU-script env setup or a separate fallback before dropping the old hook.

Useful? React with 👍 / 👎.

完整审查 CI 流程后发现两类问题:

1. windows-build-gnu.ps1 不 build OpenLessIme.dll 也不 export
   OPENLESS_IME_DLL_X64 / _X86 env,但 NSIS hook (nsis/openless-ime-hooks.nsh)
   PREINSTALL 用 File "$%OPENLESS_IME_DLL_X64%" / _X86 引用 dll,
   makensis 编译时 env 为空 → File 路径无效 → NSIS bundle 失败。
   补 IME dll 双平台 (x64 / Win32) build + Set-Item Env:。
   (Codex PR #280 P2 review)

2. build-mac.sh 之前为绕过 bundle.resources 占位 dll 加的
   --config '{"bundle":{"resources":{}}}' override,
   PR #280 已删除 bundle.resources,此 override 退化为 noop,删除让命令更干净。

release-tauri.yml 还有 2 处同源遗留("复制 dll 到 openless-ime-payload"
死步骤、Linux build 同样的 noop override)需要 workflow scope 才能动,
留待下一个 PR。
@appergb
Copy link
Copy Markdown
Collaborator Author

appergb commented May 6, 2026

完整 CI 审查后追加 commit `3414e1ff`,修两件事:

1. P2 修复(@codex 提的)

`windows-build-gnu.ps1` 在 `--bundles msi nsis` 之前不 build IME dll、不 export `OPENLESS_IME_DLL_X64` / `_X86`,让 `nsis/openless-ime-hooks.nsh` 的 PREINSTALL `File "$%OPENLESS_IME_DLL_X64%"` 在 makensis 编译时拿不到路径 → NSIS bundle 失败。补 x64 / Win32 双平台 build + `Set-Item Env:`,跟 `release-tauri.yml` 同款做法。

2. 清理 `build-mac.sh` 的 noop override

之前为兼容 `bundle.resources` 0 字节占位 dll 加的 `--config '{"bundle":{"resources":{}}}'`,本 PR 删除 `bundle.resources` 后这个 override 是空操作(empty merge),删了让命令更干净。

后续遗留(需 workflow scope,留下个 PR)

  • `release-tauri.yml:216-224` 复制 dll 到 `openless-ime-payload/` 死步骤
  • `release-tauri.yml:339-345` Linux build 同款 noop `--config` override

CI 其他文件审查结论

  • `ci.yml` / `pr-agent.yml` / `write-updater-manifest.mjs` / `windows-ime-install-smoke.ps1` / `windows-preflight.ps1` / `windows-ime-build.ps1` 都是 clean

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

PR Reviewer Guide 🔍

(Review updated until commit 3414e1f)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

268 - Partially compliant

Compliant requirements:

  • NSIS installer wiring still points to a dedicated hook file.
  • perMachine NSIS install mode is retained.

Non-compliant requirements:

  • The smoke test and CI wiring are not changed in this diff.

Requires further human verification:

  • Whether the existing Windows release workflow still executes the NSIS/MSI smoke checks after this cleanup.
  • Whether the retained NSIS hook implementation still covers the intended DLL registration flow end to end.

279 - Partially compliant

Compliant requirements:

  • perMachine NSIS install mode is retained.

Non-compliant requirements:

  • installer.nsh is deleted.
  • The bundle.resources mapping and openless-ime-payload staging are removed.

Requires further human verification:

  • Whether the replacement nsis/openless-ime-hooks.nsh path fully covers the same registration and unregistration behavior.
  • Whether the release packaging still stages the real DLLs in the paths expected by the remaining Windows packaging flow.
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Persistent review updated to latest commit 3414e1f

@appergb
Copy link
Copy Markdown
Collaborator Author

appergb commented May 6, 2026

@codex 这次 P2 是误报 — 我在 commit 3414e1f(你 review 的那个 commit)里已经修了。同一个 commit 里同时包含:

  1. `windows-build-gnu.ps1` 增加 IME dll build (x64 + x86) + `Set-Item Env:` 导出 `OPENLESS_IME_DLL_X64` / `_X86`
  2. `build-mac.sh` 清理 noop bundle.resources override

`git show 3414e1f -- openless-all/app/scripts/windows-build-gnu.ps1` 可以看到那段加在 dev artifact 复制之后、`npm run tauri build -- --bundles msi nsis` 之前的循环。

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@appergb appergb merged commit 6b38e5e into main May 6, 2026
2 checks passed
@appergb appergb deleted the chore/release-prep-dedupe-nsis branch May 6, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant