FIX: build_windows.ps1 parse error PS5.1 — ASCII-only + UTF-8 BOM (unicode em-dash lam hong string terminator)

This commit is contained in:
2026-08-08 14:01:40 +00:00
parent eaca051191
commit 8b0551b18f
2 changed files with 18 additions and 7 deletions
+9 -7
View File
@@ -1,5 +1,7 @@
# build_windows.ps1 ONE-COMMAND build: daw_engine.exe (PyInstaller) + Tauri v2 (NSIS + MSI)
# build_windows.ps1 - ONE-COMMAND build: daw_engine.exe (PyInstaller) + Tauri v2 (NSIS + MSI)
# Chay tren Windows: powershell -ExecutionPolicy Bypass -File build_windows.ps1
# LUU Y: file nay chi dung ky tu ASCII (khong dau, khong em-dash) - PowerShell 5.1
# doc .ps1 khong BOM theo ANSI, ky tu Unicode bi hong -> "String is missing terminator".
$ErrorActionPreference = "Stop"
Set-Location $PSScriptRoot
@@ -14,12 +16,12 @@ node build.mjs # @babel/standalone; thay cho 'npm run build' (Babel 8 ESM-only
Write-Host "== [3/6] Build daw_engine.exe (PyInstaller) =="
pyinstaller engine.spec --clean --noconfirm
Write-Host "== [3.5/6] Verify bundle contents (app/static, app/templates phi có) =="
# Bt li bundle NGAY ti build (đã gp 2 ln: chy pyinstaller t nơi khác
# -> static/templates thiếu -> exe crash 'Directory ...\app\static does not exist').
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: đọc TOC trc tiếp t Analysis
# 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
@@ -32,10 +34,10 @@ if (-not (Test-Path "build\engine\Analysis-00.toc")) {
if ($tocContent -notmatch "app/templates") { $missing += "app/templates" }
}
if ($missing.Count -gt 0) {
Write-Host "ERROR: Bundle thiếu: $($missing -join ', '). Dng build kim tra engine.spec datas!" -ForegroundColor Red
Write-Host "ERROR: Bundle thieu: $($missing -join ', '). Dung build - kiem tra engine.spec datas!" -ForegroundColor Red
exit 1
} else {
Write-Host "OK: app/static + app/templates có trong bundle." -ForegroundColor Green
Write-Host "OK: app/static + app/templates co trong bundle." -ForegroundColor Green
}
Write-Host "== [4/6] Sidecar binary -> src-tauri/binaries (tauri triple naming) =="