Skip to content

Commit 231894a

Browse files
committed
Lighter no default features (#5447)
# Objective - Even though it's marked as optional, it is no longer possible to not depend on `bevy_render` as it's a dependency of `bevy_scene` ## Solution - Make `bevy_scene` optional - For the minimalist among us, also make `bevy_asset` optional
1 parent a7f2120 commit 231894a

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ members = [
2626
[features]
2727
default = [
2828
"animation",
29+
"bevy_asset",
2930
"bevy_audio",
3031
"bevy_gilrs",
32+
"bevy_scene",
3133
"bevy_winit",
3234
"render",
3335
"png",
@@ -53,13 +55,15 @@ render = [
5355

5456
# Optional bevy crates
5557
bevy_animation = ["bevy_internal/bevy_animation"]
58+
bevy_asset = ["bevy_internal/bevy_asset"]
5659
bevy_audio = ["bevy_internal/bevy_audio"]
5760
bevy_core_pipeline = ["bevy_internal/bevy_core_pipeline"]
5861
bevy_dynamic_plugin = ["bevy_internal/bevy_dynamic_plugin"]
5962
bevy_gilrs = ["bevy_internal/bevy_gilrs"]
6063
bevy_gltf = ["bevy_internal/bevy_gltf"]
6164
bevy_pbr = ["bevy_internal/bevy_pbr"]
6265
bevy_render = ["bevy_internal/bevy_render"]
66+
bevy_scene = ["bevy_internal/bevy_scene"]
6367
bevy_sprite = ["bevy_internal/bevy_sprite"]
6468
bevy_text = ["bevy_internal/bevy_text"]
6569
bevy_ui = ["bevy_internal/bevy_ui"]

crates/bevy_internal/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ animation = ["bevy_animation", "bevy_gltf?/bevy_animation"]
6666
[dependencies]
6767
# bevy
6868
bevy_app = { path = "../bevy_app", version = "0.8.0-dev" }
69-
bevy_asset = { path = "../bevy_asset", version = "0.8.0-dev" }
7069
bevy_core = { path = "../bevy_core", version = "0.8.0-dev" }
7170
bevy_derive = { path = "../bevy_derive", version = "0.8.0-dev" }
7271
bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.8.0-dev" }
@@ -77,20 +76,21 @@ bevy_log = { path = "../bevy_log", version = "0.8.0-dev" }
7776
bevy_math = { path = "../bevy_math", version = "0.8.0-dev" }
7877
bevy_ptr = { path = "../bevy_ptr", version = "0.8.0-dev" }
7978
bevy_reflect = { path = "../bevy_reflect", version = "0.8.0-dev", features = ["bevy"] }
80-
bevy_scene = { path = "../bevy_scene", version = "0.8.0-dev" }
8179
bevy_time = { path = "../bevy_time", version = "0.8.0-dev" }
8280
bevy_transform = { path = "../bevy_transform", version = "0.8.0-dev" }
8381
bevy_utils = { path = "../bevy_utils", version = "0.8.0-dev" }
8482
bevy_window = { path = "../bevy_window", version = "0.8.0-dev" }
8583
bevy_tasks = { path = "../bevy_tasks", version = "0.8.0-dev" }
8684
# bevy (optional)
8785
bevy_animation = { path = "../bevy_animation", optional = true, version = "0.8.0-dev" }
86+
bevy_asset = { path = "../bevy_asset", optional = true, version = "0.8.0-dev" }
8887
bevy_audio = { path = "../bevy_audio", optional = true, version = "0.8.0-dev" }
8988
bevy_core_pipeline = { path = "../bevy_core_pipeline", optional = true, version = "0.8.0-dev" }
9089
bevy_gltf = { path = "../bevy_gltf", optional = true, version = "0.8.0-dev" }
9190
bevy_pbr = { path = "../bevy_pbr", optional = true, version = "0.8.0-dev" }
9291
bevy_render = { path = "../bevy_render", optional = true, version = "0.8.0-dev" }
9392
bevy_dynamic_plugin = { path = "../bevy_dynamic_plugin", optional = true, version = "0.8.0-dev" }
93+
bevy_scene = { path = "../bevy_scene", optional = true, version = "0.8.0-dev" }
9494
bevy_sprite = { path = "../bevy_sprite", optional = true, version = "0.8.0-dev" }
9595
bevy_text = { path = "../bevy_text", optional = true, version = "0.8.0-dev" }
9696
bevy_ui = { path = "../bevy_ui", optional = true, version = "0.8.0-dev" }

crates/bevy_internal/src/default_plugins.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@ impl PluginGroup for DefaultPlugins {
3434
group.add(bevy_diagnostic::DiagnosticsPlugin::default());
3535
group.add(bevy_input::InputPlugin::default());
3636
group.add(bevy_window::WindowPlugin::default());
37+
38+
#[cfg(feature = "bevy_asset")]
3739
group.add(bevy_asset::AssetPlugin::default());
40+
3841
#[cfg(feature = "debug_asset_server")]
3942
group.add(bevy_asset::debug_asset_server::DebugAssetServerPlugin::default());
43+
44+
#[cfg(feature = "bevy_scene")]
4045
group.add(bevy_scene::ScenePlugin::default());
4146

4247
#[cfg(feature = "bevy_winit")]

crates/bevy_internal/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub mod app {
1212
pub use bevy_app::*;
1313
}
1414

15+
#[cfg(feature = "bevy_asset")]
1516
pub mod asset {
1617
//! Load and store assets and resources for Apps.
1718
pub use bevy_asset::*;
@@ -60,6 +61,7 @@ pub mod reflect {
6061
};
6162
}
6263

64+
#[cfg(feature = "bevy_scene")]
6365
pub mod scene {
6466
//! Save/load collections of entities and components to/from file.
6567
pub use bevy_scene::*;

crates/bevy_internal/src/prelude.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#[doc(hidden)]
22
pub use crate::{
3-
app::prelude::*, asset::prelude::*, core::prelude::*, ecs::prelude::*, hierarchy::prelude::*,
4-
input::prelude::*, log::prelude::*, math::prelude::*, reflect::prelude::*, scene::prelude::*,
5-
time::prelude::*, transform::prelude::*, utils::prelude::*, window::prelude::*, DefaultPlugins,
6-
MinimalPlugins,
3+
app::prelude::*, core::prelude::*, ecs::prelude::*, hierarchy::prelude::*, input::prelude::*,
4+
log::prelude::*, math::prelude::*, reflect::prelude::*, time::prelude::*,
5+
transform::prelude::*, utils::prelude::*, window::prelude::*, DefaultPlugins, MinimalPlugins,
76
};
87

98
pub use bevy_derive::{bevy_main, Deref, DerefMut};
109

10+
#[doc(hidden)]
11+
#[cfg(feature = "bevy_asset")]
12+
pub use crate::asset::prelude::*;
13+
1114
#[doc(hidden)]
1215
#[cfg(feature = "bevy_audio")]
1316
pub use crate::audio::prelude::*;
@@ -28,6 +31,10 @@ pub use crate::pbr::prelude::*;
2831
#[cfg(feature = "bevy_render")]
2932
pub use crate::render::prelude::*;
3033

34+
#[doc(hidden)]
35+
#[cfg(feature = "bevy_scene")]
36+
pub use crate::scene::prelude::*;
37+
3138
#[doc(hidden)]
3239
#[cfg(feature = "bevy_sprite")]
3340
pub use crate::sprite::prelude::*;

docs/cargo_features.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
|feature name|description|
66
|-|-|
77
|animation|Animation support and glTF animation loading.|
8+
|bevy_asset|Provides asset functionality for Bevy Engine.|
89
|bevy_audio|Audio support. Support for all audio formats depends on this.|
910
|bevy_gilrs|Adds gamepad support.|
1011
|bevy_gltf|[glTF](https://www.khronos.org/gltf/) support.|
12+
|bevy_scene|Provides scene functionality for Bevy Engine.|
1113
|bevy_winit|GUI support.|
1214
|render|The render pipeline and all render related plugins.|
1315
|png|PNG picture format support.|

0 commit comments

Comments
 (0)