diff --git a/Cargo.toml b/Cargo.toml index 16ee7690147c6..c9f1fe4bb1135 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,102 +3,88 @@ name = "bevy" version = "0.3.0" edition = "2018" authors = [ - "Bevy Contributors ", - "Carter Anderson ", + "Bevy Contributors ", + "Carter Anderson ", ] +categories = ["game-engines", "graphics", "gui", "rendering"] description = "A refreshingly simple data-driven game engine and app framework" +exclude = ["assets/**/*", "tools/**/*", ".github/**/*", "crates/**/*"] homepage = "https://bevyengine.org" -repository = "https://github.com/bevyengine/bevy" -license = "MIT" keywords = ["game", "engine", "gamedev", "graphics", "bevy"] -categories = ["game-engines", "graphics", "gui", "rendering"] -readme = "README.md" -exclude = ["assets/**/*", "tools/**/*", ".github/**/*", "crates/**/*"] +license = "MIT" +repository = "https://github.com/bevyengine/bevy" + +[workspace] +exclude = ["benches"] +members = ["crates/*", "crates/bevy_ecs/hecs", "examples/ios"] [features] default = [ - "bevy_audio", - "bevy_dynamic_plugin", - "bevy_gilrs", - "bevy_gltf", - "bevy_wgpu", - "bevy_winit", - "render", - "png", - "hdr", - "mp3", - "x11", + "bevy_audio", + "bevy_dynamic_plugin", + "bevy_gilrs", + "bevy_gltf", + "bevy_wgpu", + "bevy_winit", + "render", + "png", + "hdr", + "mp3", + "x11", ] -profiler = ["bevy_ecs/profiler", "bevy_diagnostic/profiler"] -wgpu_trace = ["bevy_wgpu/trace"] +# Force dynamic linking, which improves iterative compile times +dynamic = ["bevy_dylib"] # Rendering support -render = ["bevy_pbr", "bevy_render", "bevy_sprite", "bevy_text", "bevy_ui"] +render = ["bevy_internal/bevy_pbr", "bevy_internal/bevy_render", "bevy_internal/bevy_sprite", "bevy_internal/bevy_text", "bevy_internal/bevy_ui"] + +# Optional bevy crates +bevy_audio = ["bevy_internal/bevy_audio"] +bevy_dynamic_plugin = ["bevy_internal/bevy_dynamic_plugin"] +bevy_gilrs = ["bevy_internal/bevy_gilrs"] +bevy_gltf = ["bevy_internal/bevy_gltf"] +bevy_wgpu = ["bevy_internal/bevy_wgpu"] +bevy_winit = ["bevy_internal/bevy_winit"] + +profiler = ["bevy_internal/profiler"] +wgpu_trace = ["bevy_internal/wgpu_trace"] + # Image format support for texture loading (PNG and HDR are enabled by default) -png = ["bevy_render/png"] -hdr = ["bevy_render/hdr"] +hdr = ["bevy_internal/hdr"] +png = ["bevy_internal/png"] # Audio format support (MP3 is enabled by default) -mp3 = ["bevy_audio/mp3"] -flac = ["bevy_audio/flac"] -wav = ["bevy_audio/wav"] -vorbis = ["bevy_audio/vorbis"] +flac = ["bevy_internal/flac"] +mp3 = ["bevy_internal/mp3"] +vorbis = ["bevy_internal/vorbis"] +wav = ["bevy_internal/wav"] -serialize = ["bevy_input/serialize"] +serialize = ["bevy_internal/serialize"] # Display server protocol support (X11 is enabled by default) -wayland = ["bevy_winit/wayland"] -x11 = ["bevy_winit/x11"] - -[workspace] -members = ["crates/*", "crates/bevy_ecs/hecs", "examples/ios"] -exclude = ["benches"] +wayland = ["bevy_internal/wayland"] +x11 = ["bevy_internal/x11"] [dependencies] -# bevy -bevy_app = { path = "crates/bevy_app", version = "0.3.0" } -bevy_asset = { path = "crates/bevy_asset", version = "0.3.0" } -bevy_type_registry = { path = "crates/bevy_type_registry", version = "0.3.0" } -bevy_core = { path = "crates/bevy_core", version = "0.3.0" } -bevy_diagnostic = { path = "crates/bevy_diagnostic", version = "0.3.0" } -bevy_ecs = { path = "crates/bevy_ecs", version = "0.3.0" } -bevy_input = { path = "crates/bevy_input", version = "0.3.0" } -bevy_math = { path = "crates/bevy_math", version = "0.3.0" } -bevy_property = { path = "crates/bevy_property", version = "0.3.0" } -bevy_scene = { path = "crates/bevy_scene", version = "0.3.0" } -bevy_transform = { path = "crates/bevy_transform", version = "0.3.0" } -bevy_utils = { path = "crates/bevy_utils", version = "0.3.0" } -bevy_window = { path = "crates/bevy_window", version = "0.3.0" } -bevy_tasks = { path = "crates/bevy_tasks", version = "0.3.0" } -# bevy (optional) -bevy_audio = { path = "crates/bevy_audio", optional = true, version = "0.3.0" } -bevy_gltf = { path = "crates/bevy_gltf", optional = true, version = "0.3.0" } -bevy_pbr = { path = "crates/bevy_pbr", optional = true, version = "0.3.0" } -bevy_render = { path = "crates/bevy_render", optional = true, version = "0.3.0" } -bevy_dynamic_plugin = { path = "crates/bevy_dynamic_plugin", optional = true, version = "0.3.0" } -bevy_sprite = { path = "crates/bevy_sprite", optional = true, version = "0.3.0" } -bevy_text = { path = "crates/bevy_text", optional = true, version = "0.3.0" } -bevy_ui = { path = "crates/bevy_ui", optional = true, version = "0.3.0" } -bevy_wgpu = { path = "crates/bevy_wgpu", optional = true, version = "0.3.0" } -bevy_winit = { path = "crates/bevy_winit", optional = true, version = "0.3.0" } -bevy_gilrs = { path = "crates/bevy_gilrs", optional = true, version = "0.3.0" } +bevy_dylib = {path = "crates/bevy_dylib", version = "0.3.0", default-features = false, optional = true} +bevy_internal = {path = "crates/bevy_internal", version = "0.3.0", default-features = false} [dev-dependencies] -rand = "0.7.3" -serde = { version = "1", features = ["derive"] } +anyhow = "1.0" log = "0.4" +rand = "0.7.3" ron = "0.6" -anyhow = "1.0" +serde = {version = "1", features = ["derive"]} # bevy (Android) [target.'cfg(target_os = "android")'.dependencies] -ndk-glue = { version = "0.2", features = ["logger"] } android_logger = "0.9" +ndk-glue = {version = "0.2", features = ["logger"]} [target.'cfg(target_arch = "wasm32")'.dev-dependencies] console_error_panic_hook = "0.1.6" -console_log = { version = "0.2", features = ["color"] } +console_log = {version = "0.2", features = ["color"]} [[example]] name = "hello_world" @@ -333,11 +319,11 @@ path = "examples/wasm/assets_wasm.rs" required-features = ["bevy_winit"] [[example]] +crate-type = ["cdylib"] name = "android" path = "examples/android/android.rs" -crate-type = ["cdylib"] [package.metadata.android] build_targets = ["aarch64-linux-android", "armv7-linux-androideabi"] -target_sdk_version = 29 min_sdk_version = 16 +target_sdk_version = 29 diff --git a/crates/bevy_derive/Cargo.toml b/crates/bevy_derive/Cargo.toml index 59cf68bdca8e1..552912d02bf89 100644 --- a/crates/bevy_derive/Cargo.toml +++ b/crates/bevy_derive/Cargo.toml @@ -17,7 +17,7 @@ proc-macro = true [dependencies] Inflector = { version = "0.11.4", default-features = false } -proc-macro-crate = "0.1.5" +find-crate = "0.5" proc-macro2 = "1.0" quote = "1.0" syn = "1.0" diff --git a/crates/bevy_derive/src/modules.rs b/crates/bevy_derive/src/modules.rs index 91596242f09bc..c343be3e6e53c 100644 --- a/crates/bevy_derive/src/modules.rs +++ b/crates/bevy_derive/src/modules.rs @@ -1,5 +1,5 @@ +use find_crate::Manifest; use proc_macro::TokenStream; -use proc_macro_crate::crate_name; use syn::{Attribute, Path}; #[derive(Debug)] @@ -12,13 +12,13 @@ pub struct Modules { } impl Modules { - pub fn meta() -> Modules { + pub fn meta(name: &str) -> Modules { Modules { - bevy_asset: "bevy::asset".to_string(), - bevy_render: "bevy::render".to_string(), - bevy_core: "bevy::core".to_string(), - bevy_app: "bevy::app".to_string(), - bevy_type_registry: "bevy::type_registry".to_string(), + bevy_asset: format!("{}::asset", name), + bevy_render: format!("{}::render", name), + bevy_core: format!("{}::core", name), + bevy_app: format!("{}::app", name), + bevy_type_registry: format!("{}::type_registry", name), } } @@ -33,19 +33,21 @@ impl Modules { } } -fn use_meta() -> bool { - crate_name("bevy").is_ok() +fn get_meta() -> Option { + let manifest = Manifest::new().unwrap(); + if let Some(package) = manifest.find(|name| name == "bevy") { + Some(Modules::meta(&package.name)) + } else if let Some(package) = manifest.find(|name| name == "bevy_internal") { + Some(Modules::meta(&package.name)) + } else { + None + } } const AS_CRATE_ATTRIBUTE_NAME: &str = "as_crate"; pub fn get_modules(attributes: &[Attribute]) -> Modules { - let mut modules = if use_meta() { - Modules::meta() - } else { - Modules::external() - }; - + let mut modules = get_meta().unwrap_or_else(Modules::external); for attribute in attributes.iter() { if *attribute.path.get_ident().as_ref().unwrap() == AS_CRATE_ATTRIBUTE_NAME { let value = attribute.tokens.to_string(); diff --git a/crates/bevy_dylib/Cargo.toml b/crates/bevy_dylib/Cargo.toml new file mode 100644 index 0000000000000..cd2d3de5e7c2b --- /dev/null +++ b/crates/bevy_dylib/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "bevy_dylib" +version = "0.3.0" +edition = "2018" +authors = [ + "Bevy Contributors ", + "Carter Anderson ", +] +description = "Force the Bevy Engine to be dynamically linked for faster linking" +homepage = "https://bevyengine.org" +repository = "https://github.com/bevyengine/bevy" +license = "MIT" +keywords = ["bevy"] + +[lib] +crate-type = ["dylib"] + +[dependencies] +bevy_internal = { path = "../bevy_internal", version = "0.3.0", default-features = false } diff --git a/crates/bevy_dylib/src/lib.rs b/crates/bevy_dylib/src/lib.rs new file mode 100644 index 0000000000000..9cea45597b66e --- /dev/null +++ b/crates/bevy_dylib/src/lib.rs @@ -0,0 +1,12 @@ +//! Forces dynamic linking of Bevy. +//! +//! Dynamically linking Bevy makes the "link" step much faster. This can be achieved by adding +//! `bevy_dylib` as dependency and `#[allow(unused_imports)] use bevy_dylib` to `main.rs`. It is +//! recommended to disable the `bevy_dylib` dependency in release mode by adding +//! `#[cfg(debug_assertions)]` to the `use` statement. Otherwise you will have to ship `libstd.so` +//! and `libbevy_dylib.so` with your game. + +// Force linking of the main bevy crate +#[allow(unused_imports)] +#[allow(clippy::single_component_path_imports)] +use bevy_internal; diff --git a/crates/bevy_ecs/hecs/macros/Cargo.toml b/crates/bevy_ecs/hecs/macros/Cargo.toml index 0796c61d29338..de487b768fe7f 100644 --- a/crates/bevy_ecs/hecs/macros/Cargo.toml +++ b/crates/bevy_ecs/hecs/macros/Cargo.toml @@ -13,4 +13,4 @@ proc-macro = true syn = "1.0" quote = "1.0" proc-macro2 = "1.0" -proc-macro-crate = "0.1.5" +find-crate = "0.5" \ No newline at end of file diff --git a/crates/bevy_ecs/hecs/macros/src/lib.rs b/crates/bevy_ecs/hecs/macros/src/lib.rs index 4e541ba187888..b5e054b70db19 100644 --- a/crates/bevy_ecs/hecs/macros/src/lib.rs +++ b/crates/bevy_ecs/hecs/macros/src/lib.rs @@ -18,9 +18,9 @@ extern crate proc_macro; use std::borrow::Cow; +use find_crate::Manifest; use proc_macro::TokenStream; use proc_macro2::{Span, TokenStream as TokenStream2}; -use proc_macro_crate::crate_name; use quote::quote; use syn::{ parse::ParseStream, parse_macro_input, Data, DataStruct, DeriveInput, Error, Field, Fields, @@ -54,12 +54,13 @@ fn derive_bundle_(input: DeriveInput) -> Result { } }; let (tys, field_members) = struct_fields(&data.fields); - let path_str = if crate_name("bevy").is_ok() { - "bevy::ecs" - } else if crate_name("bevy_ecs").is_ok() { - "bevy_ecs" + let manifest = Manifest::new().unwrap(); + let path_str = if let Some(package) = manifest.find(|name| name == "bevy") { + format!("{}::ecs", package.name) + } else if let Some(package) = manifest.find(|name| name == "bevy_ecs") { + package.name } else { - "bevy_hecs" + "bevy_hecs".to_string() }; let crate_path: Path = syn::parse(path_str.parse::().unwrap()).unwrap(); let field_idents = member_as_idents(&field_members); @@ -354,10 +355,11 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream { _ => panic!("expected a struct with named fields"), }; - let path_str = if crate_name("bevy").is_ok() { - "bevy::ecs" + let manifest = Manifest::new().unwrap(); + let path_str = if let Some(package) = manifest.find(|name| name == "bevy") { + format!("{}::ecs", package.name) } else { - "bevy_ecs" + "bevy_ecs".to_string() }; let path: Path = syn::parse(path_str.parse::().unwrap()).unwrap(); diff --git a/crates/bevy_internal/Cargo.toml b/crates/bevy_internal/Cargo.toml new file mode 100644 index 0000000000000..6452cd49b343e --- /dev/null +++ b/crates/bevy_internal/Cargo.toml @@ -0,0 +1,64 @@ +[package] +name = "bevy_internal" +version = "0.3.0" +edition = "2018" +authors = [ + "Bevy Contributors ", + "Carter Anderson ", +] +description = "An internal Bevy crate used to facilitate optional dynamic linking via the 'dynamic' feature" +homepage = "https://bevyengine.org" +repository = "https://github.com/bevyengine/bevy" +license = "MIT" +keywords = ["game", "engine", "gamedev", "graphics", "bevy"] +categories = ["game-engines", "graphics", "gui", "rendering"] + +[features] +profiler = ["bevy_ecs/profiler", "bevy_diagnostic/profiler"] +wgpu_trace = ["bevy_wgpu/trace"] + +# Image format support for texture loading (PNG and HDR are enabled by default) +hdr = ["bevy_render/hdr"] +png = ["bevy_render/png"] + +# Audio format support (MP3 is enabled by default) +flac = ["bevy_audio/flac"] +mp3 = ["bevy_audio/mp3"] +vorbis = ["bevy_audio/vorbis"] +wav = ["bevy_audio/wav"] + +serialize = ["bevy_input/serialize"] + +# Display server protocol support (X11 is enabled by default) +wayland = ["bevy_winit/wayland"] +x11 = ["bevy_winit/x11"] + +[dependencies] +# bevy +bevy_app = { path = "../bevy_app", version = "0.3.0" } +bevy_asset = { path = "../bevy_asset", version = "0.3.0" } +bevy_type_registry = { path = "../bevy_type_registry", version = "0.3.0" } +bevy_core = { path = "../bevy_core", version = "0.3.0" } +bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.3.0" } +bevy_ecs = { path = "../bevy_ecs", version = "0.3.0" } +bevy_input = { path = "../bevy_input", version = "0.3.0" } +bevy_math = { path = "../bevy_math", version = "0.3.0" } +bevy_property = { path = "../bevy_property", version = "0.3.0" } +bevy_scene = { path = "../bevy_scene", version = "0.3.0" } +bevy_transform = { path = "../bevy_transform", version = "0.3.0" } +bevy_utils = { path = "../bevy_utils", version = "0.3.0" } +bevy_window = { path = "../bevy_window", version = "0.3.0" } +bevy_tasks = { path = "../bevy_tasks", version = "0.3.0" } +# bevy (optional) +bevy_audio = { path = "../bevy_audio", optional = true, version = "0.3.0" } +bevy_gltf = { path = "../bevy_gltf", optional = true, version = "0.3.0" } +bevy_pbr = { path = "../bevy_pbr", optional = true, version = "0.3.0" } +bevy_render = { path = "../bevy_render", optional = true, version = "0.3.0" } +bevy_dynamic_plugin = { path = "../bevy_dynamic_plugin", optional = true, version = "0.3.0" } +bevy_sprite = { path = "../bevy_sprite", optional = true, version = "0.3.0" } +bevy_text = { path = "../bevy_text", optional = true, version = "0.3.0" } +bevy_ui = { path = "../bevy_ui", optional = true, version = "0.3.0" } +bevy_wgpu = { path = "../bevy_wgpu", optional = true, version = "0.3.0" } +bevy_winit = { path = "../bevy_winit", optional = true, version = "0.3.0" } +bevy_gilrs = { path = "../bevy_gilrs", optional = true, version = "0.3.0" } + diff --git a/src/default_plugins.rs b/crates/bevy_internal/src/default_plugins.rs similarity index 100% rename from src/default_plugins.rs rename to crates/bevy_internal/src/default_plugins.rs diff --git a/crates/bevy_internal/src/lib.rs b/crates/bevy_internal/src/lib.rs new file mode 100644 index 0000000000000..0872432f55125 --- /dev/null +++ b/crates/bevy_internal/src/lib.rs @@ -0,0 +1,133 @@ +/// `use bevy::prelude::*;` to import common components, bundles, and plugins. +pub mod prelude; + +mod default_plugins; +pub use default_plugins::*; + +pub mod app { + //! Build bevy apps, create plugins, and read events. + pub use bevy_app::*; +} + +pub mod asset { + //! Load and store assets and resources for Apps. + pub use bevy_asset::*; +} + +pub mod core { + //! Contains core plugins and utilities for time. + pub use bevy_core::*; +} + +pub mod diagnostic { + //! Useful diagnostic plugins and types for bevy apps. + pub use bevy_diagnostic::*; +} + +pub mod ecs { + //! Bevy's entity-component-system. + pub use bevy_ecs::*; +} + +pub mod input { + //! Resources and events for inputs, e.g. mouse/keyboard, touch, gamepads, etc. + pub use bevy_input::*; +} + +pub mod math { + //! Math types (Vec3, Mat4, Quat, etc) and helpers. + pub use bevy_math::*; +} + +pub mod property { + //! Dynamically interact with struct fields and names. + pub use bevy_property::*; +} + +pub mod scene { + //! Save/load collections of entities and components to/from file. + pub use bevy_scene::*; +} + +pub mod tasks { + //! Pools for async, IO, and compute tasks. + pub use bevy_tasks::*; +} + +pub mod transform { + //! Local and global transforms (e.g. translation, scale, rotation). + pub use bevy_transform::*; +} + +pub mod type_registry { + //! Registered types and components can be used when loading scenes. + pub use bevy_type_registry::*; +} + +pub mod utils { + pub use bevy_utils::*; +} + +pub mod window { + //! Configuration, creation, and management of one or more windows. + pub use bevy_window::*; +} + +#[cfg(feature = "bevy_audio")] +pub mod audio { + //! Provides types and plugins for audio playback. + pub use bevy_audio::*; +} + +#[cfg(feature = "bevy_gltf")] +pub mod gltf { + //! Support for GLTF file loading. + pub use bevy_gltf::*; +} + +#[cfg(feature = "bevy_pbr")] +pub mod pbr { + //! Physically based rendering. + //! **Note**: true PBR has not yet been implemented; the name `pbr` is aspirational. + pub use bevy_pbr::*; +} + +#[cfg(feature = "bevy_render")] +pub mod render { + //! Cameras, meshes, textures, shaders, and pipelines. + pub use bevy_render::*; +} + +#[cfg(feature = "bevy_sprite")] +pub mod sprite { + //! Items for sprites, rects, texture atlases, etc. + pub use bevy_sprite::*; +} + +#[cfg(feature = "bevy_text")] +pub mod text { + //! Text drawing, styling, and font assets. + pub use bevy_text::*; +} + +#[cfg(feature = "bevy_ui")] +pub mod ui { + //! User interface components and widgets. + pub use bevy_ui::*; +} + +#[cfg(feature = "bevy_winit")] +pub mod winit { + pub use bevy_winit::*; +} + +#[cfg(feature = "bevy_wgpu")] +pub mod wgpu { + //! A render backend utilizing [wgpu](https://github.com/gfx-rs/wgpu-rs). + pub use bevy_wgpu::*; +} + +#[cfg(feature = "bevy_dynamic_plugin")] +pub mod dynamic_plugin { + pub use bevy_dynamic_plugin::*; +} diff --git a/src/prelude.rs b/crates/bevy_internal/src/prelude.rs similarity index 100% rename from src/prelude.rs rename to crates/bevy_internal/src/prelude.rs diff --git a/crates/bevy_property/bevy_property_derive/Cargo.toml b/crates/bevy_property/bevy_property_derive/Cargo.toml index 529d0846ae009..0468aea134eca 100644 --- a/crates/bevy_property/bevy_property_derive/Cargo.toml +++ b/crates/bevy_property/bevy_property_derive/Cargo.toml @@ -19,4 +19,4 @@ proc-macro = true syn = "1.0" proc-macro2 = "1.0" quote = "1.0" -proc-macro-crate = "0.1.5" +find-crate = "0.5" diff --git a/crates/bevy_property/bevy_property_derive/src/lib.rs b/crates/bevy_property/bevy_property_derive/src/lib.rs index bbdd211410e42..6b16fda9048ea 100644 --- a/crates/bevy_property/bevy_property_derive/src/lib.rs +++ b/crates/bevy_property/bevy_property_derive/src/lib.rs @@ -2,9 +2,9 @@ extern crate proc_macro; mod modules; +use find_crate::Manifest; use modules::{get_modules, get_path}; use proc_macro::TokenStream; -use proc_macro_crate::crate_name; use quote::quote; use syn::{ parse::{Parse, ParseStream}, @@ -344,13 +344,15 @@ impl Parse for PropertyDef { pub fn impl_property(input: TokenStream) -> TokenStream { let property_def = parse_macro_input!(input as PropertyDef); - let bevy_property_path = get_path(if crate_name("bevy").is_ok() { - "bevy::property" - } else if crate_name("bevy_property").is_ok() { - "bevy_property" + let manifest = Manifest::new().unwrap(); + let crate_path = if let Some(package) = manifest.find(|name| name == "bevy") { + format!("{}::property", package.name) + } else if let Some(package) = manifest.find(|name| name == "bevy_property") { + package.name } else { - "crate" - }); + "crate".to_string() + }; + let bevy_property_path = get_path(&crate_path); let (impl_generics, ty_generics, where_clause) = property_def.generics.split_for_impl(); let ty = &property_def.type_name; diff --git a/crates/bevy_property/bevy_property_derive/src/modules.rs b/crates/bevy_property/bevy_property_derive/src/modules.rs index cb3e53c2fa6a9..a549f9b90a2b9 100644 --- a/crates/bevy_property/bevy_property_derive/src/modules.rs +++ b/crates/bevy_property/bevy_property_derive/src/modules.rs @@ -1,5 +1,5 @@ +use find_crate::Manifest; use proc_macro::TokenStream; -use proc_macro_crate::crate_name; use syn::Path; #[derive(Debug)] @@ -8,9 +8,9 @@ pub struct Modules { } impl Modules { - pub fn meta() -> Modules { + pub fn meta(name: &str) -> Modules { Modules { - bevy_property: "bevy::property".to_string(), + bevy_property: format!("{}::property", name), } } @@ -21,16 +21,19 @@ impl Modules { } } -fn use_meta() -> bool { - crate_name("bevy").is_ok() +fn get_meta() -> Option { + let manifest = Manifest::new().unwrap(); + if let Some(package) = manifest.find(|name| name == "bevy") { + Some(Modules::meta(&package.name)) + } else if let Some(package) = manifest.find(|name| name == "bevy_internal") { + Some(Modules::meta(&package.name)) + } else { + None + } } pub fn get_modules() -> Modules { - if use_meta() { - Modules::meta() - } else { - Modules::external() - } + get_meta().unwrap_or_else(Modules::external) } pub fn get_path(path_str: &str) -> Path { diff --git a/examples/input/gamepad_input.rs b/examples/input/gamepad_input.rs index bd920262e8f61..dccf64b2def26 100644 --- a/examples/input/gamepad_input.rs +++ b/examples/input/gamepad_input.rs @@ -1,6 +1,8 @@ -use bevy::prelude::*; -use bevy_input::gamepad::{Gamepad, GamepadButton, GamepadEvent, GamepadEventType}; -use bevy_utils::HashSet; +use bevy::{ + input::gamepad::{Gamepad, GamepadButton, GamepadEvent, GamepadEventType}, + prelude::*, + utils::HashSet, +}; fn main() { App::build() diff --git a/examples/input/gamepad_input_events.rs b/examples/input/gamepad_input_events.rs index fc685b2aad187..3f4db960d718f 100644 --- a/examples/input/gamepad_input_events.rs +++ b/examples/input/gamepad_input_events.rs @@ -1,5 +1,7 @@ -use bevy::prelude::*; -use bevy_input::gamepad::{GamepadEvent, GamepadEventType}; +use bevy::{ + input::gamepad::{GamepadEvent, GamepadEventType}, + prelude::*, +}; fn main() { App::build() diff --git a/src/lib.rs b/src/lib.rs index c3f8893919e80..9c602e8244360 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,136 +39,9 @@ html_favicon_url = "https://bevyengine.org/assets/icon.png" )] -/// `use bevy::prelude::*;` to import common components, bundles, and plugins. -pub mod prelude; +pub use bevy_internal::*; -mod default_plugins; -pub use default_plugins::*; - -pub mod app { - //! Build bevy apps, create plugins, and read events. - pub use bevy_app::*; -} - -pub mod asset { - //! Load and store assets and resources for Apps. - pub use bevy_asset::*; -} - -pub mod core { - //! Contains core plugins and utilities for time. - pub use bevy_core::*; -} - -pub mod diagnostic { - //! Useful diagnostic plugins and types for bevy apps. - pub use bevy_diagnostic::*; -} - -pub mod ecs { - //! Bevy's entity-component-system. - pub use bevy_ecs::*; -} - -pub mod input { - //! Resources and events for inputs, e.g. mouse/keyboard, touch, gamepads, etc. - pub use bevy_input::*; -} - -pub mod math { - //! Math types (Vec3, Mat4, Quat, etc) and helpers. - pub use bevy_math::*; -} - -pub mod property { - //! Dynamically interact with struct fields and names. - pub use bevy_property::*; -} - -pub mod scene { - //! Save/load collections of entities and components to/from file. - pub use bevy_scene::*; -} - -pub mod tasks { - //! Pools for async, IO, and compute tasks. - pub use bevy_tasks::*; -} - -pub mod transform { - //! Local and global transforms (e.g. translation, scale, rotation). - pub use bevy_transform::*; -} - -pub mod type_registry { - //! Registered types and components can be used when loading scenes. - pub use bevy_type_registry::*; -} - -pub mod utils { - pub use bevy_utils::*; -} - -pub mod window { - //! Configuration, creation, and management of one or more windows. - pub use bevy_window::*; -} - -#[cfg(feature = "bevy_audio")] -pub mod audio { - //! Provides types and plugins for audio playback. - pub use bevy_audio::*; -} - -#[cfg(feature = "bevy_gltf")] -pub mod gltf { - //! Support for GLTF file loading. - pub use bevy_gltf::*; -} - -#[cfg(feature = "bevy_pbr")] -pub mod pbr { - //! Physically based rendering. - //! **Note**: true PBR has not yet been implemented; the name `pbr` is aspirational. - pub use bevy_pbr::*; -} - -#[cfg(feature = "bevy_render")] -pub mod render { - //! Cameras, meshes, textures, shaders, and pipelines. - pub use bevy_render::*; -} - -#[cfg(feature = "bevy_sprite")] -pub mod sprite { - //! Items for sprites, rects, texture atlases, etc. - pub use bevy_sprite::*; -} - -#[cfg(feature = "bevy_text")] -pub mod text { - //! Text drawing, styling, and font assets. - pub use bevy_text::*; -} - -#[cfg(feature = "bevy_ui")] -pub mod ui { - //! User interface components and widgets. - pub use bevy_ui::*; -} - -#[cfg(feature = "bevy_winit")] -pub mod winit { - pub use bevy_winit::*; -} - -#[cfg(feature = "bevy_wgpu")] -pub mod wgpu { - //! A render backend utilizing [wgpu](https://github.com/gfx-rs/wgpu-rs). - pub use bevy_wgpu::*; -} - -#[cfg(feature = "bevy_dynamic_plugin")] -pub mod dynamic_plugin { - pub use bevy_dynamic_plugin::*; -} +#[cfg(feature = "dynamic")] +#[allow(unused_imports)] +#[allow(clippy::single_component_path_imports)] +use bevy_dylib;