feat(local-tool): Windows build fast path + 產物驗證
Makefile: - 新增 exe-only target:只跑 iscc 打包 installer,不重 build wails/payload - 拆出 _run-iscc 共用 recipe,exe 和 exe-only 都依賴它 bootstrap-windows.ps1: - 偵測 visiona-local.exe / server.exe / ffmpeg.exe / python.tar.gz 都在時走 fast path 只跑 make exe-only,省掉重複 wails build 的數分鐘 - 跑完驗證 dist\visiona-local-*-windows-x64.exe 確實存在,否則明確 Fail 並提示手動 iscc 指令 使用情境:使用者刪掉 dist\ 想重打 installer,再跑一次 bootstrap 就能秒出 .exe Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4521ee3119
commit
06031206af
@ -27,7 +27,7 @@ PAYLOAD := visiona-local/payload
|
|||||||
payload payload-macos payload-windows payload-linux \
|
payload payload-macos payload-windows payload-linux \
|
||||||
stage-macos stage-windows \
|
stage-macos stage-windows \
|
||||||
wails-macos wails-windows wails-linux \
|
wails-macos wails-windows wails-linux \
|
||||||
dmg exe appimage \
|
dmg exe exe-only _run-iscc appimage \
|
||||||
dev dev-mock test lint fmt clean
|
dev dev-mock test lint fmt clean
|
||||||
|
|
||||||
# ── 幫助 ───────────────────────────────────────────────────────────
|
# ── 幫助 ───────────────────────────────────────────────────────────
|
||||||
@ -458,7 +458,18 @@ dmg: wails-macos ## hdiutil UDZO → dist/visiona-local.dmg
|
|||||||
@du -sh $(DIST)/visiona-local.dmg
|
@du -sh $(DIST)/visiona-local.dmg
|
||||||
@file $(DIST)/visiona-local.dmg
|
@file $(DIST)/visiona-local.dmg
|
||||||
|
|
||||||
exe: wails-windows ## ⚠️ 必須在 Windows 上跑:Inno Setup → dist/visiona-local-*-windows-x64.exe
|
exe-only: ## 只跑 iscc 打包 installer(前置產物必須已存在),不重 build wails/payload
|
||||||
|
@if [ ! -f visiona-local/build/bin/visiona-local.exe ]; then \
|
||||||
|
echo "❌ visiona-local/build/bin/visiona-local.exe 不存在,請先跑 make wails-windows"; exit 1; \
|
||||||
|
fi
|
||||||
|
@if [ ! -f payload/windows/bin/visiona-local-server.exe ]; then \
|
||||||
|
echo "❌ payload/windows/bin/visiona-local-server.exe 不存在,請先跑 make payload-windows"; exit 1; \
|
||||||
|
fi
|
||||||
|
@$(MAKE) --no-print-directory _run-iscc
|
||||||
|
|
||||||
|
exe: wails-windows _run-iscc ## ⚠️ 必須在 Windows 上跑:Inno Setup → dist/visiona-local-*-windows-x64.exe
|
||||||
|
|
||||||
|
_run-iscc:
|
||||||
@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; \
|
||||||
|
|||||||
@ -185,20 +185,39 @@ if ($msysIsccDir) {
|
|||||||
if ($msysIsccExe) {
|
if ($msysIsccExe) {
|
||||||
$bashParts += "export ISCC=`"$msysIsccExe`""
|
$bashParts += "export ISCC=`"$msysIsccExe`""
|
||||||
}
|
}
|
||||||
|
# 偵測前置產物是否已齊全 —— 齊全就走 fast path(只重跑 iscc),省 wails rebuild 幾分鐘
|
||||||
|
$fastPath = (Test-Path 'visiona-local\build\bin\visiona-local.exe') -and `
|
||||||
|
(Test-Path 'payload\windows\bin\visiona-local-server.exe') -and `
|
||||||
|
(Test-Path 'payload\windows\bin\ffmpeg.exe') -and `
|
||||||
|
(Test-Path 'payload\windows\python\python.tar.gz')
|
||||||
|
|
||||||
|
if ($fastPath -and ($Target -eq 'exe' -or -not $env:VISIONA_TARGET)) {
|
||||||
|
Log 'FAST PATH:前置產物齊全,跳過 vendor/payload/wails,只重跑 iscc 打包'
|
||||||
|
$bashParts += 'make exe-only'
|
||||||
|
} else {
|
||||||
$bashParts += 'make vendor-python-windows vendor-wheels-windows vendor-ffmpeg-windows vendor-ytdlp-windows'
|
$bashParts += 'make vendor-python-windows vendor-wheels-windows vendor-ffmpeg-windows vendor-ytdlp-windows'
|
||||||
$bashParts += 'make payload-windows'
|
$bashParts += 'make payload-windows'
|
||||||
|
|
||||||
switch ($Target) {
|
switch ($Target) {
|
||||||
'payload-windows' { }
|
'payload-windows' { }
|
||||||
'wails-windows' { $bashParts += 'make wails-windows' }
|
'wails-windows' { $bashParts += 'make wails-windows' }
|
||||||
default { $bashParts += 'make wails-windows'; $bashParts += 'make exe' }
|
default { $bashParts += 'make wails-windows'; $bashParts += 'make exe' }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$bashCmd = $bashParts -join ' && '
|
$bashCmd = $bashParts -join ' && '
|
||||||
|
|
||||||
& 'C:\msys64\usr\bin\bash.exe' -lc $bashCmd
|
& 'C:\msys64\usr\bin\bash.exe' -lc $bashCmd
|
||||||
if ($LASTEXITCODE -ne 0) { Fail "build 失敗,exit code=$LASTEXITCODE" }
|
if ($LASTEXITCODE -ne 0) { Fail "build 失敗,exit code=$LASTEXITCODE" }
|
||||||
|
|
||||||
|
# 驗證 dist 真的有 .exe 產出(exe target 是 phony,make 成功 != 產物存在)
|
||||||
|
if ($Target -eq 'exe' -or $Target -eq 'default' -or -not $Target) {
|
||||||
|
$exeFiles = Get-ChildItem dist -Filter 'visiona-local-*-windows-x64.exe' -ErrorAction SilentlyContinue
|
||||||
|
if (-not $exeFiles) {
|
||||||
|
Fail "make exe 沒報錯,但 dist\ 下沒有 visiona-local-*-windows-x64.exe。往上捲看 iscc 輸出找原因,或直接跑:
|
||||||
|
& `"$env:LOCALAPPDATA\Programs\Inno Setup 6\ISCC.exe`" installer\windows\visiona-local.iss"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Log '完成 ✅'
|
Log '完成 ✅'
|
||||||
Log "產出位置:$(Join-Path (Get-Location) 'dist')"
|
Log "產出位置:$(Join-Path (Get-Location) 'dist')"
|
||||||
Get-ChildItem dist -ErrorAction SilentlyContinue | Format-Table Name, Length
|
Get-ChildItem dist -ErrorAction SilentlyContinue | Format-Table Name, Length
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user