FIX: verify bundle dung tools/verify_bundle.py (normalize backslash, false-positive 'thieu static') + check engine.spec phien ban moi

This commit is contained in:
2026-08-08 14:15:14 +00:00
parent 8b0551b18f
commit 1f7a8c6f1b
3 changed files with 78 additions and 18 deletions
+11 -18
View File
@@ -19,25 +19,18 @@ pyinstaller engine.spec --clean --noconfirm
Write-Host "== [3.5/6] Verify bundle contents (app/static, app/templates phai co) =="
# Bat loi bundle NGAY tai build (da gap 2 lan: chay pyinstaller tu noi khac
# -> static/templates thieu -> exe crash 'Directory ...\app\static does not exist').
$missing = @()
if (-not (Test-Path "build\engine\Analysis-00.toc")) {
# PyInstaller 6.x: doc TOC truc tiep tu Analysis
$tocFiles = Get-ChildItem "build\engine" -Filter "*.toc" -ErrorAction SilentlyContinue
if ($tocFiles) {
$tocContent = Get-Content $tocFiles[0].FullName -Raw
if ($tocContent -notmatch "app/static") { $missing += "app/static" }
if ($tocContent -notmatch "app/templates") { $missing += "app/templates" }
}
} else {
$tocContent = Get-Content "build\engine\Analysis-00.toc" -Raw
if ($tocContent -notmatch "app/static") { $missing += "app/static" }
if ($tocContent -notmatch "app/templates") { $missing += "app/templates" }
}
if ($missing.Count -gt 0) {
Write-Host "ERROR: Bundle thieu: $($missing -join ', '). Dung build - kiem tra engine.spec datas!" -ForegroundColor Red
# Dung tools/verify_bundle.py (parse TOC bang ast, chap nhan ca / va \) thay
# vi regex thong thuong (TOC Windows co the dung backslash -> false positive).
# Truoc tien kiem tra engine.spec phai la ban moi (collect_data_files).
$specContent = Get-Content "engine.spec" -Raw -ErrorAction SilentlyContinue
if ($specContent -notmatch "collect_data_files\('app'") {
Write-Host "ERROR: engine.spec CU (thieu collect_data_files('app')). Pull code moi truoc khi build!" -ForegroundColor Red
exit 1
}
python tools\verify_bundle.py
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Bundle thieu asset - dung build, kiem tra engine.spec datas!" -ForegroundColor Red
exit 1
} else {
Write-Host "OK: app/static + app/templates co trong bundle." -ForegroundColor Green
}
Write-Host "== [4/6] Sidecar binary -> src-tauri/binaries (tauri triple naming) =="