From ac2edbe9614df29cfa4cc917427dea69d32bc2bb Mon Sep 17 00:00:00 2001 From: baiqing Date: Mon, 4 May 2026 20:04:18 +0800 Subject: [PATCH] =?UTF-8?q?ci(release):=20wxs=20=E7=94=A8=20env=20?= =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E8=B7=AF=E5=BE=84=E5=AE=9A=E4=BD=8D=20IME=20?= =?UTF-8?q?DLL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前 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 不再必需。 --- .github/workflows/release-tauri.yml | 13 +++++++------ openless-all/app/src-tauri/wix/openless-ime.wxs | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-tauri.yml b/.github/workflows/release-tauri.yml index 194b9efc..bd4124d5 100644 --- a/.github/workflows/release-tauri.yml +++ b/.github/workflows/release-tauri.yml @@ -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,避免重复构建)── diff --git a/openless-all/app/src-tauri/wix/openless-ime.wxs b/openless-all/app/src-tauri/wix/openless-ime.wxs index f7571a1b..027c22b1 100644 --- a/openless-all/app/src-tauri/wix/openless-ime.wxs +++ b/openless-all/app/src-tauri/wix/openless-ime.wxs @@ -5,12 +5,12 @@ - + - +