From 0ad1f7249b8a1e9a71da4a3b527f793cb938bd62 Mon Sep 17 00:00:00 2001 From: Felix Prillwitz Date: Mon, 23 Dec 2024 10:28:06 +0100 Subject: [PATCH] Update MSRV to 1.81 (#1428) * bump MSRV to 1.81 * Update zbus to v5 * Update jack to 0.13 --- .devcontainer/Dockerfile | 2 +- .devcontainer/Dockerfile.alpine | 2 +- .github/workflows/test.yml | 6 +- CHANGELOG.md | 1 + Cargo.lock | 201 +++++------------------- Cargo.toml | 4 +- contrib/Dockerfile | 2 +- discovery/Cargo.toml | 2 +- discovery/src/avahi.rs | 8 +- playback/Cargo.toml | 2 +- playback/src/audio_backend/jackaudio.rs | 4 +- 11 files changed, 54 insertions(+), 180 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ce845a52b..233ac8383 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 ARG debian_version=slim-bookworm -ARG rust_version=1.75.0 +ARG rust_version=1.81.0 FROM rust:${rust_version}-${debian_version} ARG DEBIAN_FRONTEND=noninteractive diff --git a/.devcontainer/Dockerfile.alpine b/.devcontainer/Dockerfile.alpine index fd3b75c3e..1a9089555 100644 --- a/.devcontainer/Dockerfile.alpine +++ b/.devcontainer/Dockerfile.alpine @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 ARG alpine_version=alpine3.19 -ARG rust_version=1.75.0 +ARG rust_version=1.81.0 FROM rust:${rust_version}-${alpine_version} ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL="sparse" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 41928ed5d..ff877e125 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -109,7 +109,7 @@ jobs: matrix: os: [ubuntu-latest] toolchain: - - "1.75" # MSRV (Minimum supported rust version) + - "1.81" # MSRV (Minimum supported rust version) - stable experimental: [false] # Ignore failures in beta @@ -164,7 +164,7 @@ jobs: matrix: os: [windows-latest] toolchain: - - "1.75" # MSRV (Minimum supported rust version) + - "1.81" # MSRV (Minimum supported rust version) - stable steps: - name: Checkout code @@ -215,7 +215,7 @@ jobs: - aarch64-unknown-linux-gnu - riscv64gc-unknown-linux-gnu toolchain: - - "1.75" # MSRV (Minimum supported rust version) + - "1.81" # MSRV (Minimum supported rust version) - stable steps: - name: Checkout code diff --git a/CHANGELOG.md b/CHANGELOG.md index a9821e2c8..8e27f8634 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- [core] MSRV is now 1.81 (breaking) - [connect] Replaced `ConnectConfig` with `ConnectStateConfig` (breaking) - [connect] Replaced `playing_track_index` field of `SpircLoadCommand` with `playing_track` (breaking) - [connect] Replaced Mercury usage in `Spirc` with Dealer diff --git a/Cargo.lock b/Cargo.lock index b3b25e5f3..2d253687e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -147,67 +147,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "async-channel" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-io" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" -dependencies = [ - "async-lock", - "cfg-if", - "concurrent-queue", - "futures-io", - "futures-lite", - "parking", - "polling", - "rustix", - "slab", - "tracing", - "windows-sys 0.59.0", -] - -[[package]] -name = "async-lock" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" -dependencies = [ - "event-listener", - "event-listener-strategy", - "pin-project-lite", -] - -[[package]] -name = "async-process" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" -dependencies = [ - "async-channel", - "async-io", - "async-lock", - "async-signal", - "async-task", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "rustix", - "tracing", -] - [[package]] name = "async-recursion" version = "1.1.1" @@ -219,30 +158,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "async-signal" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" -dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if", - "futures-core", - "futures-io", - "rustix", - "signal-hook-registry", - "slab", - "windows-sys 0.59.0", -] - -[[package]] -name = "async-task" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" - [[package]] name = "async-trait" version = "0.1.83" @@ -400,19 +315,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "blocking" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" -dependencies = [ - "async-channel", - "async-task", - "futures-io", - "futures-lite", - "piper", -] - [[package]] name = "bumpalo" version = "3.16.0" @@ -607,7 +509,7 @@ dependencies = [ "core-foundation-sys", "coreaudio-rs", "dasp_sample", - "jack", + "jack 0.11.4", "jni", "js-sys", "libc", @@ -982,19 +884,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" -[[package]] -name = "futures-lite" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", -] - [[package]] name = "futures-macro" version = "0.3.31" @@ -1375,12 +1264,6 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" -[[package]] -name = "hermit-abi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" - [[package]] name = "hex" version = "0.4.3" @@ -1747,6 +1630,19 @@ dependencies = [ "log", ] +[[package]] +name = "jack" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78a4ae24f4ee29676aef8330fed1104e72f314cab16643dbeb61bfd99b4a8273" +dependencies = [ + "bitflags 2.6.0", + "jack-sys", + "lazy_static", + "libc", + "log", +] + [[package]] name = "jack-sys" version = "0.5.1" @@ -2100,7 +1996,7 @@ dependencies = [ "gstreamer", "gstreamer-app", "gstreamer-audio", - "jack", + "jack 0.13.0", "libpulse-binding", "libpulse-simple-binding", "librespot-audio", @@ -2202,7 +2098,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ - "hermit-abi 0.3.9", + "hermit-abi", "libc", "wasi", "windows-sys 0.52.0", @@ -2605,17 +2501,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "piper" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" -dependencies = [ - "atomic-waker", - "fastrand", - "futures-io", -] - [[package]] name = "pkcs1" version = "0.7.5" @@ -2643,21 +2528,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" -[[package]] -name = "polling" -version = "3.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" -dependencies = [ - "cfg-if", - "concurrent-queue", - "hermit-abi 0.4.0", - "pin-project-lite", - "rustix", - "tracing", - "windows-sys 0.59.0", -] - [[package]] name = "portable-atomic" version = "1.9.0" @@ -4540,31 +4410,28 @@ dependencies = [ [[package]] name = "zbus" -version = "4.4.0" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725" +checksum = "fb67eadba43784b6fb14857eba0d8fc518686d3ee537066eb6086dc318e2c8a1" dependencies = [ "async-broadcast", - "async-process", "async-recursion", "async-trait", "enumflags2", "event-listener", "futures-core", - "futures-sink", "futures-util", "hex", "nix", "ordered-stream", - "rand", "serde", "serde_repr", - "sha1", "static_assertions", "tokio", "tracing", "uds_windows", - "windows-sys 0.52.0", + "windows-sys 0.59.0", + "winnow", "xdg-home", "zbus_macros", "zbus_names", @@ -4573,25 +4440,28 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "4.4.0" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267db9407081e90bbfa46d841d3cbc60f59c0351838c4bc65199ecd79ab1983e" +checksum = "2c9d49ebc960ceb660f2abe40a5904da975de6986f2af0d7884b39eec6528c57" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.90", + "zbus_names", + "zvariant", "zvariant_utils", ] [[package]] name = "zbus_names" -version = "3.0.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" +checksum = "856b7a38811f71846fd47856ceee8bccaec8399ff53fb370247e66081ace647b" dependencies = [ "serde", "static_assertions", + "winnow", "zvariant", ] @@ -4644,22 +4514,24 @@ checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" [[package]] name = "zvariant" -version = "4.2.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe" +checksum = "a1200ee6ac32f1e5a312e455a949a4794855515d34f9909f4a3e082d14e1a56f" dependencies = [ "endi", "enumflags2", "serde", "static_assertions", + "winnow", "zvariant_derive", + "zvariant_utils", ] [[package]] name = "zvariant_derive" -version = "4.2.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73e2ba546bda683a90652bac4a279bc146adad1386f25379cf73200d2002c449" +checksum = "687e3b97fae6c9104fbbd36c73d27d149abf04fb874e2efbd84838763daa8916" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4670,11 +4542,14 @@ dependencies = [ [[package]] name = "zvariant_utils" -version = "2.1.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" +checksum = "20d1d011a38f12360e5fcccceeff5e2c42a8eb7f27f0dcba97a0862ede05c9c6" dependencies = [ "proc-macro2", "quote", + "serde", + "static_assertions", "syn 2.0.90", + "winnow", ] diff --git a/Cargo.toml b/Cargo.toml index 1e63fb3c8..ae89da48d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "librespot" version = "0.6.0-dev" -rust-version = "1.75" +rust-version = "1.81" authors = ["Librespot Org"] license = "MIT" description = "An open source client library for Spotify, with support for Spotify Connect" @@ -103,4 +103,4 @@ assets = [ ] [workspace.package] -rust-version = "1.75" +rust-version = "1.81" diff --git a/contrib/Dockerfile b/contrib/Dockerfile index a36fef88c..a450d6ca0 100644 --- a/contrib/Dockerfile +++ b/contrib/Dockerfile @@ -29,7 +29,7 @@ RUN apt-get install -y curl git build-essential crossbuild-essential-arm64 cross RUN apt-get install -y libasound2-dev libasound2-dev:arm64 libasound2-dev:armel libasound2-dev:armhf RUN apt-get install -y libpulse0 libpulse0:arm64 libpulse0:armel libpulse0:armhf -RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.75 -y +RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.81 -y ENV PATH="/root/.cargo/bin/:${PATH}" RUN rustup target add aarch64-unknown-linux-gnu RUN rustup target add arm-unknown-linux-gnueabi diff --git a/discovery/Cargo.toml b/discovery/Cargo.toml index 39c35a09d..8eac51a5f 100644 --- a/discovery/Cargo.toml +++ b/discovery/Cargo.toml @@ -30,7 +30,7 @@ serde_json = "1.0" sha1 = "0.10" thiserror = "2.0" tokio = { version = "1", features = ["parking_lot", "sync", "rt"] } -zbus = { version = "4", default-features = false, features = ["tokio"], optional = true } # zbus > 4 requires a MSRV of 1.80 +zbus = { version = "5", default-features = false, features = ["tokio"], optional = true } [dependencies.librespot-core] path = "../core" diff --git a/discovery/src/avahi.rs b/discovery/src/avahi.rs index 7c098168e..de720d652 100644 --- a/discovery/src/avahi.rs +++ b/discovery/src/avahi.rs @@ -19,7 +19,7 @@ mod server { default_path = "/", gen_blocking = false )] - trait Server { + pub trait Server { /// EntryGroupNew method #[zbus(object = "super::entry_group::EntryGroup")] fn entry_group_new(&self); @@ -53,9 +53,7 @@ mod entry_group { } impl zvariant::Type for EntryGroupState { - fn signature() -> zvariant::Signature<'static> { - zvariant::Signature::try_from("i").unwrap() - } + const SIGNATURE: &'static zvariant::Signature = &zvariant::Signature::I32; } #[zbus::proxy( @@ -63,7 +61,7 @@ mod entry_group { default_service = "org.freedesktop.Avahi", gen_blocking = false )] - trait EntryGroup { + pub trait EntryGroup { /// AddAddress method fn add_address( &self, diff --git a/playback/Cargo.toml b/playback/Cargo.toml index 433829be8..e24f9868d 100644 --- a/playback/Cargo.toml +++ b/playback/Cargo.toml @@ -34,7 +34,7 @@ alsa = { version = "0.9.0", optional = true } portaudio-rs = { version = "0.3", optional = true } libpulse-binding = { version = "2", optional = true, default-features = false } libpulse-simple-binding = { version = "2", optional = true, default-features = false } -jack = { version = "0.11", optional = true } # jack >0.11 requires a MSRV of 1.80 +jack = { version = "0.13", optional = true } sdl2 = { version = "0.37", optional = true } gstreamer = { version = "0.23.1", optional = true } gstreamer-app = { version = "0.23.0", optional = true } diff --git a/playback/src/audio_backend/jackaudio.rs b/playback/src/audio_backend/jackaudio.rs index 5c7a28fbc..9d40ee82c 100644 --- a/playback/src/audio_backend/jackaudio.rs +++ b/playback/src/audio_backend/jackaudio.rs @@ -47,8 +47,8 @@ impl Open for JackSink { let client_name = client_name.unwrap_or_else(|| "librespot".to_string()); let (client, _status) = Client::new(&client_name[..], ClientOptions::NO_START_SERVER).unwrap(); - let ch_r = client.register_port("out_0", AudioOut).unwrap(); - let ch_l = client.register_port("out_1", AudioOut).unwrap(); + let ch_r = client.register_port("out_0", AudioOut::default()).unwrap(); + let ch_l = client.register_port("out_1", AudioOut::default()).unwrap(); // buffer for samples from librespot (~10ms) let (tx, rx) = sync_channel::(NUM_CHANNELS as usize * 1024 * AudioFormat::F32.size()); let jack_data = JackData {