diff --git a/apps/ai-game-creator-shell/scripts/check-config.mjs b/apps/ai-game-creator-shell/scripts/check-config.mjs index 65cc17b1d..4bc3df399 100644 --- a/apps/ai-game-creator-shell/scripts/check-config.mjs +++ b/apps/ai-game-creator-shell/scripts/check-config.mjs @@ -1302,6 +1302,11 @@ assert.deepEqual( expectedBundledCodexResources, 'AI game creator shell Windows Tauri config must bundle the complete pinned Codex resource set', ); +if (windowsTauriConfig.bundle?.useLocalToolsDir !== true) { + throw new Error( + 'AI game creator shell Windows Tauri config must cache bundling tools in the project target directory', + ); +} if (tauriConfig.app?.withGlobalTauri !== true) { throw new Error( diff --git a/apps/ai-game-creator-shell/src-tauri/tauri.windows.conf.json b/apps/ai-game-creator-shell/src-tauri/tauri.windows.conf.json index cb9d5cc8e..ad932ab58 100644 --- a/apps/ai-game-creator-shell/src-tauri/tauri.windows.conf.json +++ b/apps/ai-game-creator-shell/src-tauri/tauri.windows.conf.json @@ -2,6 +2,7 @@ "$schema": "https://schema.tauri.app/config/2", "bundle": { "targets": ["nsis"], + "useLocalToolsDir": true, "resources": { "resources/codex/win-x64/bin/codex.exe": "codex/win-x64/bin/codex.exe", "resources/codex/win-x64/bin/codex-code-mode-host.exe": "codex/win-x64/bin/codex-code-mode-host.exe", diff --git a/docs/project-memory/shared-memory/pitfalls.md b/docs/project-memory/shared-memory/pitfalls.md index 459cafb65..f8c2a40ab 100644 --- a/docs/project-memory/shared-memory/pitfalls.md +++ b/docs/project-memory/shared-memory/pitfalls.md @@ -4969,3 +4969,10 @@ - 原因:native job 没有显式预取 `server-rs/Cargo.toml`;`ai-game-creator-shell:check` 的 server-rs workspace 命令没有 `--locked`。 - 处理:native job 预取 server-rs、桌面壳和 AGC 壳三份 lockfile;`platform-llm`、`shared-contracts` 与 AGC 壳测试统一使用 `--locked`,不降低原生测试门禁。 - 验证:workflow 回归测试、锁定的 Rust 测试和原生壳门禁均需运行;若本地 EAS CLI 版本漂移,应单独报告环境阻塞,不把它误判为本次 Cargo CI 修复失败。 + +## Tauri Windows NSIS 工具缓存不能依赖 Jenkins systemprofile AppData(2026-09-02) + +- 现象:AGC Windows 构建已完成 Rust release binary,Tauri 下载并解压 NSIS 后,在 `Running makensis` 报 `Unable to start child process, error 0x2`。 +- 原因:Tauri Windows bundler 执行自己的 `\NSIS\makensis.exe`,默认位于当前用户 `%LOCALAPPDATA%\tauri`,不使用 PATH 中预装的 `makensis.exe`;Jenkins LocalSystem/systemprofile 的 AppData 可能无法启动该缓存程序。 +- 处理:Windows 专用 Tauri 配置设置 `bundle.useLocalToolsDir: true`,把工具缓存到 `src-tauri/target/.tauri/NSIS`;Jenkins 预检验证实际用户、项目工具目录可写,并在构建失败时打印实际缓存路径和绝对路径执行结果。 +- 验证:不要把 PATH 中 `makensis` 可发现当作 Tauri bundler 工具可执行的充分证据;需要在 Windows Agent 上检查 `target/.tauri/NSIS/makensis.exe`、ACL、EDR/Defender 和直接 `-VERSION` 结果。 diff --git a/docs/technical/【技术方案】AGC客户端更新检查与下载-2026-08-31.md b/docs/technical/【技术方案】AGC客户端更新检查与下载-2026-08-31.md index bce24d154..a5e11496c 100644 --- a/docs/technical/【技术方案】AGC客户端更新检查与下载-2026-08-31.md +++ b/docs/technical/【技术方案】AGC客户端更新检查与下载-2026-08-31.md @@ -51,8 +51,12 @@ OSS 前缀,通过 `AGC_RELEASE_VERSION` 指定三段版本号(仅在明确 AGC 发布流水线使用 `jenkins/Jenkinsfile.ai-game-creator-shell-build`,当前节点标签为 `windows && win2022`。节点应为 Windows Server 2022 x64 虚拟机,预装 Node.js 22、npm -10.9.7、Rust 1.96.0、Visual Studio Build Tools(MSVC 与 Windows SDK)、NSIS、Git 和 ossutil; -Jenkins Agent 服务必须能在同一用户环境中找到这些命令。流水线执行根 workspace 的 `npm ci`,然后调用 +10.9.7、Rust 1.96.0、Visual Studio Build Tools(MSVC 与 Windows SDK)、Git 和 ossutil; +Jenkins Agent 服务必须能在同一用户环境中找到这些命令。Tauri Windows bundler 使用 +`tauri.windows.conf.json` 中的 `bundle.useLocalToolsDir: true`,把固定版本的 NSIS 工具缓存到 +`src-tauri/target/.tauri/NSIS`,不依赖 Jenkins 服务账户的 `%LOCALAPPDATA%\tauri` 或 PATH 中的系统 NSIS。 +Jenkins Checkout 的 `git clean -fdx` 会清理该构建目录,因此每次全新工作区可能重新下载 NSIS;这只影响构建耗时,不改变工具来源或执行权限要求。 +流水线执行根 workspace 的 `npm ci`,然后调用 `npm run ai-game-creator-shell:release:upload`,并归档 Windows 安装包、`latest.json` 与源码 commit。 流水线会将未导出的空参数按空字符串处理:`COMMIT_HASH` 留空时沿用 Jenkins SCM 当前提交,`OSSUTIL_BIN` 留空时使用节点 PATH 中的 `ossutil`,不会因 PowerShell 对空环境变量调用 `.Trim()` 而提前失败。 diff --git a/jenkins/Jenkinsfile.ai-game-creator-shell-build b/jenkins/Jenkinsfile.ai-game-creator-shell-build index ab7e44744..8803fa375 100644 --- a/jenkins/Jenkinsfile.ai-game-creator-shell-build +++ b/jenkins/Jenkinsfile.ai-game-creator-shell-build @@ -15,7 +15,7 @@ pipeline { GENARRATIVE_NPM_VERSION = '10.9.7' AGC_OSS_BUCKET = 'agc-dev' AGC_OSS_ENDPOINT = 'oss-rg-china-mainland.aliyuncs.com' - AGC_WINDOWS_PATH = 'C:\\Tools\\Git\\cmd;C:\\Program Files\\nodejs;C:\\Users\\Administrator\\.cargo\\bin;C:\\Program Files (x86)\\NSIS;C:\\Tools\\ossutil;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\' + AGC_WINDOWS_PATH = 'C:\\Tools\\Git\\cmd;C:\\Program Files\\nodejs;C:\\Users\\Administrator\\.cargo\\bin;C:\\Tools\\ossutil;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\' } parameters { @@ -80,7 +80,7 @@ pipeline { if ($actualNpm -ne $env:GENARRATIVE_NPM_VERSION) { throw "npm 版本不匹配:期望 $($env:GENARRATIVE_NPM_VERSION),实际 $actualNpm" } - foreach ($commandName in @('node', 'npm', 'rustc', 'cargo', 'makensis')) { + foreach ($commandName in @('node', 'npm', 'rustc', 'cargo')) { if (-not (Get-Command $commandName -ErrorAction SilentlyContinue)) { throw "Windows AGC 节点缺少 $commandName,请先安装并加入 Jenkins Agent PATH。" } @@ -94,7 +94,14 @@ pipeline { Write-Host "npm=$actualNpm" Write-Host "rustc=$((rustc --version).Trim())" Write-Host "cargo=$((cargo --version).Trim())" - Write-Host "makensis=$((makensis -VERSION | Select-Object -First 1).Trim())" + Write-Host "jenkins-user=$([System.Security.Principal.WindowsIdentity]::GetCurrent().Name)" + Write-Host "local-app-data=$env:LOCALAPPDATA" + $targetTools = Join-Path $PWD 'apps/ai-game-creator-shell/src-tauri/target/.tauri' + New-Item -ItemType Directory -Force -Path $targetTools | Out-Null + $probe = Join-Path $targetTools '.jenkins-write-probe' + Set-Content -Path $probe -Value 'ok' -NoNewline + Remove-Item -LiteralPath $probe -Force + Write-Host "tauri-tools-dir=$targetTools" ''' } } @@ -126,6 +133,18 @@ pipeline { powershell ''' $ErrorActionPreference = 'Stop' npm run ai-game-creator-shell:release:upload + $buildExitCode = $LASTEXITCODE + if ($buildExitCode -ne 0) { + $nsis = Join-Path $PWD 'apps/ai-game-creator-shell/src-tauri/target/.tauri/NSIS/makensis.exe' + Write-Host "Tauri NSIS path=$nsis" + if (Test-Path $nsis) { + Get-Item $nsis | Select-Object FullName, Length, LastWriteTime + try { & $nsis -VERSION } catch { Write-Host "无法直接启动 Tauri NSIS:$($_.Exception.Message)" } + } else { + Write-Host 'Tauri NSIS makensis.exe 不存在。' + } + throw "AGC 发布构建失败,退出码=$buildExitCode" + } ''' } }