From 589c52afe5d434dd339bd2d9d61dd8514dd7a458 Mon Sep 17 00:00:00 2001 From: Christopher Durham Date: Thu, 26 May 2022 02:04:22 +0000 Subject: [PATCH] Make bevy_app's optional bevy_reflect dependency actually optional (#4846) # Objective - Make bevy_app's optional bevy_reflect dependency actually optional - Because bevy_ecs has a default dependency on bevy_reflect, bevy_app includes bevy_reflect transitively even with default-features=false, despite the optional dependency indicating that it was intended to be able to leave out bevy_reflect. ## Solution - Make bevy_app not enable bevy_ecs's default features, and then use [the `dep:` syntax](https://doc.rust-lang.org/cargo/reference/features.html#optional-dependencies) introduced in 1.60 to make the default bevy_reflect feature enable bevy_ecs's bevy_reflect feature/dependency. --- ## Changelog - bevy_app no longer enables bevy_ecs's `bevy_reflect` feature when included without its own `bevy_reflect` feature (which is on by default). --- crates/bevy_app/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/bevy_app/Cargo.toml b/crates/bevy_app/Cargo.toml index 602dd466e7..e386e00c2d 100644 --- a/crates/bevy_app/Cargo.toml +++ b/crates/bevy_app/Cargo.toml @@ -12,11 +12,12 @@ keywords = ["bevy"] trace = [] bevy_ci_testing = ["serde", "ron"] default = ["bevy_reflect"] +bevy_reflect = ["dep:bevy_reflect", "bevy_ecs/bevy_reflect"] [dependencies] # bevy bevy_derive = { path = "../bevy_derive", version = "0.8.0-dev" } -bevy_ecs = { path = "../bevy_ecs", version = "0.8.0-dev" } +bevy_ecs = { path = "../bevy_ecs", version = "0.8.0-dev", default-features = false } bevy_reflect = { path = "../bevy_reflect", version = "0.8.0-dev", optional = true } bevy_utils = { path = "../bevy_utils", version = "0.8.0-dev" }