ci(release): wxs 用 env 绝对路径定位 IME DLL

之前 light.exe 失败的根因:openless-ime.wxs 的 Source 写的相对路径
src-tauri\target\windows-ime-msvc\... ,要从 openless-all/app/ 才能
resolve;但 Tauri 内置 wix bundler 的 candle/light cwd 是 src-tauri/,
路径错位,文件找不到 → light 失败。

本地 windows-package-msvc.ps1 通过 Repair-TauriMsiBundle 从 appRoot 手动
跑 light 兜底,CI 没有这个兜底所以挂掉。

修法:wxs Source 改用 $(env.OPENLESS_IME_DLL_X64) / _X86 绝对路径变量;
工作流的 IME build 步骤把绝对路径写到 $GITHUB_ENV。这样无论 candle/light
cwd 在哪,都能拿到正确的 DLL 路径。

本地脚本本就 set 这两个 env var(windows-package-msvc.ps1:213),改后
本地 + CI 共用同一条 absolute-path 路径,Repair fallback 不再必需。
This commit is contained in:
baiqing committed 2026-05-04 20:04:18 +08:00
1 parent f0040d0dd1
commit ac2edbe961
2 files changed
+9 -8

No files matched your search

+7 -6
View File
@@ -188,8 +188,8 @@ jobs:
run: bash scripts/build-mac.sh
# ── Windows:先 build OpenLessIme.dll(x64+x86),再跑 tauri bundle。
# openless-ime.wxs 引用 src-tauri\target\windows-ime-msvc\{x64,x86}\Release\OpenLessIme.dll;
# 没有这一步 light.exe 链接 MSI 时找不到 DLL → 整个 Windows release 挂掉。
# openless-ime.wxs 用 $(env.OPENLESS_IME_DLL_X64) / _X86 拿绝对路径,
# 跨 candle/light cwd 都能 resolve(Tauri wix bundler cwd 不固定)。
- name: Build Windows IME native DLLs
if: matrix.platform == 'windows-latest'
shell: pwsh
@@ -197,8 +197,8 @@ jobs:
run: |
$appRoot = (Resolve-Path .).Path
foreach ($t in @(
@{ Platform = 'x64'; Folder = 'x64' },
@{ Platform = 'Win32'; Folder = 'x86' }
@{ Platform = 'x64'; Folder = 'x64'; EnvName = 'OPENLESS_IME_DLL_X64' },
@{ Platform = 'Win32'; Folder = 'x86'; EnvName = 'OPENLESS_IME_DLL_X86' }
)) {
$out = Join-Path $appRoot "src-tauri\target\windows-ime-msvc\$($t.Folder)\Release"
$obj = Join-Path $appRoot "src-tauri\target\windows-ime-msvc\obj\$($t.Folder)\Release"
@@ -206,11 +206,12 @@ jobs:
if ($LASTEXITCODE -ne 0) {
throw "OpenLessIme $($t.Platform) build failed with exit $LASTEXITCODE"
}
$dll = Join-Path $out 'OpenLessIme.dll'
$dll = (Resolve-Path (Join-Path $out 'OpenLessIme.dll')).Path
if (-not (Test-Path $dll)) {
throw "OpenLessIme.dll not produced at $dll"
}
Write-Host "[ok] built $dll"
"$($t.EnvName)=$dll" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
Write-Host "[ok] built $dll (exported $($t.EnvName))"
}
# ── Windows:仅 Windows 跑通用 tauri build(Linux 用下方专用 step,避免重复构建)──
@@ -5,12 +5,12 @@
<Directory Id="OpenLessImeDirectory" Name="windows-ime">
<Directory Id="OpenLessImeX64Directory" Name="x64">
<Component Id="OpenLessImeDllX64Component" Guid="{B787DE6F-DF71-4D68-9DE8-04D3665A26F3}" Win64="yes">
<File Id="OpenLessImeDllX64" Name="OpenLessIme.dll" Source="src-tauri\target\windows-ime-msvc\x64\Release\OpenLessIme.dll" KeyPath="yes" />
<File Id="OpenLessImeDllX64" Name="OpenLessIme.dll" Source="$(env.OPENLESS_IME_DLL_X64)" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="OpenLessImeX86Directory" Name="x86">
<Component Id="OpenLessImeDllX86Component" Guid="{A2E61B9A-4034-4ABF-A42F-964A9B1F08BB}" Win64="no">
<File Id="OpenLessImeDllX86" Name="OpenLessIme.dll" Source="src-tauri\target\windows-ime-msvc\x86\Release\OpenLessIme.dll" KeyPath="yes" />
<File Id="OpenLessImeDllX86" Name="OpenLessIme.dll" Source="$(env.OPENLESS_IME_DLL_X86)" KeyPath="yes" />
</Component>
</Directory>
</Directory>