Skip to content

Development

Giwi edited this page Nov 22, 2026 · 14 revisions

Development

Build

cargo build --workspace

The GUI renders with wgpu (Vulkan on Linux, DX12 on Windows, OpenGL ES fallback). Linux needs a working Vulkan or GL driver; the CI job installs mesa-vulkan-drivers.

Linux dependencies are listed in Installation.

AcoustID build key

AcoustID fingerprint identification embeds an optional application key at compile time:

cp .env.example .env
# ACCOUSTID_APIKEY=...
cargo build --release

.env is ignored by git. CI reads the same value from the GitHub production environment secret ACCOUSTID_APIKEY in the tag build job. The build script reruns when .env or the environment variable changes; the key is never printed. There is no runtime key setting: rebuild to change it.

Tests

cargo test --workspace
cargo test -p musicwasp-gui --test ui

Tests use temporary libraries and synthesized WAV files. No sample music or audio device is needed.

Snapshot tests

Image baselines for the main skins and accessibility modes live in gui/tests/snapshots/:

cargo test -p musicwasp-gui --test snapshots
UPDATE_SNAPSHOTS=force cargo test -p musicwasp-gui --test snapshots

The second command regenerates the baselines after an intentional UI change. The test uses the wgpu renderer, so a GPU or software Vulkan driver is required; the Linux CI job installs mesa-vulkan-drivers. Snapshot tests are gated to Linux.

Live watch mode

Install once:

cargo install cargo-watch --locked

Then:

scripts/dev-watch.sh                   # launch/restart GUI on every save
WATCH_MODE=check scripts/dev-watch.sh  # fast compile check
WATCH_MODE=test scripts/dev-watch.sh   # full tests

Screenshot hooks

Developer hooks are MUSICWASP_* environment variables that open dialogs, seed state or render a screenshot and exit. They are inert unless MUSICWASP_DEBUG=1 is also set, in any build, so a normal launch never reads them. Some hooks are destructive: MUSICWASP_UNDO restores the last tag snapshot, MUSICWASP_AUTOTAG_APPLY writes tags, MUSICWASP_SCAN indexes a folder and MUSICWASP_RESTORE_DIALOG writes a backup file. Use a temporary data directory when you run them.

MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/shot.png MUSICWASP_AUTOPLAY=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/plain.png MUSICWASP_AUTOPLAY=1 MUSICWASP_PLAIN=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/tags.png MUSICWASP_EDITOR=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/rename.png MUSICWASP_RENAME=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/eq.png MUSICWASP_EQ=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/columns.png MUSICWASP_COLUMNS=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/scan.png MUSICWASP_SCAN=/path/to/music cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/settings.png MUSICWASP_SETTINGS=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/hygiene.png MUSICWASP_HYGIENE=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/renames.png MUSICWASP_RECONCILE=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/organize.png MUSICWASP_ORGANIZE=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/skin-editor.png MUSICWASP_SKIN_EDITOR=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/mini.png MUSICWASP_MINI=1 MUSICWASP_AUTOPLAY=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/restore.png MUSICWASP_RESTORE_DIALOG=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/grid.png MUSICWASP_ALBUM_GRID=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/undo.png MUSICWASP_UNDO=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/viz-full.png MUSICWASP_VIS_FULLSCREEN=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/radio.png MUSICWASP_VIEW=radio MUSICWASP_PLAY_RADIO=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/podcasts.png MUSICWASP_VIEW=podcasts MUSICWASP_PODCAST_FIRST=1 cargo run -p musicwasp-gui
MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/lyrics.png MUSICWASP_AUTOPLAY=1 MUSICWASP_LYRICS=1 MUSICWASP_SEEK=31 cargo run -p musicwasp-gui

Use a temporary data directory to avoid touching a real library. Add MUSICWASP_DEBUG=1 to any hook command, as above:

MUSICWASP_DATA_DIR=/tmp/musicwasp-test MUSICWASP_DEBUG=1 MUSICWASP_SCREENSHOT=/tmp/shot.png cargo run -p musicwasp-gui

On Wayland, eframe 0.36 can stall when the window is fully occluded and no frame callback arrives. For unattended screenshot runs, force XWayland with MUSICWASP_X11=1.

Temporary Wayland patches

The workspace pins a reviewed winit backport and a local egui-winit clipboard patch for native Wayland file drops and clipboard on compositors that only serve a client's first data device.

  • Removal checklist and verification steps: patches/REMOVAL.md
  • Guard test: cargo test -p musicwasp-gui --test temporary_patches

The test fails when the pinned revision, the eframe requirement or the patched crate version drifts, so dependency bumps must either update the patches deliberately or remove them.

Code layout

See Architecture. The GUI is a library plus a thin binary, and tests live under gui/tests.

UI assets

  • assets/fonts/ bundles Inter Regular/SemiBold and the SIL OFL licence; the fonts are embedded by icons::install, together with the Phosphor icon face
  • theme::apply_palette owns radii, spacing, typography, shadows, scrollbars and control sizing for every skin; theme::semibold renders the SemiBold family
  • keep new controls on the shared spacing scale so square, compact and 120% text mode still fit
  • intentional changes to fonts, spacing or radii need fresh snapshot baselines:
UPDATE_SNAPSHOTS=force cargo test -p musicwasp-gui --test snapshots

Release

Tagged releases are built by GitHub Actions for Linux, Windows, macOS arm64 and macOS x86_64. Linux archives include binaries, desktop entry, icons, sample skins.json and translation files.

The sbom CI job generates a CycloneDX 1.6 SBOM from Cargo.lock with cargo-sbom, validates it against the package version, and uploads it as the sbom artifact. The release job verifies the SBOM and attaches it to the release as musicwasp-<tag>-sbom.cdx.json.

Clone this wiki locally