perf: slim daw_engine bundle 409MB->170MB + fix engine khong chay tren Windows
- Thay librosa bang app/core/audio_features.py (numpy/scipy/soundfile):
load, beat_track, frames_to_time, spectral_centroid, rms, zero_crossing_rate,
time_stretch, pitch_shift, chroma_stft. A/B ngang librosa (BPM <1% sai lech,
pitch_shift chuan toi Hz). Loai bo llvmlite 171MB + scikit-learn + numba.
- Task layer 2 che do (app/tasks/worker.py): server giu celery; desktop slim
chay in-process thread + registry, giu nguyen API contract (.delay/.id/status
/tasks/{id}) nen frontend khong doi.
- engine.spec: excludes librosa/numba/llvmlite/sklearn/celery/redis/kombu/
billiard/amqp/msgpack/yaml/PIL/cairosvg/zstandard/...; scan scipy gioi han
scipy.signal; giu click (uvicorn.main import click).
- render_engine: scipy.signal thanh lazy import (giam cold start).
- tauri.conf.json: targets [nsis, msi] - NSIS tro lai (bundle nho) de
hooks.nsh cai VC++ Redistributable - sua bug daw_engine.exe khong chay
tren Windows (truoc day MSI-only khong chay hooks).
- build_linux.sh / build_macos.sh: build 1 lenh moi OS.
- Doc: DESKTOP_INSTALL_PLAN.md muc 5.1.
- Verify: 86 tests pass, engine dong goi upload/analyze/waveform/export OK.
This commit is contained in:
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
# build_macos.sh - build daw_engine (PyInstaller ONEDIR) + Tauri v2 (.app + .dmg)
|
||||
# Chay tren macOS: bash build_macos.sh
|
||||
# LUU Y: macOS yeu cau codesign + notarize truoc khi phat hanh ra ngoai
|
||||
# (Gatekeeper). Xem DISTRIBUTION_PLAN.md.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
echo "== [1/6] Python dependencies =="
|
||||
python3 -m pip install --upgrade pip >/dev/null
|
||||
python3 -m pip install -r requirements.txt pyinstaller
|
||||
|
||||
echo "== [2/6] Frontend bundle =="
|
||||
npm install --no-audit --no-fund
|
||||
if [ ! -d "node_modules/@babel/standalone" ]; then
|
||||
npm install @babel/standalone --no-audit --no-fund
|
||||
fi
|
||||
node build.mjs
|
||||
|
||||
echo "== [3/6] Build daw_engine (PyInstaller ONEDIR) =="
|
||||
python3 -m PyInstaller engine.spec --clean --noconfirm
|
||||
|
||||
echo "== [3.5/6] Verify bundle contents =="
|
||||
python3 tools/verify_bundle.py || { echo "ERROR: Bundle thieu asset - dung build!"; exit 1; }
|
||||
|
||||
echo "== [4/6] Copy onedir engine -> src-tauri/resources/daw_engine =="
|
||||
if [ ! -f "dist/daw_engine/daw_engine" ]; then
|
||||
echo "ERROR: dist/daw_engine/daw_engine khong ton tai (onedir build loi?)"
|
||||
exit 1
|
||||
fi
|
||||
rm -rf src-tauri/resources/daw_engine
|
||||
mkdir -p src-tauri/resources/daw_engine
|
||||
cp -a dist/daw_engine/. src-tauri/resources/daw_engine/
|
||||
echo "Copied onedir engine -> src-tauri/resources/daw_engine"
|
||||
|
||||
echo "== [5/6] Kiem tra resources =="
|
||||
if [ ! -f "src-tauri/resources/daw_engine/daw_engine" ] || [ ! -d "src-tauri/resources/daw_engine/_internal" ]; then
|
||||
echo "ERROR: thieu src-tauri/resources/daw_engine/{daw_engine,_internal}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "== [6/6] Tauri build (dmg) =="
|
||||
npm install -D @tauri-apps/cli --no-audit --no-fund
|
||||
npx tauri build
|
||||
|
||||
echo ""
|
||||
echo "== DONE =="
|
||||
echo " dmg: src-tauri/target/release/bundle/dmg/SonicForgeDAW_1.0.0_x64.dmg"
|
||||
echo " (Codesign/notarize: codesign --deep -s \"Developer ID Application: ...\" "
|
||||
echo " src-tauri/target/release/bundle/macos/SonicForgeDAW.app ; xcrun notarytool submit ...)"
|
||||
Reference in New Issue
Block a user