V45.37: build_windows.ps1 full-build - dung path CMake build/bridge-win (vcxproj+Release), Continue+LASTEXITCODE (native stderr), kill engine theo path khong dong production
This commit is contained in:
+13
-8
@@ -20,7 +20,9 @@ param(
|
||||
[switch]$SkipNpm
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
# "Stop" + npm/pip warn tren stderr -> NativeCommandError -> chet oai (da gap o
|
||||
# build_install.ps1). Dung "Continue" + kiem tra $LASTEXITCODE sau tung lenh native.
|
||||
$ErrorActionPreference = "Continue"
|
||||
Set-Location $PSScriptRoot
|
||||
|
||||
$any = $Frontend -or $Bridge -or $Engine -or $Tauri
|
||||
@@ -34,18 +36,21 @@ $Stamp = Get-Date -Format "yyyyMMddHHmm"
|
||||
function Fail([string]$msg) { Write-Host "ERROR: $msg" -ForegroundColor Red; exit 1 }
|
||||
|
||||
if ($doEngine -or $doTauri) {
|
||||
Write-Host "== [0] Kill daw_engine.exe cu (neu dang chay - tranh khoa exe khi build) =="
|
||||
Get-Process -Name "daw_engine" -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||
Write-Host "== [0] Kill engine cu (chi install/dist/resources, khong dong production) =="
|
||||
Get-Process -ErrorAction SilentlyContinue | Where-Object {
|
||||
$_.Path -like "$PSScriptRoot\install\*" -or $_.Path -like "$PSScriptRoot\dist\daw_engine\*" -or $_.Path -like "$PSScriptRoot\src-tauri\resources\daw_engine\*"
|
||||
} | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||
Start-Sleep -Milliseconds 500
|
||||
}
|
||||
|
||||
# ---- [1] Frontend bundle + sync static -------------------------------------
|
||||
if ($doFrontend) {
|
||||
Write-Host "== [1] Frontend bundle (app.jsx -> app.precompiled.js, cache-buster v=$Stamp) =="
|
||||
if (-not $SkipNpm) { npm install }
|
||||
if (-not $SkipNpm) { npm install; if ($LASTEXITCODE -ne 0) { Fail "npm install that bai" } }
|
||||
if (-not (Test-Path "node_modules\@babel\standalone")) {
|
||||
Write-Host "Thieu @babel/standalone - dang cai them..."
|
||||
npm install @babel/standalone --no-audit --no-fund
|
||||
if ($LASTEXITCODE -ne 0) { Fail "npm install @babel/standalone that bai" }
|
||||
}
|
||||
if (-not (Test-Path "node_modules\@babel\standalone")) { Fail "Khong cai duoc @babel/standalone. Kiem tra ket noi npm!" }
|
||||
node build.mjs $Stamp
|
||||
@@ -97,9 +102,9 @@ if ($doBridge) {
|
||||
if (-not $msbuild) { Fail "Khong tim thay MSBuild.exe. Cai VS Build Tools 2019/2022 (workload C++) va chay CMake native_bridge truoc." }
|
||||
|
||||
foreach ($name in @("daw_vst_bridge", "fx_vst_bridge", "plugin_host")) {
|
||||
$proj = "native_bridge\build\$name.vcxproj"
|
||||
$exe = "native_bridge\build\Release\$name.exe"
|
||||
if (-not (Test-Path $proj)) { Fail "Thieu project: $proj (can CMake native_bridge truoc)" }
|
||||
$proj = "native_bridge\build\bridge-win\$name.vcxproj"
|
||||
$exe = "native_bridge\build\bridge-win\Release\$name.exe"
|
||||
if (-not (Test-Path $proj)) { Fail "Thieu project: $proj (can CMake native_bridge truoc - xem native_bridge/build/bridge-win)" }
|
||||
$newest = Get-ChildItem -Path "native_bridge\src","native_bridge\include" -Recurse -Include *.cpp,*.h,*.hpp -ErrorAction SilentlyContinue |
|
||||
Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
||||
$needBuild = $true
|
||||
@@ -167,7 +172,7 @@ if ($doTauri) {
|
||||
foreach ($name in @("daw_vst_bridge", "fx_vst_bridge", "plugin_host")) {
|
||||
if (-not (Test-Path "src-tauri\binaries\$name-x86_64-pc-windows-msvc.exe")) { Fail "Thieu src-tauri\binaries\$name-x86_64-pc-windows-msvc.exe - chay -Bridge truoc" }
|
||||
}
|
||||
if (-not $SkipNpm) { npm install -D @tauri-apps/cli }
|
||||
if (-not $SkipNpm) { npm install -D @tauri-apps/cli; if ($LASTEXITCODE -ne 0) { Fail "npm install @tauri-apps/cli that bai" } }
|
||||
npx tauri build
|
||||
if ($LASTEXITCODE -ne 0) { Fail "tauri build that bai" }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user