From 4f11a5eb38242b1a17b07ad8ac02ff1ec8bca3fe Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sun, 29 Nov 2020 18:51:49 +0100 Subject: [PATCH] Clean up feature flags on ruma crate --- ruma/Cargo.toml | 50 ++++++++++++++++++++++++++----------------------- ruma/src/lib.rs | 12 ++++++------ 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/ruma/Cargo.toml b/ruma/Cargo.toml index e596dcdc..5c04e30d 100644 --- a/ruma/Cargo.toml +++ b/ruma/Cargo.toml @@ -12,29 +12,6 @@ license = "MIT" version = "0.0.1" edition = "2018" -[features] -either = ["ruma-identifiers/either"] -rand = ["ruma-identifiers/rand"] -unstable-exhaustive-types = [ - "ruma-events/unstable-exhaustive-types", - "ruma-appservice-api/unstable-exhaustive-types", - "ruma-client-api/unstable-exhaustive-types", - "ruma-federation-api/unstable-exhaustive-types", - "ruma-common/unstable-exhaustive-types", -] -unstable-pre-spec = ["ruma-client-api/unstable-pre-spec", "ruma-events/unstable-pre-spec", "ruma-federation-api/unstable-pre-spec"] -unstable-synapse-quirks = [ - "ruma-client-api/unstable-synapse-quirks", - "ruma-common/unstable-synapse-quirks", - "ruma-events/unstable-synapse-quirks", -] - -appservice-api = ["ruma-api", "ruma-appservice-api", "ruma-events"] -client-api = ["ruma-api", "ruma-client-api", "ruma-events"] -federation-api = ["ruma-api", "ruma-federation-api", "ruma-signatures"] -identity-service-api = ["ruma-api", "ruma-identity-service-api"] -push-gateway-api = ["ruma-api", "ruma-push-gateway-api"] - [dependencies] assign = "1.1.0" js_int = "0.1.9" @@ -52,3 +29,30 @@ ruma-client-api = { version = "=0.10.0-alpha.1", path = "../ruma-client-api", op ruma-federation-api = { version = "0.0.3", path = "../ruma-federation-api", optional = true } ruma-identity-service-api = { version = "0.0.0", path = "../ruma-identity-service-api", optional = true } ruma-push-gateway-api = { version = "0.0.0", path = "../ruma-push-gateway-api", optional = true } + +[features] +either = ["ruma-identifiers/either"] +rand = ["ruma-identifiers/rand"] + +events = ["ruma-events"] +signatures = ["ruma-signatures"] + +appservice-api = ["ruma-api", "ruma-appservice-api", "events"] +client-api = ["ruma-api", "ruma-client-api", "events"] +federation-api = ["ruma-api", "ruma-federation-api", "signatures"] +identity-service-api = ["ruma-api", "ruma-identity-service-api"] +push-gateway-api = ["ruma-api", "ruma-push-gateway-api"] + +unstable-exhaustive-types = [ + "ruma-events/unstable-exhaustive-types", + "ruma-appservice-api/unstable-exhaustive-types", + "ruma-client-api/unstable-exhaustive-types", + "ruma-federation-api/unstable-exhaustive-types", + "ruma-common/unstable-exhaustive-types", +] +unstable-pre-spec = ["ruma-client-api/unstable-pre-spec", "ruma-events/unstable-pre-spec", "ruma-federation-api/unstable-pre-spec"] +unstable-synapse-quirks = [ + "ruma-client-api/unstable-synapse-quirks", + "ruma-common/unstable-synapse-quirks", + "ruma-events/unstable-synapse-quirks", +] diff --git a/ruma/src/lib.rs b/ruma/src/lib.rs index df558749..36dd6fa9 100644 --- a/ruma/src/lib.rs +++ b/ruma/src/lib.rs @@ -32,10 +32,10 @@ pub use ruma_identifiers::{ RoomIdOrAliasId, RoomVersionId, ServerName, ServerSigningKeyId, SigningKeyAlgorithm, UserId, }; -#[cfg(feature = "ruma-events")] +#[cfg(feature = "events")] #[doc(inline)] pub use ruma_events as events; -#[cfg(feature = "ruma-signatures")] +#[cfg(feature = "signatures")] #[doc(inline)] pub use ruma_signatures as signatures; @@ -45,19 +45,19 @@ pub use ruma_signatures as signatures; pub mod api { pub use ruma_api::*; - #[cfg(feature = "ruma-appservice-api")] + #[cfg(feature = "appservice-api")] #[doc(inline)] pub use ruma_appservice_api as appservice; - #[cfg(feature = "ruma-client-api")] + #[cfg(feature = "client-api")] #[doc(inline)] pub use ruma_client_api as client; - #[cfg(feature = "ruma-federation-api")] + #[cfg(feature = "federation-api")] #[doc(inline)] pub use ruma_federation_api as federation; #[cfg(feature = "identity-service-api")] #[doc(inline)] pub use ruma_identity_service_api as identity_service; - #[cfg(feature = "identity-service-api")] + #[cfg(feature = "push-gateway-api")] #[doc(inline)] pub use ruma_push_gateway_api as push_gateway; }