From 18debe546d55f92c5d118910c6c0053e75727ad5 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Fri, 1 Sep 2023 09:31:31 +0200 Subject: [PATCH] chore: no default features --- Cargo.toml | 4 +--- justfile | 19 +++++++++++++------ src/lib.rs | 8 ++++++++ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 28c771d..9581498 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,6 @@ edition = "2021" name = "cosmic" [features] -default = ["wayland", "tokio"] # Accessibility support a11y = ["iced/a11y", "iced_accessibility"] # Builds support for animated images @@ -121,6 +120,5 @@ exclude = [ "iced", ] - [patch."https://github.com/pop-os/libcosmic"] -libcosmic = { path = "./", features = ["wayland", "tokio", "a11y"]} +libcosmic = { path = "./" } diff --git a/justfile b/justfile index b83e0cb..08dd2d4 100644 --- a/justfile +++ b/justfile @@ -1,13 +1,20 @@ -projects := 'application cosmic cosmic_sctk design open_dialog' +examples := 'application cosmic cosmic_sctk design open_dialog' # Check for errors and linter warnings -check *args: - cargo clippy --no-deps {{args}} -- -W clippy::pedantic - cargo clippy --no-deps --no-default-features --features="winit,tokio" {{args}} -- -W clippy::pedantic - for project in {{projects}}; do \ - cargo check -p ${project}; \ +check *args: (check-wayland args) (check-winit args) (check-examples args) + +check-examples *args: + #!/bin/bash + for project in {{examples}}; do + cargo check -p ${project} {{args}} done +check-wayland *args: + cargo clippy --no-deps --features="wayland,tokio" {{args}} -- -W clippy::pedantic + +check-winit *args: + cargo clippy --no-deps --features="winit,tokio" {{args}} -- -W clippy::pedantic + # Runs a check with JSON message format for IDE integration check-json: (check '--message-format=json') diff --git a/src/lib.rs b/src/lib.rs index 7e73e10..b2da43e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,12 @@ #![allow(clippy::module_name_repetitions)] +#[cfg(all(not(feature = "wayland"), not(feature = "winit")))] +compile_error!("must define `wayland` or `winit` feature"); + +#[cfg(all(feature = "wayland", feature = "winit"))] +compile_error!("cannot use `wayland` feature with `winit"); + /// Recommended default imports. pub mod prelude { pub use crate::ext::*; @@ -55,3 +61,5 @@ pub mod widget; pub type Renderer = iced::Renderer; pub type Element<'a, Message> = iced::Element<'a, Message, Renderer>; + +