FIX: tạo 2 file giúp build trên Windows
This commit is contained in:
@@ -0,0 +1,45 @@
|
|||||||
|
# BUILD WINDOWS — hướng dẫn build installer (.exe) trên máy Windows
|
||||||
|
|
||||||
|
## Yêu cầu trước khi build
|
||||||
|
| Thành phần | Cài từ | Ghi chú |
|
||||||
|
|---|---|---|
|
||||||
|
| **Python 3.11+** | python.org | Tick **"Add to PATH"** |
|
||||||
|
| **Node.js 20+** | nodejs.org | |
|
||||||
|
| **Rust (MSVC toolchain)** | https://rustup.rs (hoặc script tự cài) | Cần cho Tauri |
|
||||||
|
| **Visual Studio Build Tools** | visualstudio.microsoft.com | Workload **"Desktop development with C++"** (bắt buộc — MSVC linker cho Rust/Tauri) |
|
||||||
|
| **WebView2 Runtime** | Windows 10/11 có sẵn; Windows 7/8 tải từ Microsoft | Tauri yêu cầu |
|
||||||
|
|
||||||
|
> Nếu lỗi `cargo: program not found` → chưa cài Rust: chạy `rustup-init.exe -y` rồi **mở cmd MỚI** (PATH refresh).
|
||||||
|
|
||||||
|
## Cách build — 1 lệnh
|
||||||
|
```bat
|
||||||
|
build_windows.bat
|
||||||
|
```
|
||||||
|
Script tự làm: cài Rust (nếu thiếu) → pip deps → Babel precompile → `pyinstaller engine.spec` (daw_engine.exe) → copy sidecar → `npx tauri build`.
|
||||||
|
|
||||||
|
## Kết quả
|
||||||
|
```
|
||||||
|
src-tauri\target\release\bundle\nsis\SonicForgeDAW_1.0.0_x64-setup.exe ← cài đặt (.exe)
|
||||||
|
src-tauri\target\release\bundle\msi\SonicForgeDAW_1.0.0_x64_en-US.msi ← MSI
|
||||||
|
dist\daw_engine.exe ← engine đơn (debug)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Thủ công (không dùng script)
|
||||||
|
```bat
|
||||||
|
pip install pyinstaller pywin32
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install --no-deps pedalboard>=0.8.0
|
||||||
|
node node_modules/@babel/cli/bin/babel.js app/static/js/app.jsx --config-file ./babel.config.json -o app/static/js/app.precompiled.js
|
||||||
|
pyinstaller engine.spec --clean --noconfirm
|
||||||
|
mkdir src-tauri\binaries
|
||||||
|
copy dist\daw_engine.exe src-tauri\binaries\daw_engine-x86_64-pc-windows-msvc.exe
|
||||||
|
npm install -D @tauri-apps/cli@^2
|
||||||
|
npx tauri build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Kiểm thử sau cài (spec — mục IV)
|
||||||
|
1. Mở app → Task Manager: `daw_engine.exe` chạy nền; đóng app → tiến trình tắt hẳn (không orphan).
|
||||||
|
2. Browser ngoài mở `http://localhost:8000/docs` → Swagger hiển thị.
|
||||||
|
3. Plugin Manager → path `C:\Program Files\Common Files\VST3` → Scan → tìm thấy VST3 (Vital, Surge XT...).
|
||||||
|
4. Export WAV → file chứa tiếng VST3 (qua pedalboard).
|
||||||
|
5. Dữ liệu lưu tại `%APPDATA%\SonicForgeDAW\`.
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
@echo off
|
||||||
|
REM ── SonicForge DAW — Windows build script (Dual-Process: daw_engine.exe + Tauri shell) ──
|
||||||
|
REM Chạy bằng "cmd" (Run as Administrator nếu cần cài Rust/system-wide)
|
||||||
|
setlocal enabledelayedexpansion
|
||||||
|
cd /d "%~dp0"
|
||||||
|
|
||||||
|
echo [1/6] Kiem tra Python + Node...
|
||||||
|
python --version || (echo THIEU Python 3.11+ — cai tu python.org (tick "Add to PATH") && pause && exit /b 1)
|
||||||
|
node --version || (echo THIEU Node 20+ — cai tu nodejs.org && pause && exit /b 1)
|
||||||
|
|
||||||
|
echo [2/6] Kiem tra / cai Rust toolchain (MSVC)...
|
||||||
|
where cargo >nul 2>nul
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo Cai Rust qua rustup (MSVC toolchain — can Visual Studio Build Tools/C++ workload)...
|
||||||
|
powershell -Command "Invoke-WebRequest https://win.rustup.rs/x86_64 -OutFile rustup-init.exe"
|
||||||
|
rustup-init.exe -y --default-toolchain stable --profile minimal
|
||||||
|
del rustup-init.exe
|
||||||
|
call "%USERPROFILE%\.cargo\env" 2>nul || set "PATH=%USERPROFILE%\.cargo\bin;%PATH%"
|
||||||
|
)
|
||||||
|
cargo --version || (echo Rust cai that bai — cai Visual Studio Build Tools (C++ workload) roi thu lai && pause && exit /b 1)
|
||||||
|
|
||||||
|
echo [3/6] Cai Python deps (PyInstaller + backend)...
|
||||||
|
pip install pyinstaller pywin32
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install --no-deps pedalboard>=0.8.0
|
||||||
|
|
||||||
|
echo [4/6] Precompile JS (Babel)...
|
||||||
|
npm install --no-audit --no-fund >nul 2>nul
|
||||||
|
node node_modules/@babel/cli/bin/babel.js app/static/js/app.jsx --config-file ./babel.config.json -o app/static/js/app.precompiled.js || exit /b 1
|
||||||
|
|
||||||
|
echo [5/6] Build daw_engine.exe (PyInstaller)...
|
||||||
|
pyinstaller engine.spec --clean --noconfirm || exit /b 1
|
||||||
|
if not exist "src-tauri\binaries" mkdir "src-tauri\binaries"
|
||||||
|
copy /y dist\daw_engine.exe "src-tauri\binaries\daw_engine-x86_64-pc-windows-msvc.exe" >nul
|
||||||
|
|
||||||
|
echo [6/6] Build Tauri installer (NSIS + MSI)...
|
||||||
|
npm install -D @tauri-apps/cli@^2 >nul 2>nul
|
||||||
|
call npx tauri build
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo HOAN TAT — Installer:
|
||||||
|
echo src-tauri\target\release\bundle\nsis\SonicForgeDAW_1.0.0_x64-setup.exe
|
||||||
|
echo src-tauri\target\release\bundle\msi\SonicForgeDAW_1.0.0_x64_en-US.msi
|
||||||
|
pause
|
||||||
@@ -2972,3 +2972,9 @@
|
|||||||
- **FIX:** (1) requirements.txt — BỎ `pedalboard` (chú thích lý do); (2) CI — `pip install -r requirements.txt` + `pip install --no-deps pedalboard>=0.8.0` (chỉ pedalboard core — load_plugin VST3 KHÔNG cần supertonic).
|
- **FIX:** (1) requirements.txt — BỎ `pedalboard` (chú thích lý do); (2) CI — `pip install -r requirements.txt` + `pip install --no-deps pedalboard>=0.8.0` (chỉ pedalboard core — load_plugin VST3 KHÔNG cần supertonic).
|
||||||
- **Các file ảnh hưởng:** requirements.txt, .github/workflows/windows-build.yml, wiki.md.
|
- **Các file ảnh hưởng:** requirements.txt, .github/workflows/windows-build.yml, wiki.md.
|
||||||
- **Ghi chú/Test:** chạy lại workflow — hết conflict numpy; pedalboard (VST3 render) vẫn hoạt động qua --no-deps.
|
- **Ghi chú/Test:** chạy lại workflow — hết conflict numpy; pedalboard (VST3 render) vẫn hoạt động qua --no-deps.
|
||||||
|
|
||||||
|
### [2026-08-08 08:45] Task: FIX build Windows (3) — cargo not found (thiếu Rust)
|
||||||
|
- **Lỗi:** `npx tauri build — failed to run 'cargo metadata' ... program not found` — máy build thiếu Rust toolchain.
|
||||||
|
- **FIX:** (1) `build_windows.bat` — script 1 lệnh: kiểm tra Python/Node → TỰ CÀI Rust (rustup -y) nếu thiếu → pip deps (+ pedalboard --no-deps) → Babel → pyinstaller engine.spec → copy sidecar → npx tauri build; (2) `BUILD_WINDOWS.md` — yêu cầu (Python, Node, Rust MSVC, VS Build Tools C++, WebView2) + build thủ công + checklist kiểm thử theo spec IV.
|
||||||
|
- **Các file ảnh hưởng:** build_windows.bat, BUILD_WINDOWS.md, wiki.md.
|
||||||
|
- **Ghi chú/Test:** trên máy Windows: chạy `build_windows.bat` (cmd) → sinh setup.exe; CI (windows-latest — dtolnay/rust-toolchain) không bị lỗi này.
|
||||||
|
|||||||
Reference in New Issue
Block a user