From 55d35fbf78aa1a55dbd1470e52e384cac0c90c0e Mon Sep 17 00:00:00 2001 From: rkuklik Date: Tue, 18 Jun 2024 17:00:40 +0200 Subject: [PATCH 1/5] refactor(workspace): separate project into 3 folders --- Cargo.toml | 55 +++++++++++++--------------------- client/Cargo.toml | 41 +++++++++++++++++++++++++ build.rs => client/build.rs | 2 +- {src => client/src}/cli.rs | 0 {src => client/src}/imgproc.rs | 0 {src => client/src}/main.rs | 0 daemon/Cargo.toml | 21 ++++++++----- utils/Cargo.toml | 22 ++++++++++---- 8 files changed, 92 insertions(+), 49 deletions(-) create mode 100644 client/Cargo.toml rename build.rs => client/build.rs (93%) rename {src => client/src}/cli.rs (100%) rename {src => client/src}/imgproc.rs (100%) rename {src => client/src}/main.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 2bbe76a7..b86a2dd0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,30 @@ [workspace] -members = [".", "daemon", "utils"] -default-members = [".", "daemon"] +resolver = "2" +members = ["client", "daemon", "utils"] +default-members = ["client", "daemon"] -[package] -name = "swww" +[workspace.package] version = "0.9.5-masterV2" authors = ["Leonardo Gibrowski Faé "] edition = "2021" +license-file = "LICENSE" rust-version = "1.75" +[workspace.dependencies] +utils = { path = "utils" } + +[workspace.lints.clippy] +correctness = { level = "deny", priority = -1 } +suspicious = { level = "deny", priority = -1 } +perf = { level = "deny", priority = -1 } +style = { level = "deny", priority = -1 } +complexity = { level = "warn", priority = -1 } +#pedantic = { level = "warn", priority = -1 } + +module-name-repetitions = "allow" +missing-errors-doc = "allow" +missing-panics-doc = "allow" + # Enable some optimizations in debug mode. Otherwise, it is a pain to test it [profile.dev] opt-level = 1 @@ -28,34 +44,3 @@ strip = true lto = "thin" debug = 1 strip = false - -[dependencies] -image = { version = "0.25", default-features = false, features = [ - # all formats, except avif, since avif compiles just rav1d, which is just an - # encoder, which we do not care about - "bmp", - "dds", - "exr", - "ff", - "gif", - "hdr", - "ico", - "jpeg", - "png", - "pnm", - "qoi", - "tga", - "tiff", - "webp", -]} -fast_image_resize = "4.0" -clap = { version = "4.5", features = ["derive", "wrap_help", "env"] } -fastrand = { version = "2.1", default-features = false, features = [ "std" ] } -utils = { version = "0.9.5-masterV2", path = "utils" } - -[dev-dependencies] -assert_cmd = "2.0" - -[build-dependencies] -clap = { version = "4.5", features = ["derive", "env"] } -clap_complete = "4.5" diff --git a/client/Cargo.toml b/client/Cargo.toml new file mode 100644 index 00000000..a7d364c7 --- /dev/null +++ b/client/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "swww" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license-file.workspace = true + +[lints] +workspace = true + +[dependencies] +image = { version = "0.25", default-features = false, features = [ + # all formats, except avif, since avif compiles just rav1d, which is just an + # encoder, which we do not care about + "bmp", + "dds", + "exr", + "ff", + "gif", + "hdr", + "ico", + "jpeg", + "png", + "pnm", + "qoi", + "tga", + "tiff", + "webp", +] } +fast_image_resize = "4.0" +clap = { version = "4.5", features = ["derive", "wrap_help", "env"] } +fastrand = { version = "2.1", default-features = false, features = ["std"] } +utils = { workspace = true } + +[dev-dependencies] +assert_cmd = "2.0" + +[build-dependencies] +clap = { version = "4.5", features = ["derive", "env"] } +clap_complete = "4.5" diff --git a/build.rs b/client/build.rs similarity index 93% rename from build.rs rename to client/build.rs index e278c575..7c97d51d 100644 --- a/build.rs +++ b/client/build.rs @@ -5,7 +5,7 @@ use clap_complete::{generate_to, Shell}; include!("src/cli.rs"); -const COMPLETION_DIR: &str = "completions"; +const COMPLETION_DIR: &str = "../completions"; const APP_NAME: &str = "swww"; fn main() -> Result<(), Error> { diff --git a/src/cli.rs b/client/src/cli.rs similarity index 100% rename from src/cli.rs rename to client/src/cli.rs diff --git a/src/imgproc.rs b/client/src/imgproc.rs similarity index 100% rename from src/imgproc.rs rename to client/src/imgproc.rs diff --git a/src/main.rs b/client/src/main.rs similarity index 100% rename from src/main.rs rename to client/src/main.rs diff --git a/daemon/Cargo.toml b/daemon/Cargo.toml index f7b49091..3f656509 100644 --- a/daemon/Cargo.toml +++ b/daemon/Cargo.toml @@ -1,19 +1,26 @@ [package] name = "swww-daemon" -version = "0.9.5-masterV2" -authors = ["Leonardo Gibrowski Faé "] -edition = "2021" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license-file.workspace = true -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lints] +workspace = true [dependencies] -log = { version = "0.4", default_features = false, features = [ "max_level_debug", "release_max_level_info", "std" ] } +log = { version = "0.4", default-features = false, features = [ + "max_level_debug", + "release_max_level_info", + "std", +] } -rustix = { version = "0.38", default-features = false, features = [ "event" ] } +rustix = { version = "0.38", default-features = false, features = ["event"] } libc = "0.2" keyframe = "1.1" sd-notify = { version = "0.4.1" } -utils = { version = "0.9.5-masterV2", path = "../utils" } +utils = { workspace = true } diff --git a/utils/Cargo.toml b/utils/Cargo.toml index 444df3b6..c42fef0d 100644 --- a/utils/Cargo.toml +++ b/utils/Cargo.toml @@ -1,18 +1,28 @@ [package] name = "utils" -version = "0.9.5-masterV2" -authors = ["Leonardo Gibrowski Faé "] -edition = "2021" -license-file = "../LICENSE" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license-file.workspace = true + +[lints] +workspace = true [dependencies] -rustix = { version = "0.38", default-features = false, features = [ "std", "net", "shm", "mm", "param" ] } +rustix = { version = "0.38", default-features = false, features = [ + "std", + "net", + "shm", + "mm", + "param", +] } [build-dependencies] pkg-config = "0.3" [dev-dependencies] -fastrand = { version = "2.1", default-features = false, features = [ "std" ] } +fastrand = { version = "2.1", default-features = false, features = ["std"] } criterion = { version = "0.5", default-features = false } [[bench]] From 0f1fdfcb251d8137889ab0026c1c3eb6665465c5 Mon Sep 17 00:00:00 2001 From: rkuklik Date: Tue, 18 Jun 2024 17:07:53 +0200 Subject: [PATCH 2/5] refactor(naming): rename utils to common --- Cargo.lock | 24 +++++++++---------- Cargo.toml | 4 ++-- client/Cargo.toml | 2 +- client/src/imgproc.rs | 2 +- client/src/main.rs | 4 ++-- {utils => common}/Cargo.toml | 2 +- {utils => common}/benches/compression.rs | 8 +++---- {utils => common}/build.rs | 0 {utils => common}/src/cache.rs | 0 {utils => common}/src/compression/comp/mod.rs | 0 .../src/compression/comp/sse2.rs | 0 {utils => common}/src/compression/cpu.rs | 0 .../src/compression/decomp/mod.rs | 0 .../src/compression/decomp/ssse3.rs | 0 {utils => common}/src/compression/mod.rs | 0 {utils => common}/src/ipc/mmap.rs | 0 {utils => common}/src/ipc/mod.rs | 0 {utils => common}/src/ipc/socket.rs | 0 {utils => common}/src/ipc/types.rs | 0 {utils => common}/src/lib.rs | 0 daemon/Cargo.toml | 2 +- daemon/src/animations/mod.rs | 2 +- daemon/src/animations/transitions.rs | 4 ++-- daemon/src/cli.rs | 2 +- daemon/src/main.rs | 6 ++--- daemon/src/wallpaper.rs | 4 ++-- daemon/src/wayland/bump_pool.rs | 2 +- daemon/src/wayland/globals.rs | 2 +- tests/spell_check.rs | 2 +- version.sh | 8 +++---- 30 files changed, 40 insertions(+), 40 deletions(-) rename {utils => common}/Cargo.toml (97%) rename {utils => common}/benches/compression.rs (88%) rename {utils => common}/build.rs (100%) rename {utils => common}/src/cache.rs (100%) rename {utils => common}/src/compression/comp/mod.rs (100%) rename {utils => common}/src/compression/comp/sse2.rs (100%) rename {utils => common}/src/compression/cpu.rs (100%) rename {utils => common}/src/compression/decomp/mod.rs (100%) rename {utils => common}/src/compression/decomp/ssse3.rs (100%) rename {utils => common}/src/compression/mod.rs (100%) rename {utils => common}/src/ipc/mmap.rs (100%) rename {utils => common}/src/ipc/mod.rs (100%) rename {utils => common}/src/ipc/socket.rs (100%) rename {utils => common}/src/ipc/types.rs (100%) rename {utils => common}/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 90ee8236..6f51a38f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -241,6 +241,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +[[package]] +name = "common" +version = "0.9.5-masterV2" +dependencies = [ + "criterion", + "fastrand", + "pkg-config", + "rustix", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -831,22 +841,22 @@ dependencies = [ "assert_cmd", "clap", "clap_complete", + "common", "fast_image_resize", "fastrand", "image", - "utils", ] [[package]] name = "swww-daemon" version = "0.9.5-masterV2" dependencies = [ + "common", "keyframe", "libc", "log", "rustix", "sd-notify", - "utils", ] [[package]] @@ -929,16 +939,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "utils" -version = "0.9.5-masterV2" -dependencies = [ - "criterion", - "fastrand", - "pkg-config", - "rustix", -] - [[package]] name = "wait-timeout" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index b86a2dd0..b24316bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "2" -members = ["client", "daemon", "utils"] +members = ["client", "daemon", "common"] default-members = ["client", "daemon"] [workspace.package] @@ -11,7 +11,7 @@ license-file = "LICENSE" rust-version = "1.75" [workspace.dependencies] -utils = { path = "utils" } +common = { path = "common" } [workspace.lints.clippy] correctness = { level = "deny", priority = -1 } diff --git a/client/Cargo.toml b/client/Cargo.toml index a7d364c7..b715e90e 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -31,7 +31,7 @@ image = { version = "0.25", default-features = false, features = [ fast_image_resize = "4.0" clap = { version = "4.5", features = ["derive", "wrap_help", "env"] } fastrand = { version = "2.1", default-features = false, features = ["std"] } -utils = { workspace = true } +common = { workspace = true } [dev-dependencies] assert_cmd = "2.0" diff --git a/client/src/imgproc.rs b/client/src/imgproc.rs index 3e757b69..8ba7b463 100644 --- a/client/src/imgproc.rs +++ b/client/src/imgproc.rs @@ -9,7 +9,7 @@ use std::{ time::Duration, }; -use utils::{ +use common::{ compression::{BitPack, Compressor}, ipc::{self, Coord, PixelFormat, Position}, }; diff --git a/client/src/main.rs b/client/src/main.rs index 49d7ded6..f49f86a2 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -1,7 +1,7 @@ use clap::Parser; use std::time::Duration; -use utils::{ +use common::{ cache, ipc::{self, connect_to_socket, get_socket_path, read_socket, Answer, RequestSend}, }; @@ -266,7 +266,7 @@ fn restore_from_cache(requested_outputs: &[String]) -> Result<(), String> { let (_, _, outputs) = get_format_dims_and_outputs(requested_outputs)?; for output in outputs.iter().flatten() { - let img_path = utils::cache::get_previous_image_path(output) + let img_path = common::cache::get_previous_image_path(output) .map_err(|e| format!("failed to get previous image path: {e}"))?; #[allow(deprecated)] if let Err(e) = process_swww_args(&Swww::Img(cli::Img { diff --git a/utils/Cargo.toml b/common/Cargo.toml similarity index 97% rename from utils/Cargo.toml rename to common/Cargo.toml index c42fef0d..76df47b0 100644 --- a/utils/Cargo.toml +++ b/common/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "utils" +name = "common" version.workspace = true authors.workspace = true edition.workspace = true diff --git a/utils/benches/compression.rs b/common/benches/compression.rs similarity index 88% rename from utils/benches/compression.rs rename to common/benches/compression.rs index bffd6645..35692504 100644 --- a/utils/benches/compression.rs +++ b/common/benches/compression.rs @@ -1,5 +1,5 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use utils::compression::{Compressor, Decompressor}; +use common::compression::{Compressor, Decompressor}; fn generate_data() -> (Box<[u8]>, Box<[u8]>) { let v1 = vec![120; 1920 * 1080 * 3]; @@ -45,7 +45,7 @@ pub fn compression_and_decompression(c: &mut Criterion) { b.iter(|| { black_box( compressor - .compress(&prev, &cur, utils::ipc::PixelFormat::Xrgb) + .compress(&prev, &cur, common::ipc::PixelFormat::Xrgb) .is_some(), ) }) @@ -54,14 +54,14 @@ pub fn compression_and_decompression(c: &mut Criterion) { let mut decomp = c.benchmark_group("decompression 4 channels"); let bitpack = compressor - .compress(&prev, &cur, utils::ipc::PixelFormat::Xrgb) + .compress(&prev, &cur, common::ipc::PixelFormat::Xrgb) .unwrap(); let mut canvas = buf_from(&prev); let mut decompressor = Decompressor::new(); decomp.bench_function("Full", |b| { b.iter(|| { - black_box(decompressor.decompress(&bitpack, &mut canvas, utils::ipc::PixelFormat::Xrgb)) + black_box(decompressor.decompress(&bitpack, &mut canvas, common::ipc::PixelFormat::Xrgb)) }) }); diff --git a/utils/build.rs b/common/build.rs similarity index 100% rename from utils/build.rs rename to common/build.rs diff --git a/utils/src/cache.rs b/common/src/cache.rs similarity index 100% rename from utils/src/cache.rs rename to common/src/cache.rs diff --git a/utils/src/compression/comp/mod.rs b/common/src/compression/comp/mod.rs similarity index 100% rename from utils/src/compression/comp/mod.rs rename to common/src/compression/comp/mod.rs diff --git a/utils/src/compression/comp/sse2.rs b/common/src/compression/comp/sse2.rs similarity index 100% rename from utils/src/compression/comp/sse2.rs rename to common/src/compression/comp/sse2.rs diff --git a/utils/src/compression/cpu.rs b/common/src/compression/cpu.rs similarity index 100% rename from utils/src/compression/cpu.rs rename to common/src/compression/cpu.rs diff --git a/utils/src/compression/decomp/mod.rs b/common/src/compression/decomp/mod.rs similarity index 100% rename from utils/src/compression/decomp/mod.rs rename to common/src/compression/decomp/mod.rs diff --git a/utils/src/compression/decomp/ssse3.rs b/common/src/compression/decomp/ssse3.rs similarity index 100% rename from utils/src/compression/decomp/ssse3.rs rename to common/src/compression/decomp/ssse3.rs diff --git a/utils/src/compression/mod.rs b/common/src/compression/mod.rs similarity index 100% rename from utils/src/compression/mod.rs rename to common/src/compression/mod.rs diff --git a/utils/src/ipc/mmap.rs b/common/src/ipc/mmap.rs similarity index 100% rename from utils/src/ipc/mmap.rs rename to common/src/ipc/mmap.rs diff --git a/utils/src/ipc/mod.rs b/common/src/ipc/mod.rs similarity index 100% rename from utils/src/ipc/mod.rs rename to common/src/ipc/mod.rs diff --git a/utils/src/ipc/socket.rs b/common/src/ipc/socket.rs similarity index 100% rename from utils/src/ipc/socket.rs rename to common/src/ipc/socket.rs diff --git a/utils/src/ipc/types.rs b/common/src/ipc/types.rs similarity index 100% rename from utils/src/ipc/types.rs rename to common/src/ipc/types.rs diff --git a/utils/src/lib.rs b/common/src/lib.rs similarity index 100% rename from utils/src/lib.rs rename to common/src/lib.rs diff --git a/daemon/Cargo.toml b/daemon/Cargo.toml index 3f656509..929b1b70 100644 --- a/daemon/Cargo.toml +++ b/daemon/Cargo.toml @@ -23,4 +23,4 @@ keyframe = "1.1" sd-notify = { version = "0.4.1" } -utils = { workspace = true } +common = { workspace = true } diff --git a/daemon/src/animations/mod.rs b/daemon/src/animations/mod.rs index 5d356199..d0e7c4dc 100644 --- a/daemon/src/animations/mod.rs +++ b/daemon/src/animations/mod.rs @@ -5,7 +5,7 @@ use std::{ thread::{self, Scope}, }; -use utils::{ +use common::{ compression::Decompressor, ipc::{self, Animation, Answer, BgImg, ImgReq}, }; diff --git a/daemon/src/animations/transitions.rs b/daemon/src/animations/transitions.rs index abc83309..595baa72 100644 --- a/daemon/src/animations/transitions.rs +++ b/daemon/src/animations/transitions.rs @@ -4,7 +4,7 @@ use std::{ }; use log::debug; -use utils::ipc::{Position, TransitionType}; +use common::ipc::{Position, TransitionType}; use crate::{ wallpaper::{AnimationToken, Wallpaper}, @@ -35,7 +35,7 @@ impl<'a> Transition<'a> { pub(super) fn new( wallpapers: &'a mut Vec>, dimensions: (u32, u32), - transition: &utils::ipc::Transition, + transition: &common::ipc::Transition, ) -> Self { Transition { animation_tokens: wallpapers diff --git a/daemon/src/cli.rs b/daemon/src/cli.rs index 6f72ef23..79d0227d 100644 --- a/daemon/src/cli.rs +++ b/daemon/src/cli.rs @@ -1,4 +1,4 @@ -use utils::ipc::PixelFormat; +use common::ipc::PixelFormat; pub struct Cli { pub format: Option, diff --git a/daemon/src/main.rs b/daemon/src/main.rs index 7231e510..47f1a253 100644 --- a/daemon/src/main.rs +++ b/daemon/src/main.rs @@ -30,7 +30,7 @@ use std::{ }, }; -use utils::ipc::{ +use common::ipc::{ connect_to_socket, get_socket_path, read_socket, Answer, BgInfo, ImageReq, MmappedStr, RequestRecv, RequestSend, Scale, }; @@ -125,7 +125,7 @@ impl Daemon { } fn recv_socket_msg(&mut self, stream: OwnedFd) { - let bytes = match utils::ipc::read_socket(&stream) { + let bytes = match common::ipc::read_socket(&stream) { Ok(bytes) => bytes, Err(e) => { error!("FATAL: cannot read socket: {e}. Exiting..."); @@ -143,7 +143,7 @@ impl Daemon { .spawn(move || { crate::wallpaper::stop_animations(&wallpapers); for wallpaper in &wallpapers { - wallpaper.set_img_info(utils::ipc::BgImg::Color(clear.color)); + wallpaper.set_img_info(common::ipc::BgImg::Color(clear.color)); wallpaper.clear(clear.color); } crate::wallpaper::attach_buffers_and_damange_surfaces(&wallpapers); diff --git a/daemon/src/wallpaper.rs b/daemon/src/wallpaper.rs index 17160c00..d698850e 100644 --- a/daemon/src/wallpaper.rs +++ b/daemon/src/wallpaper.rs @@ -1,5 +1,5 @@ use log::{debug, error, warn}; -use utils::ipc::{BgImg, BgInfo, Scale}; +use common::ipc::{BgImg, BgInfo, Scale}; use std::{ num::NonZeroI32, @@ -238,7 +238,7 @@ impl Wallpaper { .name("cache loader".to_string()) .stack_size(1 << 14) .spawn(move || { - if let Err(e) = utils::cache::load(&name) { + if let Err(e) = common::cache::load(&name) { warn!("failed to load cache: {e}"); } }) diff --git a/daemon/src/wayland/bump_pool.rs b/daemon/src/wayland/bump_pool.rs index 63630a9a..14a29563 100644 --- a/daemon/src/wayland/bump_pool.rs +++ b/daemon/src/wayland/bump_pool.rs @@ -1,6 +1,6 @@ use std::sync::atomic::{AtomicBool, Ordering}; -use utils::ipc::Mmap; +use common::ipc::Mmap; use super::{globals, ObjectId}; diff --git a/daemon/src/wayland/globals.rs b/daemon/src/wayland/globals.rs index 2316c06b..75bb7a52 100644 --- a/daemon/src/wayland/globals.rs +++ b/daemon/src/wayland/globals.rs @@ -18,7 +18,7 @@ use rustix::{ }; use log::{debug, error, info}; -use utils::ipc::PixelFormat; +use common::ipc::PixelFormat; use super::{ObjectId, ObjectManager, WlDynObj}; use std::{ diff --git a/tests/spell_check.rs b/tests/spell_check.rs index 75ec3ee1..bf13da86 100644 --- a/tests/spell_check.rs +++ b/tests/spell_check.rs @@ -16,7 +16,7 @@ fn spell_check_code_and_man_pages() { "doc/generated", // skip the generated documentation "src", // client "daemon/src", // daemon - "utils/src", // common code + "common/src", // common code "doc", // man pages "example_scripts", // scripts "CHANGELOG.md", diff --git a/version.sh b/version.sh index 19d3fddb..09481772 100755 --- a/version.sh +++ b/version.sh @@ -21,16 +21,16 @@ cargo test --workspace -- --include-ignored # Cargo.toml: sed \ -e "s/^version = .*/version = \"$1\"/" \ - -e "s/^utils.*/utils = { version = \"$1\", path = \"utils\" }/" \ + -e "s/^common.*/common = { version = \"$1\", path = \"common\" }/" \ Cargo.toml > TMP mv -v TMP Cargo.toml -sed "s/^version = .*/version = \"$1\"/" utils/Cargo.toml > TMP -mv -v TMP utils/Cargo.toml +sed "s/^version = .*/version = \"$1\"/" common/Cargo.toml > TMP +mv -v TMP common/Cargo.toml sed \ -e "s/^version = .*/version = \"$1\"/" \ - -e "s/^utils.*/utils = { version = \"$1\", path = \"..\/utils\" }/" \ + -e "s/^common.*/common = { version = \"$1\", path = \"..\/common\" }/" \ daemon/Cargo.toml > TMP mv -v TMP daemon/Cargo.toml From a2252dc799e602e89211bc29b4a755a0ac5f5955 Mon Sep 17 00:00:00 2001 From: rkuklik Date: Tue, 18 Jun 2024 21:37:48 +0200 Subject: [PATCH 3/5] fix(ci): `rust-version` detection and formatting --- .github/workflows/test.yml | 2 +- common/benches/compression.rs | 8 ++++++-- daemon/src/animations/transitions.rs | 2 +- daemon/src/wallpaper.rs | 4 ++-- daemon/src/wayland/globals.rs | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b0e8c0d..07de14ec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: id: msrv with: file: 'Cargo.toml' - field: 'package.rust-version' + field: 'workspace.package.rust-version' - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ steps.msrv.outputs.value }} diff --git a/common/benches/compression.rs b/common/benches/compression.rs index 35692504..b28ecf9d 100644 --- a/common/benches/compression.rs +++ b/common/benches/compression.rs @@ -1,5 +1,5 @@ -use criterion::{black_box, criterion_group, criterion_main, Criterion}; use common::compression::{Compressor, Decompressor}; +use criterion::{black_box, criterion_group, criterion_main, Criterion}; fn generate_data() -> (Box<[u8]>, Box<[u8]>) { let v1 = vec![120; 1920 * 1080 * 3]; @@ -61,7 +61,11 @@ pub fn compression_and_decompression(c: &mut Criterion) { let mut decompressor = Decompressor::new(); decomp.bench_function("Full", |b| { b.iter(|| { - black_box(decompressor.decompress(&bitpack, &mut canvas, common::ipc::PixelFormat::Xrgb)) + black_box(decompressor.decompress( + &bitpack, + &mut canvas, + common::ipc::PixelFormat::Xrgb, + )) }) }); diff --git a/daemon/src/animations/transitions.rs b/daemon/src/animations/transitions.rs index 595baa72..045b2215 100644 --- a/daemon/src/animations/transitions.rs +++ b/daemon/src/animations/transitions.rs @@ -3,8 +3,8 @@ use std::{ time::{Duration, Instant}, }; -use log::debug; use common::ipc::{Position, TransitionType}; +use log::debug; use crate::{ wallpaper::{AnimationToken, Wallpaper}, diff --git a/daemon/src/wallpaper.rs b/daemon/src/wallpaper.rs index d698850e..fb80946f 100644 --- a/daemon/src/wallpaper.rs +++ b/daemon/src/wallpaper.rs @@ -1,5 +1,5 @@ -use log::{debug, error, warn}; use common::ipc::{BgImg, BgInfo, Scale}; +use log::{debug, error, warn}; use std::{ num::NonZeroI32, @@ -487,7 +487,7 @@ pub(crate) fn commit_wallpapers(wallpapers: &[Arc]) { impl Drop for Wallpaper { fn drop(&mut self) { // note we shouldn't panic in a drop implementation - + if let Err(e) = wp_viewport::req::destroy(self.wp_viewport) { error!("error destroying wp_viewport: {e:?}"); } diff --git a/daemon/src/wayland/globals.rs b/daemon/src/wayland/globals.rs index 75bb7a52..8eeb1911 100644 --- a/daemon/src/wayland/globals.rs +++ b/daemon/src/wayland/globals.rs @@ -17,8 +17,8 @@ use rustix::{ net::SocketAddrAny, }; -use log::{debug, error, info}; use common::ipc::PixelFormat; +use log::{debug, error, info}; use super::{ObjectId, ObjectManager, WlDynObj}; use std::{ From b901f9b4ae5567e3f4c69dc6d77882903196bb3b Mon Sep 17 00:00:00 2001 From: rkuklik Date: Tue, 18 Jun 2024 22:30:17 +0200 Subject: [PATCH 4/5] fix(ci): nix build version extraction --- build.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.nix b/build.nix index 5b7ab2de..03e320e3 100644 --- a/build.nix +++ b/build.nix @@ -8,7 +8,7 @@ scdoc, nix-gitignore, }: let - version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version; + version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version; src = nix-gitignore.gitignoreSource [] ./.; in rustPlatform.buildRustPackage { From 18cee57ed8b3e1307d333b621300e35c42f721cc Mon Sep 17 00:00:00 2001 From: rkuklik Date: Tue, 18 Jun 2024 22:32:23 +0200 Subject: [PATCH 5/5] fix(script): update singe file on version change --- Cargo.toml | 1 - version.sh | 14 +------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b24316bc..a547d77c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,4 @@ [workspace] -resolver = "2" members = ["client", "daemon", "common"] default-members = ["client", "daemon"] diff --git a/version.sh b/version.sh index 09481772..709a2f3c 100755 --- a/version.sh +++ b/version.sh @@ -19,21 +19,9 @@ cargo test --workspace -- --include-ignored ./doc/gen.sh # make sure the docs "compile" # Cargo.toml: -sed \ - -e "s/^version = .*/version = \"$1\"/" \ - -e "s/^common.*/common = { version = \"$1\", path = \"common\" }/" \ - Cargo.toml > TMP +sed -e "s/^version = .*/version = \"$1\"/" Cargo.toml > TMP mv -v TMP Cargo.toml -sed "s/^version = .*/version = \"$1\"/" common/Cargo.toml > TMP -mv -v TMP common/Cargo.toml - -sed \ - -e "s/^version = .*/version = \"$1\"/" \ - -e "s/^common.*/common = { version = \"$1\", path = \"..\/common\" }/" \ - daemon/Cargo.toml > TMP -mv -v TMP daemon/Cargo.toml - # CHANGELOG: sed -e "s/^### Unreleased/### $1/" \ -e '1s/^/### Unreleased\n\n\n/' CHANGELOG.md > TMP