remove most "optional" bevy features

This commit is contained in:
Carter Anderson 2020-06-05 00:50:37 -07:00
parent 5ea979dd0e
commit 75218be117
4 changed files with 59 additions and 134 deletions

View file

@ -5,26 +5,7 @@ authors = ["Carter Anderson <mcanders1@gmail.com>"]
edition = "2018" edition = "2018"
[features] [features]
default = ["headless", "wgpu", "winit"] default = ["bevy_wgpu", "bevy_winit"]
headless = ["asset", "type_registry", "core", "derive", "diagnostic", "gltf", "input", "pbr", "property", "render", "scene", "sprite", "text", "transform", "ui", "window"]
asset = ["bevy_asset"]
core = ["bevy_core"]
type_registry = ["bevy_type_registry"]
derive = ["bevy_derive"]
diagnostic = ["bevy_diagnostic"]
gltf = ["bevy_gltf"]
input = ["bevy_input"]
pbr = ["bevy_pbr"]
property = ["bevy_property"]
render = ["bevy_render"]
scene = ["bevy_scene"]
sprite = ["bevy_sprite"]
text = ["bevy_text"]
transform = ["bevy_transform"]
ui = ["bevy_ui"]
window = ["bevy_window"]
wgpu = ["bevy_wgpu"]
winit = ["bevy_winit"]
more-system-fns = ["legion/more-system-fns"] more-system-fns = ["legion/more-system-fns"]
[workspace] [workspace]
@ -40,22 +21,22 @@ exclude = [
[dependencies] [dependencies]
# bevy # bevy
bevy_app = { path = "crates/bevy_app" } bevy_app = { path = "crates/bevy_app" }
bevy_asset = { path = "crates/bevy_asset", optional = true } bevy_asset = { path = "crates/bevy_asset" }
bevy_type_registry = { path = "crates/bevy_type_registry", optional = true } bevy_type_registry = { path = "crates/bevy_type_registry" }
bevy_core = { path = "crates/bevy_core", optional = true } bevy_core = { path = "crates/bevy_core" }
bevy_derive = { path = "crates/bevy_derive", optional = true } bevy_derive = { path = "crates/bevy_derive" }
bevy_diagnostic = { path = "crates/bevy_diagnostic", optional = true } bevy_diagnostic = { path = "crates/bevy_diagnostic" }
bevy_gltf = { path = "crates/bevy_gltf", optional = true } bevy_gltf = { path = "crates/bevy_gltf" }
bevy_input = { path = "crates/bevy_input", optional = true } bevy_input = { path = "crates/bevy_input" }
bevy_pbr = { path = "crates/bevy_pbr", optional = true } bevy_pbr = { path = "crates/bevy_pbr" }
bevy_property = { path = "crates/bevy_property", optional = true } bevy_property = { path = "crates/bevy_property" }
bevy_render = { path = "crates/bevy_render", optional = true } bevy_render = { path = "crates/bevy_render" }
bevy_scene = { path = "crates/bevy_scene", optional = true } bevy_scene = { path = "crates/bevy_scene" }
bevy_sprite = { path = "crates/bevy_sprite", optional = true } bevy_sprite = { path = "crates/bevy_sprite" }
bevy_transform = { path = "crates/bevy_transform", optional = true } bevy_transform = { path = "crates/bevy_transform" }
bevy_text = { path = "crates/bevy_text", optional = true } bevy_text = { path = "crates/bevy_text" }
bevy_ui = { path = "crates/bevy_ui", optional = true } bevy_ui = { path = "crates/bevy_ui" }
bevy_window = { path = "crates/bevy_window", optional = true } bevy_window = { path = "crates/bevy_window" }
bevy_wgpu = { path = "crates/bevy_wgpu", optional = true } bevy_wgpu = { path = "crates/bevy_wgpu", optional = true }
bevy_winit = { path = "crates/bevy_winit", optional = true } bevy_winit = { path = "crates/bevy_winit", optional = true }
legion = { path = "crates/bevy_legion" } legion = { path = "crates/bevy_legion" }

View file

@ -6,51 +6,26 @@ pub trait AddDefaultPlugins {
impl AddDefaultPlugins for AppBuilder { impl AddDefaultPlugins for AppBuilder {
fn add_default_plugins(&mut self) -> &mut Self { fn add_default_plugins(&mut self) -> &mut Self {
#[cfg(feature = "type_registry")]
self.add_plugin(bevy_type_registry::TypeRegistryPlugin::default()); self.add_plugin(bevy_type_registry::TypeRegistryPlugin::default());
#[cfg(feature = "core")]
self.add_plugin(bevy_core::CorePlugin::default()); self.add_plugin(bevy_core::CorePlugin::default());
#[cfg(feature = "diagnostic")]
self.add_plugin(bevy_diagnostic::DiagnosticsPlugin::default()); self.add_plugin(bevy_diagnostic::DiagnosticsPlugin::default());
#[cfg(feature = "input")]
self.add_plugin(bevy_input::InputPlugin::default()); self.add_plugin(bevy_input::InputPlugin::default());
#[cfg(feature = "window")]
self.add_plugin(bevy_window::WindowPlugin::default()); self.add_plugin(bevy_window::WindowPlugin::default());
#[cfg(feature = "asset")]
self.add_plugin(bevy_asset::AssetPlugin::default()); self.add_plugin(bevy_asset::AssetPlugin::default());
#[cfg(feature = "scene")]
self.add_plugin(bevy_scene::ScenePlugin::default()); self.add_plugin(bevy_scene::ScenePlugin::default());
#[cfg(feature = "render")]
self.add_plugin(bevy_render::RenderPlugin::default()); self.add_plugin(bevy_render::RenderPlugin::default());
#[cfg(feature = "sprite")]
self.add_plugin(bevy_sprite::SpritePlugin::default()); self.add_plugin(bevy_sprite::SpritePlugin::default());
#[cfg(feature = "pbr")]
self.add_plugin(bevy_pbr::PbrPlugin::default()); self.add_plugin(bevy_pbr::PbrPlugin::default());
#[cfg(feature = "ui")]
self.add_plugin(bevy_ui::UiPlugin::default()); self.add_plugin(bevy_ui::UiPlugin::default());
#[cfg(feature = "gltf")]
self.add_plugin(bevy_gltf::GltfPlugin::default()); self.add_plugin(bevy_gltf::GltfPlugin::default());
#[cfg(feature = "text")]
self.add_plugin(bevy_text::TextPlugin::default()); self.add_plugin(bevy_text::TextPlugin::default());
#[cfg(feature = "winit")] #[cfg(feature = "bevy_winit")]
self.add_plugin(bevy_winit::WinitPlugin::default()); self.add_plugin(bevy_winit::WinitPlugin::default());
#[cfg(not(feature = "winit"))] #[cfg(not(feature = "bevy_winit"))]
self.add_plugin(bevy_app::schedule_runner::ScheduleRunnerPlugin::default()); self.add_plugin(bevy_app::schedule_runner::ScheduleRunnerPlugin::default());
#[cfg(feature = "wgpu")] #[cfg(feature = "bevy_wgpu")]
self.add_plugin(bevy_wgpu::WgpuPlugin::default()); self.add_plugin(bevy_wgpu::WgpuPlugin::default());
self self

View file

@ -47,39 +47,23 @@ pub use bevy_app as app;
pub use glam as math; pub use glam as math;
pub use legion; pub use legion;
#[cfg(feature = "asset")]
pub use bevy_asset as asset; pub use bevy_asset as asset;
#[cfg(feature = "core")]
pub use bevy_core as core; pub use bevy_core as core;
#[cfg(feature = "derive")]
pub use bevy_derive as derive; pub use bevy_derive as derive;
#[cfg(feature = "diagnostic")]
pub use bevy_diagnostic as diagnostic; pub use bevy_diagnostic as diagnostic;
#[cfg(feature = "gltf")]
pub use bevy_gltf as gltf; pub use bevy_gltf as gltf;
#[cfg(feature = "input")]
pub use bevy_input as input; pub use bevy_input as input;
#[cfg(feature = "pbr")]
pub use bevy_pbr as pbr; pub use bevy_pbr as pbr;
#[cfg(feature = "property")]
pub use bevy_property as property; pub use bevy_property as property;
#[cfg(feature = "render")]
pub use bevy_render as render; pub use bevy_render as render;
#[cfg(feature = "scene")]
pub use bevy_scene as scene; pub use bevy_scene as scene;
#[cfg(feature = "sprite")]
pub use bevy_sprite as sprite; pub use bevy_sprite as sprite;
#[cfg(feature = "text")]
pub use bevy_text as text; pub use bevy_text as text;
#[cfg(feature = "transform")]
pub use bevy_transform as transform; pub use bevy_transform as transform;
#[cfg(feature = "type_registry")]
pub use bevy_type_registry as type_registry; pub use bevy_type_registry as type_registry;
#[cfg(feature = "ui")]
pub use bevy_ui as ui; pub use bevy_ui as ui;
#[cfg(feature = "wgpu")]
pub use bevy_wgpu as wgpu;
#[cfg(feature = "window")]
pub use bevy_window as window; pub use bevy_window as window;
#[cfg(feature = "winit")] #[cfg(feature = "bevy_wgpu")]
pub use bevy_wgpu as wgpu;
#[cfg(feature = "bevy_winit")]
pub use bevy_winit as winit; pub use bevy_winit as winit;

View file

@ -1,60 +1,45 @@
#[cfg(feature = "asset")]
pub use crate::asset::{AddAsset, AssetEvent, AssetServer, Assets, Handle};
#[cfg(feature = "core")]
pub use crate::core::{
time::{Time, Timer},
transform::{CommandBufferBuilderSource, WorldBuilder, WorldBuilderSource},
};
#[cfg(feature = "derive")]
pub use crate::derive::*;
#[cfg(feature = "diagnostic")]
pub use crate::diagnostic::DiagnosticsPlugin;
#[cfg(feature = "input")]
pub use crate::input::{Input, mouse::MouseButton, keyboard::KeyCode};
#[cfg(feature = "pbr")]
pub use crate::pbr::{entity::*, light::Light, material::StandardMaterial};
#[cfg(feature = "property")]
pub use crate::property::{DynamicProperties, Properties, PropertiesVal, Property, PropertyVal};
#[cfg(feature = "render")]
pub use crate::render::{
draw_target,
entity::*,
mesh::{shape, Mesh},
pipeline::PipelineDescriptor,
render_graph::{
nodes::{
AssetUniformNode, CameraNode, PassNode, UniformNode, WindowSwapChainNode,
WindowTextureNode,
},
RenderGraph,
},
shader::{Shader, ShaderDefSuffixProvider, ShaderStage, ShaderStages},
texture::{Texture, TextureType},
Camera, Color, ColorSource, OrthographicProjection, PerspectiveProjection, Renderable,
};
#[cfg(feature = "scene")]
pub use crate::scene::{Scene, SceneSpawner};
#[cfg(feature = "sprite")]
pub use crate::sprite::{
entity::{SpriteEntity, SpriteSheetEntity},
ColorMaterial, Quad, Sprite, SpriteSheet, SpriteSheetSprite,
};
#[cfg(feature = "text")]
pub use crate::text::Font;
#[cfg(feature = "transform")]
pub use crate::transform::prelude::*;
#[cfg(feature = "type_registry")]
pub use crate::type_registry::RegisterType;
#[cfg(feature = "ui")]
pub use crate::ui::{entity::*, widget::Label, Anchors, Margins, Node};
#[cfg(feature = "window")]
pub use crate::window::{Window, WindowDescriptor, WindowPlugin, Windows};
pub use crate::{ pub use crate::{
app::{ app::{
schedule_runner::ScheduleRunnerPlugin, stage, App, AppBuilder, AppPlugin, EntityArchetype, schedule_runner::ScheduleRunnerPlugin, stage, App, AppBuilder, AppPlugin, EntityArchetype,
EventReader, Events, FromResources, System, EventReader, Events, FromResources, System,
}, },
asset::{AddAsset, AssetEvent, AssetServer, Assets, Handle},
core::{
time::{Time, Timer},
transform::{CommandBufferBuilderSource, WorldBuilder, WorldBuilderSource},
},
derive::*,
diagnostic::DiagnosticsPlugin,
input::{keyboard::KeyCode, mouse::MouseButton, Input},
math::{self, Mat3, Mat4, Quat, Vec2, Vec3, Vec4}, math::{self, Mat3, Mat4, Quat, Vec2, Vec3, Vec4},
pbr::{entity::*, light::Light, material::StandardMaterial},
property::{DynamicProperties, Properties, PropertiesVal, Property, PropertyVal},
render::{
draw_target,
entity::*,
mesh::{shape, Mesh},
pipeline::PipelineDescriptor,
render_graph::{
nodes::{
AssetUniformNode, CameraNode, PassNode, UniformNode, WindowSwapChainNode,
WindowTextureNode,
},
RenderGraph,
},
shader::{Shader, ShaderDefSuffixProvider, ShaderStage, ShaderStages},
texture::{Texture, TextureType},
Camera, Color, ColorSource, OrthographicProjection, PerspectiveProjection, Renderable,
},
scene::{Scene, SceneSpawner},
sprite::{
entity::{SpriteEntity, SpriteSheetEntity},
ColorMaterial, Quad, Sprite, SpriteSheet, SpriteSheetSprite,
},
text::Font,
transform::prelude::*,
type_registry::RegisterType,
ui::{entity::*, widget::Label, Anchors, Margins, Node},
window::{Window, WindowDescriptor, WindowPlugin, Windows},
AddDefaultPlugins, AddDefaultPlugins,
}; };
pub use legion::{ pub use legion::{