Skip to content

Commit ac2edbe

Browse files
author
baiqing
committed
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 不再必需。
1 parent f0040d0 commit ac2edbe

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

.github/workflows/release-tauri.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,29 +188,30 @@ jobs:
188188
run: bash scripts/build-mac.sh
189189

190190
# ── Windows:先 build OpenLessIme.dll(x64+x86),再跑 tauri bundle。
191-
# openless-ime.wxs 引用 src-tauri\target\windows-ime-msvc\{x64,x86}\Release\OpenLessIme.dll;
192-
# 没有这一步 light.exe 链接 MSI 时找不到 DLL → 整个 Windows release 挂掉
191+
# openless-ime.wxs 用 $(env.OPENLESS_IME_DLL_X64) / _X86 拿绝对路径,
192+
# 跨 candle/light cwd 都能 resolve(Tauri wix bundler cwd 不固定)
193193
- name: Build Windows IME native DLLs
194194
if: matrix.platform == 'windows-latest'
195195
shell: pwsh
196196
working-directory: 'openless-all/app'
197197
run: |
198198
$appRoot = (Resolve-Path .).Path
199199
foreach ($t in @(
200-
@{ Platform = 'x64'; Folder = 'x64' },
201-
@{ Platform = 'Win32'; Folder = 'x86' }
200+
@{ Platform = 'x64'; Folder = 'x64'; EnvName = 'OPENLESS_IME_DLL_X64' },
201+
@{ Platform = 'Win32'; Folder = 'x86'; EnvName = 'OPENLESS_IME_DLL_X86' }
202202
)) {
203203
$out = Join-Path $appRoot "src-tauri\target\windows-ime-msvc\$($t.Folder)\Release"
204204
$obj = Join-Path $appRoot "src-tauri\target\windows-ime-msvc\obj\$($t.Folder)\Release"
205205
./scripts/windows-ime-build.ps1 -Configuration Release -Platform $t.Platform -OutputDirectory $out -IntermediateDirectory $obj
206206
if ($LASTEXITCODE -ne 0) {
207207
throw "OpenLessIme $($t.Platform) build failed with exit $LASTEXITCODE"
208208
}
209-
$dll = Join-Path $out 'OpenLessIme.dll'
209+
$dll = (Resolve-Path (Join-Path $out 'OpenLessIme.dll')).Path
210210
if (-not (Test-Path $dll)) {
211211
throw "OpenLessIme.dll not produced at $dll"
212212
}
213-
Write-Host "[ok] built $dll"
213+
"$($t.EnvName)=$dll" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
214+
Write-Host "[ok] built $dll (exported $($t.EnvName))"
214215
}
215216
216217
# ── Windows:仅 Windows 跑通用 tauri build(Linux 用下方专用 step,避免重复构建)──

openless-all/app/src-tauri/wix/openless-ime.wxs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<Directory Id="OpenLessImeDirectory" Name="windows-ime">
66
<Directory Id="OpenLessImeX64Directory" Name="x64">
77
<Component Id="OpenLessImeDllX64Component" Guid="{B787DE6F-DF71-4D68-9DE8-04D3665A26F3}" Win64="yes">
8-
<File Id="OpenLessImeDllX64" Name="OpenLessIme.dll" Source="src-tauri\target\windows-ime-msvc\x64\Release\OpenLessIme.dll" KeyPath="yes" />
8+
<File Id="OpenLessImeDllX64" Name="OpenLessIme.dll" Source="$(env.OPENLESS_IME_DLL_X64)" KeyPath="yes" />
99
</Component>
1010
</Directory>
1111
<Directory Id="OpenLessImeX86Directory" Name="x86">
1212
<Component Id="OpenLessImeDllX86Component" Guid="{A2E61B9A-4034-4ABF-A42F-964A9B1F08BB}" Win64="no">
13-
<File Id="OpenLessImeDllX86" Name="OpenLessIme.dll" Source="src-tauri\target\windows-ime-msvc\x86\Release\OpenLessIme.dll" KeyPath="yes" />
13+
<File Id="OpenLessImeDllX86" Name="OpenLessIme.dll" Source="$(env.OPENLESS_IME_DLL_X86)" KeyPath="yes" />
1414
</Component>
1515
</Directory>
1616
</Directory>

0 commit comments

Comments
 (0)