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
This commit is contained in:
François 2022-07-25 15:48:14 +00:00
parent a7f2120c9e
commit 231894a3a6
6 changed files with 26 additions and 6 deletions

View file

@ -26,8 +26,10 @@ members = [
[features]
default = [
"animation",
"bevy_asset",
"bevy_audio",
"bevy_gilrs",
"bevy_scene",
"bevy_winit",
"render",
"png",
@ -53,6 +55,7 @@ render = [
# Optional bevy crates
bevy_animation = ["bevy_internal/bevy_animation"]
bevy_asset = ["bevy_internal/bevy_asset"]
bevy_audio = ["bevy_internal/bevy_audio"]
bevy_core_pipeline = ["bevy_internal/bevy_core_pipeline"]
bevy_dynamic_plugin = ["bevy_internal/bevy_dynamic_plugin"]
@ -60,6 +63,7 @@ bevy_gilrs = ["bevy_internal/bevy_gilrs"]
bevy_gltf = ["bevy_internal/bevy_gltf"]
bevy_pbr = ["bevy_internal/bevy_pbr"]
bevy_render = ["bevy_internal/bevy_render"]
bevy_scene = ["bevy_internal/bevy_scene"]
bevy_sprite = ["bevy_internal/bevy_sprite"]
bevy_text = ["bevy_internal/bevy_text"]
bevy_ui = ["bevy_internal/bevy_ui"]

View file

@ -66,7 +66,6 @@ animation = ["bevy_animation", "bevy_gltf?/bevy_animation"]
[dependencies]
# bevy
bevy_app = { path = "../bevy_app", version = "0.8.0-dev" }
bevy_asset = { path = "../bevy_asset", version = "0.8.0-dev" }
bevy_core = { path = "../bevy_core", version = "0.8.0-dev" }
bevy_derive = { path = "../bevy_derive", version = "0.8.0-dev" }
bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.8.0-dev" }
@ -77,7 +76,6 @@ bevy_log = { path = "../bevy_log", version = "0.8.0-dev" }
bevy_math = { path = "../bevy_math", version = "0.8.0-dev" }
bevy_ptr = { path = "../bevy_ptr", version = "0.8.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.8.0-dev", features = ["bevy"] }
bevy_scene = { path = "../bevy_scene", version = "0.8.0-dev" }
bevy_time = { path = "../bevy_time", version = "0.8.0-dev" }
bevy_transform = { path = "../bevy_transform", version = "0.8.0-dev" }
bevy_utils = { path = "../bevy_utils", version = "0.8.0-dev" }
@ -85,12 +83,14 @@ bevy_window = { path = "../bevy_window", version = "0.8.0-dev" }
bevy_tasks = { path = "../bevy_tasks", version = "0.8.0-dev" }
# bevy (optional)
bevy_animation = { path = "../bevy_animation", optional = true, version = "0.8.0-dev" }
bevy_asset = { path = "../bevy_asset", optional = true, version = "0.8.0-dev" }
bevy_audio = { path = "../bevy_audio", optional = true, version = "0.8.0-dev" }
bevy_core_pipeline = { path = "../bevy_core_pipeline", optional = true, version = "0.8.0-dev" }
bevy_gltf = { path = "../bevy_gltf", optional = true, version = "0.8.0-dev" }
bevy_pbr = { path = "../bevy_pbr", optional = true, version = "0.8.0-dev" }
bevy_render = { path = "../bevy_render", optional = true, version = "0.8.0-dev" }
bevy_dynamic_plugin = { path = "../bevy_dynamic_plugin", optional = true, version = "0.8.0-dev" }
bevy_scene = { path = "../bevy_scene", optional = true, version = "0.8.0-dev" }
bevy_sprite = { path = "../bevy_sprite", optional = true, version = "0.8.0-dev" }
bevy_text = { path = "../bevy_text", optional = true, version = "0.8.0-dev" }
bevy_ui = { path = "../bevy_ui", optional = true, version = "0.8.0-dev" }

View file

@ -34,9 +34,14 @@ impl PluginGroup for DefaultPlugins {
group.add(bevy_diagnostic::DiagnosticsPlugin::default());
group.add(bevy_input::InputPlugin::default());
group.add(bevy_window::WindowPlugin::default());
#[cfg(feature = "bevy_asset")]
group.add(bevy_asset::AssetPlugin::default());
#[cfg(feature = "debug_asset_server")]
group.add(bevy_asset::debug_asset_server::DebugAssetServerPlugin::default());
#[cfg(feature = "bevy_scene")]
group.add(bevy_scene::ScenePlugin::default());
#[cfg(feature = "bevy_winit")]

View file

@ -12,6 +12,7 @@ pub mod app {
pub use bevy_app::*;
}
#[cfg(feature = "bevy_asset")]
pub mod asset {
//! Load and store assets and resources for Apps.
pub use bevy_asset::*;
@ -60,6 +61,7 @@ pub mod reflect {
};
}
#[cfg(feature = "bevy_scene")]
pub mod scene {
//! Save/load collections of entities and components to/from file.
pub use bevy_scene::*;

View file

@ -1,13 +1,16 @@
#[doc(hidden)]
pub use crate::{
app::prelude::*, asset::prelude::*, core::prelude::*, ecs::prelude::*, hierarchy::prelude::*,
input::prelude::*, log::prelude::*, math::prelude::*, reflect::prelude::*, scene::prelude::*,
time::prelude::*, transform::prelude::*, utils::prelude::*, window::prelude::*, DefaultPlugins,
MinimalPlugins,
app::prelude::*, core::prelude::*, ecs::prelude::*, hierarchy::prelude::*, input::prelude::*,
log::prelude::*, math::prelude::*, reflect::prelude::*, time::prelude::*,
transform::prelude::*, utils::prelude::*, window::prelude::*, DefaultPlugins, MinimalPlugins,
};
pub use bevy_derive::{bevy_main, Deref, DerefMut};
#[doc(hidden)]
#[cfg(feature = "bevy_asset")]
pub use crate::asset::prelude::*;
#[doc(hidden)]
#[cfg(feature = "bevy_audio")]
pub use crate::audio::prelude::*;
@ -28,6 +31,10 @@ pub use crate::pbr::prelude::*;
#[cfg(feature = "bevy_render")]
pub use crate::render::prelude::*;
#[doc(hidden)]
#[cfg(feature = "bevy_scene")]
pub use crate::scene::prelude::*;
#[doc(hidden)]
#[cfg(feature = "bevy_sprite")]
pub use crate::sprite::prelude::*;

View file

@ -5,9 +5,11 @@
|feature name|description|
|-|-|
|animation|Animation support and glTF animation loading.|
|bevy_asset|Provides asset functionality for Bevy Engine.|
|bevy_audio|Audio support. Support for all audio formats depends on this.|
|bevy_gilrs|Adds gamepad support.|
|bevy_gltf|[glTF](https://www.khronos.org/gltf/) support.|
|bevy_scene|Provides scene functionality for Bevy Engine.|
|bevy_winit|GUI support.|
|render|The render pipeline and all render related plugins.|
|png|PNG picture format support.|