fix(build): gate macOS-unreachable imports to cfg(target_os = "linux")

The v1.2.5 tag push flagged three macOS-only compile errors on the
release-macos workflow (Linux, aarch64 Linux, flatpak still building
successfully). All three are Linux-only symbols pulled unconditionally
into files that are compiled on every target:

  * src-tauri/src/tray.rs: imports PathBuf inside the
    `cfg(not(target_os = "linux"))` branch without `use std::path::PathBuf`.
    Add the import under the matching cfg so macOS / Windows see it.

  * src-tauri/src/commands_v2/playback.rs: `cached_audio_incompatible_with_hw`
    is defined only on Linux (ALSA). Callsites are already
    `cfg(target_os = "linux")`, but the shared `use super::{...}` block
    was not. Move that one symbol out into a Linux-only import.

  * src-tauri/src/commands_v2/legacy_compat.rs: same story with
    `v2_prepare_notification_icon_bytes` — only the Linux notification
    path calls it, but the import was unconditional.

No runtime behaviour change; this only unblocks the release-macos
(and any future Apple-target) workflow so it can build.

cc
This commit is contained in:
vicrodh committed 2026-04-15 15:46:06 -06:00
1 parent aa68fa0a5b
commit a867d77528
3 files changed
+16 -4

No files matched your search

+6 -1
View File
@@ -29,8 +29,13 @@ use crate::AppState;
use super::{
download_audio, v2_cache_notification_artwork, v2_format_notification_quality,
v2_prepare_notification_icon_bytes, v2_teardown_type_alias_state,
v2_teardown_type_alias_state,
};
// Linux-only: turns an artwork PNG into the raw bytes Ayatana notifications
// expect. Only called inside the `cfg(target_os = "linux")` arm below, so the
// import must match.
#[cfg(target_os = "linux")]
use super::v2_prepare_notification_icon_bytes;
#[tauri::command]
pub async fn v2_show_track_notification(
+8 -3
View File
@@ -14,10 +14,15 @@ use crate::runtime::{CommandRequirement, RuntimeError, RuntimeManagerState};
use crate::AppState;
use super::{
cached_audio_incompatible_with_hw, cached_quality_below_requested, download_with_backoff,
limit_quality_for_device, parse_quality, try_cmaf_full_download, try_cmaf_streaming_setup,
v2_cmaf_stream, v2_download_and_stream, v2_get_stream_info, v2_library_get_tracks_by_ids,
cached_quality_below_requested, download_with_backoff, limit_quality_for_device,
parse_quality, try_cmaf_full_download, try_cmaf_streaming_setup, v2_cmaf_stream,
v2_download_and_stream, v2_get_stream_info, v2_library_get_tracks_by_ids,
};
// Linux-only: ALSA hardware capability check. The callsites that use it are
// already gated on `cfg(target_os = "linux")`, so the import has to match or
// macOS fails with "unresolved import".
#[cfg(target_os = "linux")]
use super::cached_audio_incompatible_with_hw;
// ==================== Prefetch (V2) ====================
+2
View File
@@ -11,6 +11,8 @@ use crate::tray_linux_ksni;
#[cfg(not(target_os = "linux"))]
use image::GenericImageView;
#[cfg(not(target_os = "linux"))]
use std::path::PathBuf;
#[cfg(not(target_os = "linux"))]
use tauri::{
image::Image,
menu::{Menu, MenuItem, PredefinedMenuItem},