debug(local-tool): Windows build 失敗追蹤

Makefile _run-iscc:
- 開頭印出 ISCC 環境變數和 PATH 前幾項,確認有沒有正確傳進來

bootstrap-windows.ps1:
- 不再用 bash.exe -lc "..." 傳整條字串(含空格路徑會被 PS 雙層 quoting 切斷)
- 改寫成 tmp .sh 檔,用 bash.exe -l file.sh 執行
- 執行前印出 script 內容,執行後刪掉 tmp 檔
- script 開頭加 'set -e' 確保任何一行失敗立即停止並回非 0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jim800121chen 2026-04-12 03:17:07 +08:00
parent 06031206af
commit 1c5866ed14
2 changed files with 20 additions and 3 deletions

View File

@ -470,6 +470,8 @@ exe-only: ## 只跑 iscc 打包 installer前置產物必須已存在
exe: wails-windows _run-iscc ## ⚠️ 必須在 Windows 上跑Inno Setup → dist/visiona-local-*-windows-x64.exe exe: wails-windows _run-iscc ## ⚠️ 必須在 Windows 上跑Inno Setup → dist/visiona-local-*-windows-x64.exe
_run-iscc: _run-iscc:
@echo "DEBUG _run-iscc: ISCC='$$ISCC'"
@echo "DEBUG _run-iscc: PATH first entries: $$(echo $$PATH | tr ':' '\n' | head -5)"
@ISCC_BIN="$$ISCC"; \ @ISCC_BIN="$$ISCC"; \
if [ -z "$$ISCC_BIN" ]; then \ if [ -z "$$ISCC_BIN" ]; then \
if command -v iscc > /dev/null 2>&1; then ISCC_BIN=iscc; \ if command -v iscc > /dev/null 2>&1; then ISCC_BIN=iscc; \

View File

@ -204,10 +204,25 @@ if ($fastPath -and ($Target -eq 'exe' -or -not $env:VISIONA_TARGET)) {
} }
} }
$bashCmd = $bashParts -join ' && ' # 把 bash 指令寫成 script 檔再執行,避開 PS → bash 多層 quoting 地獄
# (尤其是含空格的路徑如 "C:\Program Files (x86)\Inno Setup 6\"
$bashScriptLines = @('#!/usr/bin/env bash', 'set -e', '')
foreach ($line in $bashParts) {
$bashScriptLines += $line
}
$bashScriptContent = ($bashScriptLines -join "`n") + "`n"
$tmpScript = Join-Path (Get-Location) '.visiona-build.sh'
# 用 UTF8 無 BOM + LF 換行bash 才吃得下
[System.IO.File]::WriteAllText($tmpScript, $bashScriptContent, (New-Object System.Text.UTF8Encoding $false))
& 'C:\msys64\usr\bin\bash.exe' -lc $bashCmd Log "bash 執行腳本內容:"
if ($LASTEXITCODE -ne 0) { Fail "build 失敗exit code=$LASTEXITCODE" } Get-Content $tmpScript | ForEach-Object { Write-Host " $_" }
$msysScript = Convert-ToMsysPath $tmpScript
& 'C:\msys64\usr\bin\bash.exe' -l $msysScript
$buildRc = $LASTEXITCODE
Remove-Item $tmpScript -ErrorAction SilentlyContinue
if ($buildRc -ne 0) { Fail "build 失敗exit code=$buildRc" }
# 驗證 dist 真的有 .exe 產出exe target 是 phonymake 成功 != 產物存在) # 驗證 dist 真的有 .exe 產出exe target 是 phonymake 成功 != 產物存在)
if ($Target -eq 'exe' -or $Target -eq 'default' -or -not $Target) { if ($Target -eq 'exe' -or $Target -eq 'default' -or -not $Target) {