From 29973e5d025372842185eccbaa29e8a7e10a9233 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 9 Jun 2022 17:41:37 +0200 Subject: [PATCH] Make document-features an opt-in dependency --- eframe/Cargo.toml | 8 ++++---- eframe/src/lib.rs | 2 +- egui-wgpu/Cargo.toml | 6 +++--- egui-wgpu/src/lib.rs | 2 +- egui-winit/Cargo.toml | 11 +++++++---- egui-winit/src/lib.rs | 2 +- egui/Cargo.toml | 9 +++++---- egui/src/lib.rs | 2 +- egui_demo_lib/Cargo.toml | 7 +++---- egui_demo_lib/src/lib.rs | 2 +- egui_extras/Cargo.toml | 6 +++--- egui_extras/src/lib.rs | 2 +- egui_glium/Cargo.toml | 8 +++++--- egui_glium/src/lib.rs | 2 +- egui_glow/Cargo.toml | 7 ++++--- egui_glow/src/lib.rs | 2 +- emath/Cargo.toml | 6 +++--- emath/src/lib.rs | 2 +- epaint/Cargo.toml | 6 +++--- epaint/src/lib.rs | 2 +- 20 files changed, 50 insertions(+), 44 deletions(-) diff --git a/eframe/Cargo.toml b/eframe/Cargo.toml index 4ff1f94f..6cf84878 100644 --- a/eframe/Cargo.toml +++ b/eframe/Cargo.toml @@ -59,9 +59,6 @@ wgpu = ["dep:wgpu", "egui-wgpu"] [dependencies] -# Needed when generating the docs, but unfortunately also needed by `cargo check` -document-features = "0.2" - egui = { version = "0.18.0", path = "../egui", default-features = false, features = [ "bytemuck", "tracing", @@ -69,6 +66,9 @@ egui = { version = "0.18.0", path = "../egui", default-features = false, feature tracing = "0.1" #! ### Optional dependencies +## Enable this when generating docs. +document-features = { version = "0.2", optional = true } + egui_glow = { version = "0.18.0", path = "../egui_glow", optional = true, default-features = false } egui-wgpu = { version = "0.18.0", path = "../egui-wgpu", optional = true, features = ["winit"] } glow = { version = "0.11", optional = true } @@ -84,7 +84,7 @@ egui-winit = { version = "0.18.0", path = "../egui-winit", default-features = fa glutin = { version = "0.28.0" } winit = "0.26.1" -# optional: +# optional native: puffin = { version = "0.13", optional = true } directories-next = { version = "2", optional = true } diff --git a/eframe/src/lib.rs b/eframe/src/lib.rs index 51e36089..da9036e9 100644 --- a/eframe/src/lib.rs +++ b/eframe/src/lib.rs @@ -54,7 +54,7 @@ //! ``` //! //! ## Feature flags -#![doc = document_features::document_features!()] +#![cfg_attr(feature = "document-features", doc = document_features::document_features!())] //! #![allow(clippy::needless_doctest_main)] diff --git a/egui-wgpu/Cargo.toml b/egui-wgpu/Cargo.toml index c81e1bf8..0b52931f 100644 --- a/egui-wgpu/Cargo.toml +++ b/egui-wgpu/Cargo.toml @@ -33,9 +33,6 @@ winit = ["dep:pollster", "dep:winit"] [dependencies] -# Needed when generating the docs, but unfortunately also needed by `cargo check` -document-features = "0.2" - egui = { version = "0.18.1", path = "../egui", default-features = false, features = [ "bytemuck", ] } @@ -46,5 +43,8 @@ type-map = "0.5.0" wgpu = { version = "0.12", features = ["webgl"] } #! ### Optional dependencies +## Enable this when generating docs. +document-features = { version = "0.2", optional = true } + pollster = { version = "0.2", optional = true } winit = { version = "0.26", optional = true } diff --git a/egui-wgpu/src/lib.rs b/egui-wgpu/src/lib.rs index 9004edcf..2bbfab86 100644 --- a/egui-wgpu/src/lib.rs +++ b/egui-wgpu/src/lib.rs @@ -1,7 +1,7 @@ //! This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [wgpu](https://crates.io/crates/wgpu). //! //! ## Feature flags -#![doc = document_features::document_features!()] +#![cfg_attr(feature = "document-features", doc = document_features::document_features!())] //! #![allow(unsafe_code)] diff --git a/egui-winit/Cargo.toml b/egui-winit/Cargo.toml index 3047c726..8a7bbaa4 100644 --- a/egui-winit/Cargo.toml +++ b/egui-winit/Cargo.toml @@ -41,9 +41,6 @@ serde = ["egui/serde", "dep:serde"] [dependencies] -# Needed when generating the docs, but unfortunately also needed by `cargo check` -document-features = "0.2" - egui = { version = "0.18.0", path = "../egui", default-features = false, features = [ "tracing", ] } @@ -51,13 +48,19 @@ instant = { version = "0.1", features = ["wasm-bindgen"] } # We use instant so w tracing = "0.1" winit = "0.26.1" +#! ### Optional dependencies arboard = { version = "2.1", optional = true, default-features = false } + +## Enable this when generating docs. +document-features = { version = "0.2", optional = true } + puffin = { version = "0.13", optional = true } serde = { version = "1.0", optional = true, features = ["derive"] } -webbrowser = { version = "0.7", optional = true } # feature screen_reader tts = { version = "0.20", optional = true } # stuck on old version due to compilation problems on linux +webbrowser = { version = "0.7", optional = true } + [target.'cfg(any(target_os="linux", target_os="dragonfly", target_os="freebsd", target_os="netbsd", target_os="openbsd"))'.dependencies] smithay-clipboard = { version = "0.6.3", optional = true } diff --git a/egui-winit/src/lib.rs b/egui-winit/src/lib.rs index 23ba3c58..d2ff8227 100644 --- a/egui-winit/src/lib.rs +++ b/egui-winit/src/lib.rs @@ -4,7 +4,7 @@ //! updates the cursor, open links clicked in egui, etc. //! //! ## Feature flags -#![doc = document_features::document_features!()] +#![cfg_attr(feature = "document-features", doc = document_features::document_features!())] //! #![allow(clippy::manual_range_contains)] diff --git a/egui/Cargo.toml b/egui/Cargo.toml index 63865f1b..36eb1808 100644 --- a/egui/Cargo.toml +++ b/egui/Cargo.toml @@ -55,16 +55,17 @@ persistence = ["serde", "epaint/serde", "ron"] serde = ["dep:serde", "epaint/serde"] [dependencies] -# Needed when generating the docs, but unfortunately also needed by `cargo check` -document-features = "0.2" - epaint = { version = "0.18.1", path = "../epaint", default-features = false } ahash = "0.7" nohash-hasher = "0.2" #! ### Optional dependencies +## Enable this when generating docs. +document-features = { version = "0.2", optional = true } + ron = { version = "0.7", optional = true } serde = { version = "1", optional = true, features = ["derive", "rc"] } -# egui doesn't log much, but when it does, it uses `tracing` + +# egui doesn't log much, but when it does, it uses [`tracing`](https://docs.rs/tracing). tracing = { version = "0.1", optional = true } diff --git a/egui/src/lib.rs b/egui/src/lib.rs index ba663de3..a238a75b 100644 --- a/egui/src/lib.rs +++ b/egui/src/lib.rs @@ -293,7 +293,7 @@ //! ``` //! //! ## Feature flags -#![doc = document_features::document_features!()] +#![cfg_attr(feature = "document-features", doc = document_features::document_features!())] //! #![allow(clippy::float_cmp)] diff --git a/egui_demo_lib/Cargo.toml b/egui_demo_lib/Cargo.toml index 54614b2e..0f190174 100644 --- a/egui_demo_lib/Cargo.toml +++ b/egui_demo_lib/Cargo.toml @@ -30,17 +30,16 @@ syntax_highlighting = ["syntect"] [dependencies] -# Needed when generating the docs, but unfortunately also needed by `cargo check` -document-features = "0.2" - egui = { version = "0.18.0", path = "../egui", default-features = false } egui_extras = { version = "0.18.0", path = "../egui_extras" } enum-map = { version = "2", features = ["serde"] } tracing = "0.1" unicode_names2 = { version = "0.5.0", default-features = false } -# Optional: +#! ### Optional dependencies chrono = { version = "0.4", optional = true, features = ["js-sys", "wasmbind"] } +## Enable this when generating docs. +document-features = { version = "0.2", optional = true } serde = { version = "1", optional = true, features = ["derive"] } syntect = { version = "4", optional = true, default-features = false, features = ["default-fancy"] } diff --git a/egui_demo_lib/src/lib.rs b/egui_demo_lib/src/lib.rs index a92d5a5a..e369c1cc 100644 --- a/egui_demo_lib/src/lib.rs +++ b/egui_demo_lib/src/lib.rs @@ -5,7 +5,7 @@ //! The demo is also used in benchmarks and tests. //! //! ## Feature flags -#![doc = document_features::document_features!()] +#![cfg_attr(feature = "document-features", doc = document_features::document_features!())] //! #![allow(clippy::float_cmp)] diff --git a/egui_extras/Cargo.toml b/egui_extras/Cargo.toml index 7389c03a..538131f4 100644 --- a/egui_extras/Cargo.toml +++ b/egui_extras/Cargo.toml @@ -47,6 +47,9 @@ egui = { version = "0.18.0", path = "../egui", default-features = false } # Date operations needed for datepicker widget chrono = { version = "0.4", optional = true } +## Enable this when generating docs. +document-features = { version = "0.2", optional = true } + ## Add support for loading images with the [`image`](https://docs.rs/image) crate. ## ## You also need to ALSO opt-in to the image formats you want to support, like so: @@ -65,6 +68,3 @@ serde = { version = "1", features = ["derive"], optional = true } # feature "tracing" tracing = { version = "0.1", optional = true } - -# Needed when generating the docs, but unfortunately also needed by `cargo check` -document-features = "0.2" diff --git a/egui_extras/src/lib.rs b/egui_extras/src/lib.rs index 156ada1a..1a545b5b 100644 --- a/egui_extras/src/lib.rs +++ b/egui_extras/src/lib.rs @@ -3,7 +3,7 @@ //! This crate are for experimental features, and features that require big dependencies that does not belong in `egui`. //! //! ## Feature flags -#![doc = document_features::document_features!()] +#![cfg_attr(feature = "document-features", doc = document_features::document_features!())] //! #![allow(clippy::float_cmp)] diff --git a/egui_glium/Cargo.toml b/egui_glium/Cargo.toml index ae1ea1d7..83b56999 100644 --- a/egui_glium/Cargo.toml +++ b/egui_glium/Cargo.toml @@ -39,9 +39,6 @@ screen_reader = ["egui-winit/screen_reader"] [dependencies] -# Needed when generating the docs, but unfortunately also needed by `cargo check` -document-features = "0.2" - egui = { version = "0.18.0", path = "../egui", default-features = false, features = [ "bytemuck", ] } @@ -51,5 +48,10 @@ ahash = "0.7" bytemuck = "1.7" glium = "0.31" +#! ### Optional dependencies +## Enable this when generating docs. +document-features = { version = "0.2", optional = true } + + [dev-dependencies] image = { version = "0.24", default-features = false, features = ["png"] } diff --git a/egui_glium/src/lib.rs b/egui_glium/src/lib.rs index dee43b07..a1d02344 100644 --- a/egui_glium/src/lib.rs +++ b/egui_glium/src/lib.rs @@ -5,7 +5,7 @@ //! If you are writing an app, you may want to look at [`eframe`](https://docs.rs/eframe) instead. //! //! ## Feature flags -#![doc = document_features::document_features!()] +#![cfg_attr(feature = "document-features", doc = document_features::document_features!())] //! #![allow(clippy::float_cmp)] diff --git a/egui_glow/Cargo.toml b/egui_glow/Cargo.toml index 3b99bab1..8e6b5276 100644 --- a/egui_glow/Cargo.toml +++ b/egui_glow/Cargo.toml @@ -47,9 +47,6 @@ winit = ["egui-winit",] [dependencies] -# Needed when generating the docs, but unfortunately also needed by `cargo check` -document-features = "0.2" - egui = { version = "0.18.0", path = "../egui", default-features = false, features = [ "bytemuck", ] } @@ -59,6 +56,10 @@ glow = "0.11" memoffset = "0.6" tracing = "0.1" +#! ### Optional dependencies +## Enable this when generating docs. +document-features = { version = "0.2", optional = true } + # Native: [target.'cfg(not(target_arch = "wasm32"))'.dependencies] egui-winit = { version = "0.18.0", path = "../egui-winit", optional = true, default-features = false } diff --git a/egui_glow/src/lib.rs b/egui_glow/src/lib.rs index 4e4f9a06..b5ea0323 100644 --- a/egui_glow/src/lib.rs +++ b/egui_glow/src/lib.rs @@ -5,7 +5,7 @@ //! If you are writing an app, you may want to look at [`eframe`](https://docs.rs/eframe) instead. //! //! ## Feature flags -#![doc = document_features::document_features!()] +#![cfg_attr(feature = "document-features", doc = document_features::document_features!())] //! #![allow(clippy::float_cmp)] diff --git a/emath/Cargo.toml b/emath/Cargo.toml index e96a477d..6918e2ee 100644 --- a/emath/Cargo.toml +++ b/emath/Cargo.toml @@ -34,11 +34,11 @@ extra_asserts = [] ## [`bytemuck`](https://docs.rs/bytemuck) enables you to cast `emath` types to `&[u8]`. bytemuck = { version = "1.7.2", optional = true, features = ["derive"] } +## Enable this when generating docs. +document-features = { version = "0.2", optional = true } + ## [`mint`](https://docs.rs/mint) enables interopability with other math libraries such as [`glam`](https://docs.rs/glam) and [`nalgebra`](https://docs.rs/nalgebra). mint = { version = "0.5.6", optional = true } ## Allow serialization using [`serde`](https://docs.rs/serde). serde = { version = "1", optional = true, features = ["derive"] } - -# Needed when generating the docs, but unfortunately also needed by `cargo check` -document-features = "0.2" diff --git a/emath/src/lib.rs b/emath/src/lib.rs index c81d3ee7..fe129e79 100644 --- a/emath/src/lib.rs +++ b/emath/src/lib.rs @@ -16,7 +16,7 @@ //! and enable the `mint` feature flag in `emath` to enable implicit conversion to/from `emath`. //! //! ## Feature flags -#![doc = document_features::document_features!()] +#![cfg_attr(feature = "document-features", doc = document_features::document_features!())] //! #![allow(clippy::float_cmp)] diff --git a/epaint/Cargo.toml b/epaint/Cargo.toml index 5757c79b..f0dc45bf 100644 --- a/epaint/Cargo.toml +++ b/epaint/Cargo.toml @@ -53,9 +53,6 @@ mint = ["emath/mint"] serde = ["dep:serde", "ahash/serde", "emath/serde"] [dependencies] -# Needed when generating the docs, but unfortunately also needed by `cargo check` -document-features = "0.2" - emath = { version = "0.18.0", path = "../emath" } ab_glyph = "0.2.11" @@ -71,6 +68,9 @@ cint = { version = "0.3.1", optional = true } ## Enable the [`hex_color`] macro. color-hex = { version = "0.2.0", optional = true } +## Enable this when generating docs. +document-features = { version = "0.2", optional = true } + ## Allow serialization using [`serde`](https://docs.rs/serde) . serde = { version = "1", optional = true, features = ["derive", "rc"] } diff --git a/epaint/src/lib.rs b/epaint/src/lib.rs index cd3477b3..e0ba95cd 100644 --- a/epaint/src/lib.rs +++ b/epaint/src/lib.rs @@ -6,7 +6,7 @@ //! that you can then paint using some graphics API of your choice (e.g. OpenGL). //! //! ## Feature flags -#![doc = document_features::document_features!()] +#![cfg_attr(feature = "document-features", doc = document_features::document_features!())] //! #![allow(clippy::float_cmp)]