Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change bevy_internal to be a 'thinner facade' #2851

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 56 additions & 128 deletions crates/bevy_internal/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,143 +1,71 @@
/// `use bevy::prelude::*;` to import common components, bundles, and plugins.
pub mod prelude;

mod default_plugins;
#[doc(hidden)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does #![doc(hidden)] at the top of the file work? And should it even be hidden at all if most users likely won't look at the docs of this crate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, maybe it not being hidden would be fine? The #![doc(hidden)] at the top of the file would also hide MinimalPlugins and DefaultPlugins

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 log {
//! Logging capabilities
pub use bevy_log::*;
}

pub mod math {
//! Math types (Vec3, Mat4, Quat, etc) and helpers.
pub use bevy_math::*;
}

pub mod reflect {
// TODO: remove these renames once TypeRegistryArc is no longer required
//! Type reflection used for dynamically interacting with rust types.
pub use bevy_reflect::{
TypeRegistry as TypeRegistryInternal, TypeRegistryArc as TypeRegistry, *,
};
}

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 utils {
pub use bevy_utils::*;
}

pub mod window {
//! Configuration, creation, and management of one or more windows.
pub use bevy_window::*;
}

#[doc(hidden)]
pub use bevy_app;
#[doc(hidden)]
pub use bevy_asset;
#[cfg(feature = "bevy_audio")]
pub mod audio {
//! Provides types and plugins for audio playback.
pub use bevy_audio::*;
}

#[doc(hidden)]
pub use bevy_audio;
#[doc(hidden)]
pub use bevy_core;
#[doc(hidden)]
pub use bevy_derive;
#[doc(hidden)]
pub use bevy_diagnostic;
#[cfg(feature = "bevy_dynamic_plugin")]
#[doc(hidden)]
pub use bevy_dynamic_plugin;
#[doc(hidden)]
pub use bevy_ecs;
#[cfg(feature = "bevy_gilrs")]
pub mod gilrs {
pub use bevy_gilrs::*;
}

#[doc(hidden)]
pub use bevy_gilrs;
#[cfg(feature = "bevy_gltf")]
pub mod gltf {
//! Support for GLTF file loading.
pub use bevy_gltf::*;
}

#[doc(hidden)]
pub use bevy_gltf;
#[doc(hidden)]
pub use bevy_input;
#[doc(hidden)]
pub use bevy_log;
#[doc(hidden)]
pub use bevy_math;
#[cfg(feature = "bevy_pbr")]
pub mod pbr {
//! Physically based rendering.
pub use bevy_pbr::*;
}

#[doc(hidden)]
pub use bevy_pbr;
#[doc(hidden)]
pub use bevy_reflect;
#[cfg(feature = "bevy_render")]
pub mod render {
//! Cameras, meshes, textures, shaders, and pipelines.
pub use bevy_render::*;
}

#[doc(hidden)]
pub use bevy_render;
#[doc(hidden)]
pub use bevy_scene;
#[cfg(feature = "bevy_sprite")]
pub mod sprite {
//! Items for sprites, rects, texture atlases, etc.
pub use bevy_sprite::*;
}

#[doc(hidden)]
pub use bevy_sprite;
#[doc(hidden)]
pub use bevy_tasks;
#[cfg(feature = "bevy_text")]
pub mod text {
//! Text drawing, styling, and font assets.
pub use bevy_text::*;
}

#[doc(hidden)]
pub use bevy_text;
#[doc(hidden)]
pub use bevy_transform;
#[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::*;
}

#[doc(hidden)]
pub use bevy_ui;
#[doc(hidden)]
pub use bevy_utils;
#[cfg(feature = "bevy_wgpu")]
pub mod wgpu {
//! A render backend utilizing [wgpu](https://wgpu.rs/).
pub use bevy_wgpu::*;
}

#[cfg(feature = "bevy_dynamic_plugin")]
pub mod dynamic_plugin {
pub use bevy_dynamic_plugin::*;
}
#[doc(hidden)]
pub use bevy_wgpu;
#[doc(hidden)]
pub use bevy_window;
#[cfg(feature = "bevy_winit")]
#[doc(hidden)]
pub use bevy_winit;

#[cfg(target_os = "android")]
#[doc(hidden)]
pub use ndk_glue;
6 changes: 3 additions & 3 deletions crates/bevy_log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ keywords = ["bevy"]
bevy_app = { path = "../bevy_app", version = "0.5.0" }
bevy_utils = { path = "../bevy_utils", version = "0.5.0" }

tracing-subscriber = {version = "0.2.22", features = ["registry"]}
tracing-subscriber = { version = "0.2.22", features = ["registry"] }
tracing-chrome = { version = "0.3.1", optional = true }
tracing-tracy = { version = "0.7.0", optional = true }

Expand All @@ -24,5 +24,5 @@ android_log-sys = "0.2.0"
console_error_panic_hook = "0.1.6"
tracing-wasm = "0.2"

[dev-dependencies]
bevy_internal = { path = "../bevy_internal", version = "0.5.0" }
# [dev-dependencies]
# bevy_internal = { path = "../bevy_internal", version = "0.5.0" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure - I was checking out whether bevy_internal was used, and it's used for a doctest in here.

Not sure why I even commented it out to be honest...

17 changes: 10 additions & 7 deletions crates/bevy_macro_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,19 @@ impl Default for BevyManifest {
impl BevyManifest {
pub fn get_path(&self, name: &str) -> syn::Path {
const BEVY: &str = "bevy";
const BEVY_INTERNAL: &str = "bevy_internal";

let is_bevy = self
.manifest
.package
.as_ref()
.map(|it| it.name == BEVY)
.unwrap_or(false);

let find_in_deps = |deps: &DepsSet| -> Option<syn::Path> {
let package = if let Some(dep) = deps.get(BEVY) {
dep.package().unwrap_or(BEVY)
} else if let Some(dep) = deps.get(BEVY_INTERNAL) {
dep.package().unwrap_or(BEVY_INTERNAL)
let package = if is_bevy {
BEVY
} else {
return None;
deps.get(BEVY)?.package().unwrap_or(BEVY)
};

let mut path = get_path(package);
Expand All @@ -42,7 +46,6 @@ impl BevyManifest {
}
Some(path)
};

let deps = self.manifest.dependencies.as_ref();
let deps_dev = self.manifest.dev_dependencies.as_ref();

Expand Down
Loading