Skip to content

οΈπŸ›  - Feature-flag desktop-only Rust code for mobile compilationΒ #48

@maxwellmattryan

Description

@maxwellmattryan

Description

Prepare the Rust backend to compile for mobile targets (aarch64-apple-ios, aarch64-linux-android) by gating desktop-only code behind feature flags.

Scope:

  • Add desktop and mobile feature flags to src-tauri/Cargo.toml
  • Gate desktop-only services behind #[cfg(feature = "desktop")]:
    • services/device.rs β€” USB detection (sysinfo, diskutil)
    • services/export/ β€” Pioneer PDB/ANLZ generation
    • services/sync.rs β€” USB device sync
    • services/audio/ β€” rodio playback
    • services/media_controls.rs β€” souvlaki
    • services/analysis.rs β€” audio analysis (symphonia + stratum-dsp)
    • services/library.rs β€” file import/metadata extraction (lofty)
  • Gate desktop-only dependencies:
    • rodio, souvlaki, raw-window-handle, sysinfo β†’ desktop feature only
    • lofty, walkdir, stratum-dsp, binrw, flate2, base85 β†’ desktop feature only
  • Gate desktop-only commands in commands/ that reference gated services
  • Gate desktop-only code in lib.rs (service init, command registration, menu)
  • Ensure cargo check --target aarch64-apple-ios --no-default-features --features mobile passes
  • Keep desktop as a default feature so existing builds are unaffected

Shared services that must compile for both targets:

  • services/discovery/ β€” metadata fetching, stream resolution, all sub-modules
  • services/playlist.rs β€” playlist CRUD
  • services/tag.rs β€” tag/category CRUD
  • services/settings.rs β€” app settings
  • services/artwork.rs β€” artwork caching
  • services/backup.rs β€” database backup
  • proxy.rs β€” localhost audio proxy (needed for mobile preview playback)

Note: n_transform.rs (YouTube de-throttling) depends on Webview::eval() β€” this is architecturally shared and should compile for mobile, but needs runtime validation on iOS (see #80).

Companion issue: #81 (Mobile CI target) should be set up once this issue is complete to prevent regressions.

Key files:

  • src-tauri/Cargo.toml
  • src-tauri/src/lib.rs
  • src-tauri/src/commands/*.rs
  • src-tauri/src/services/device.rs, audio/, media_controls.rs, export/, sync.rs, analysis.rs, library.rs

Open questions

  • Should walkdir be shared or desktop-only? (Used for file import traversal β€” desktop-only)
  • Are there any implicit desktop dependencies in shared services (e.g., does artwork.rs use any desktop-only crate)?

Acceptance criteria

  • Desktop build unchanged (cargo build works as before with default features)
  • Mobile target compiles without desktop dependencies: cargo check --target aarch64-apple-ios --no-default-features --features mobile
  • All shared services (discovery, tag, playlist, settings, artwork, backup) compile for both targets
  • proxy.rs compiles for mobile target
  • No runtime desktop assumptions in shared code paths

Tasks

TBD

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions