Skip to content

Commit

Permalink
Remove our 'cyclic' dependencies
Browse files Browse the repository at this point in the history
None of them are remotely necessary, if we import
the trick from bevyengine#2851

This works around rust-lang/rust-analyzer#11410
  • Loading branch information
DJMcNab committed Jul 1, 2022
1 parent cdbabb7 commit f7ecc6e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
3 changes: 0 additions & 3 deletions crates/bevy_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,3 @@ ron = { version = "0.7.0", optional = true }
wasm-bindgen = { version = "0.2" }
web-sys = { version = "0.3", features = [ "Window" ] }

[dev-dependencies]
# bevy
bevy_log = { path = "../bevy_log", version = "0.8.0-dev" }
18 changes: 10 additions & 8 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,13 +784,7 @@ impl App {
///
/// ## Examples
/// ```
/// # use bevy_app::{prelude::*, PluginGroupBuilder};
/// #
/// # // Dummy created to avoid using bevy_internal, which pulls in to many dependencies.
/// # struct MinimalPlugins;
/// # impl PluginGroup for MinimalPlugins {
/// # fn build(&mut self, group: &mut PluginGroupBuilder){;}
/// # }
/// # use bevy_app::{prelude::*, PluginGroupBuilder, NoopPluginGroup as MinimalPlugins};
/// #
/// App::new()
/// .add_plugins(MinimalPlugins);
Expand All @@ -814,7 +808,15 @@ impl App {
/// ```
/// # use bevy_app::{prelude::*, PluginGroupBuilder};
/// #
/// # // Dummies created to avoid using bevy_internal which pulls in too many dependencies.
/// # // Dummies created to avoid using `bevy_internal` and `bevy_log`,
/// # // which pulls in too many dependencies and breaks rust-analyzer
/// # mod bevy_log {
/// # struct LogPlugin;
/// # use bevy_app::prelude::*;
/// # impl Plugin for LogPlugin{
/// # fn build(&self, app: &mut App) {}
/// # }
/// # }
/// # struct DefaultPlugins;
/// # impl PluginGroup for DefaultPlugins {
/// # fn build(&mut self, group: &mut PluginGroupBuilder){
Expand Down
15 changes: 15 additions & 0 deletions crates/bevy_app/src/plugin_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,21 @@ impl PluginGroupBuilder {
}
}

/// A plugin group which doesn't do anything. Useful for examples:
/// ```rust
/// # use bevy_app::prelude::*;
/// use bevy_app::NoopPluginGroup as MinimalPlugins;
///
/// fn main(){
/// App::new().add_plugins(MinimalPlugins).run();
/// }
/// ```
pub struct NoopPluginGroup;

impl PluginGroup for NoopPluginGroup {
fn build(&mut self, _: &mut PluginGroupBuilder) {}
}

#[cfg(test)]
mod tests {
use super::PluginGroupBuilder;
Expand Down
3 changes: 0 additions & 3 deletions crates/bevy_audio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ parking_lot = "0.11.0"
[target.'cfg(target_arch = "wasm32")'.dependencies]
rodio = { version = "0.15", default-features = false, features = ["wasm-bindgen"] }

[dev-dependencies]
# bevy
bevy_internal = { path = "../bevy_internal", version = "0.8.0-dev" }

[features]
mp3 = ["rodio/mp3"]
Expand Down
10 changes: 2 additions & 8 deletions crates/bevy_audio/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
//! Audio support for the game engine Bevy
//!
//! ```
//! ```no_run
//! # use bevy_ecs::{system::Res, event::EventWriter};
//! # use bevy_audio::{Audio, AudioPlugin};
//! # use bevy_asset::{AssetPlugin, AssetServer};
//! # use bevy_app::{App, AppExit};
//! # use bevy_internal::MinimalPlugins;
//! # use bevy_app::{App, AppExit, NoopPluginGroup as MinimalPlugins};;
//! fn main() {
//! App::new()
//! .add_plugins(MinimalPlugins)
//! .add_plugin(AssetPlugin)
//! .add_plugin(AudioPlugin)
//! # .add_system(stop)
//! .add_startup_system(play_background_audio)
//! .run();
//! }
//!
//! fn play_background_audio(asset_server: Res<AssetServer>, audio: Res<Audio>) {
//! audio.play(asset_server.load("background_audio.ogg"));
//! }
//!
//! # fn stop(mut events: EventWriter<AppExit>) {
//! # events.send(AppExit)
//! # }
//! ```

#![forbid(unsafe_code)]
Expand Down
3 changes: 0 additions & 3 deletions crates/bevy_log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,3 @@ android_log-sys = "0.2.0"
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.6"
tracing-wasm = "0.2.1"

[dev-dependencies]
bevy_internal = { path = "../bevy_internal", version = "0.8.0-dev" }
6 changes: 2 additions & 4 deletions crates/bevy_log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ use tracing_subscriber::{prelude::*, registry::Registry, EnvFilter};
///
/// You can configure this plugin using the resource [`LogSettings`].
/// ```no_run
/// # use bevy_internal::DefaultPlugins;
/// # use bevy_app::App;
/// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins};
/// # use bevy_log::LogSettings;
/// # use bevy_utils::tracing::Level;
/// fn main() {
Expand All @@ -72,8 +71,7 @@ use tracing_subscriber::{prelude::*, registry::Registry, EnvFilter};
/// If you want to setup your own tracing collector, you should disable this
/// plugin from `DefaultPlugins` with [`App::add_plugins_with`]:
/// ```no_run
/// # use bevy_internal::DefaultPlugins;
/// # use bevy_app::App;
/// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins};
/// # use bevy_log::LogPlugin;
/// fn main() {
/// App::new()
Expand Down

0 comments on commit f7ecc6e

Please sign in to comment.