# wemusic-builder **Repository Path**: wemusic/wemusic-builder ## Basic Information - **Project Name**: wemusic-builder - **Description**: WeMusic builder - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-19 - **Last Updated**: 2026-07-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # WeMusic Distribution Builder Builds and packages the WeMusic daemon + desktop app into installers and portable archives. ## Prerequisites | Tool | Required | Notes | |------|----------|-------| | Python 3.10+ | Yes | | | Rust / Cargo | Yes | for building daemon | | Node.js / npm | Yes | for building frontend | | NSIS | Auto-downloaded | `makensis` used for installer builds | NSIS is automatically downloaded and cached in `_tools/` if not found on PATH. You can also pre-download it: `python build.py --download-tools`. ## Quick Start ```bash # Development (Vite HMR + debug daemon) python build.py --verify --dev # Tauri dev (native window + debug daemon) python build.py --verify --dev --platform tauri # Build portable zip python build.py --platform tauri --mode portable # Build NSIS installer python build.py --platform tauri --mode install # All four formats python build.py --all ``` ## Commands ### `--verify --dev` (development mode) | Platform | Daemon lifecycle | Command | |----------|------------------|---------| | web (default) | Builder starts debug daemon + Vite dev server | `python build.py --verify --dev` | | tauri | App spawns daemon via env (`WEMUSIC_DAEMON_PATH`, etc.) | `python build.py --verify --dev --platform tauri` | | electron | App spawns daemon via env (`WEMUSIC_DAEMON_PATH`, etc.) | `python build.py --verify --dev --platform electron` | Web mode: Ctrl+C stops both daemon and dev server. Tauri/Electron: Ctrl+C stops the dev shell; the app manages daemon start/stop. The frontend auto-detects that daemon auth is disabled and skips the login page. Daemon data persists in `dist/verify/` across sessions. ### `--verify --release` (release verification) Creates a ready-to-run portable directory in `dist/verify/` with release- optimized binaries. No hot-reload — double-click `wemusic-app.exe` to test. ### Release builds | Command | Output | |---------|--------| | `--platform tauri --mode install` | `dist/WeMusic-{version}-x64-tauri-setup.exe` | | `--platform tauri --mode portable` | `dist/WeMusic-{version}-x64-tauri-portable.zip` | | `--platform electron --mode install` | `dist/WeMusic-{version}-x64-electron-setup.exe` | | `--platform electron --mode portable` | `dist/WeMusic-{version}-x64-electron-portable.zip` | **Installer options:** 安装包默认以当前用户安装(无需管理员权限)。安装过程中可勾选「为所有用户安装」以写入 Program Files 并请求 UAC 提权。 ```bash # Via HTTP proxy python build.py --platform tauri --mode install --proxy http://127.0.0.1:7897 ``` ## Directory Layout ``` wemusic-dist/ ├── build.py # Main build orchestrator ├── templates/ │ └── installer.nsi # Custom NSIS installer template ├── _tools/ # Cached build tools (preserved across --clean) │ ├── nsis-3.12.zip │ └── nsis-3.12/ │ ├── makensis.exe │ ├── Include/UAC.nsh # UAC plugin header │ └── Plugins/x86-unicode/ │ └── UAC.dll # UAC plugin DLL ├── _staging/ # Intermediate build artifacts (--clean removes) │ ├── daemon/wemusic-daemon.exe │ └── app/ │ ├── wemusic-app.exe # tauri: single exe only │ └── wemusic-app.exe + … # electron: unpacked dir (resources/, etc.) ├── dist/ # Final output │ ├── WeMusic-{ver}-x64-*-setup.exe │ ├── WeMusic-{ver}-x64-*-portable.zip │ └── verify/ # --verify outputs └── README.md ``` ## Installer: Multi-User & UAC The installer supports two install modes, selectable at install time via a radio-button page: | Mode | Install path | Registry | UAC | |------|-------------|----------|-----| | **仅为我安装** (Current user) | `%LOCALAPPDATA%\Programs\WeMusic` | HKCU | None | | **为所有用户安装** (All users) | `%PROGRAMFILES64%\WeMusic` | HKLM | Prompted on the install-scope page | Key behaviors: - The installer always starts as **user-level** (`RequestExecutionLevel user`) — it never shows a UAC prompt on launch. - When the user selects "All users" and clicks Next, the [UAC plugin](https://nsis.sourceforge.io/UAC_plug-in) dynamically spawns an elevated process via COM. The original window closes, and the elevated instance resumes from the directory-selection page — so the user does **not** need to click through already-seen pages again. - The UAC plugin files (`UAC.dll` + `UAC.nsh`, v0.2.4c, zlib license) are cached under `_tools/nsis-3.12/` alongside NSIS itself. - The uninstaller detects the original install mode from the registry and, for All-Users installs, elevates via the same UAC plugin mechanism before removing files. ## Tool Management ```bash # Force download/cache NSIS python build.py --download-tools # Download from mirror python build.py --download-tools --nsis-mirror https://mirror.example.com/nsis-3.12.zip # Clean build artifacts (preserves _tools/) python build.py --clean ``` ## Architecture ``` build.py │ ├─ cargo build --release -p wemusic-daemon → _staging/daemon/ ├─ npm run build → _staging/frontend/ ├─ tauri build --no-bundle → _staging/app/ │ / electron-builder --win dir │ └─ makensis installer.nsi → dist/*-setup.exe / zip → dist/*-portable.zip ```