Fix cyclic dep (#11523)

# Objective

Rust analyzer kept complaining about a cyclic dependency due to
`bevy_input` having a dev-dependency on `bevy`.

`bevy_input` was also missing `bevy_reflect`'s "smol_str" feature which
it needs to compile on its own.

Fixes #10256

## Solution

Remove the dev-dependency on `bevy` from `bevy_input` since it was only
used to reduce imports for 1 test and 3 doc examples by 1 line each, as
`bevy_input` already has dependencies on everything needed for those
tests and doctests to work.

Add `bevy_reflect`'s "smol_str" feature to `bevy_input`'s dependency
list as it needs it to actually compile.
This commit is contained in:
Elabajaba 2024-01-25 12:44:32 -05:00 committed by GitHub
parent 29224768e4
commit cd8dccb8b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 10 deletions

View File

@ -20,6 +20,7 @@ bevy_math = { path = "../bevy_math", version = "0.12.0" }
bevy_utils = { path = "../bevy_utils", version = "0.12.0" } bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [ bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [
"glam", "glam",
"smol_str",
] } ] }
# other # other
@ -27,8 +28,5 @@ serde = { version = "1", features = ["derive"], optional = true }
thiserror = "1.0" thiserror = "1.0"
smol_str = "0.2" smol_str = "0.2"
[dev-dependencies]
bevy = { path = "../../", version = "0.12.0" }
[lints] [lints]
workspace = true workspace = true

View File

@ -5,8 +5,9 @@ use std::hash::Hash;
/// Stateful run condition that can be toggled via a input press using [`ButtonInput::just_pressed`]. /// Stateful run condition that can be toggled via a input press using [`ButtonInput::just_pressed`].
/// ///
/// ```no_run /// ```no_run
/// use bevy::prelude::*; /// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, Update};
/// use bevy::input::common_conditions::input_toggle_active; /// # use bevy_ecs::prelude::IntoSystemConfigs;
/// # use bevy_input::{common_conditions::input_toggle_active, prelude::KeyCode};
/// ///
/// fn main() { /// fn main() {
/// App::new() /// App::new()
@ -23,8 +24,9 @@ use std::hash::Hash;
/// If you want other systems to be able to access whether the toggled state is active, /// If you want other systems to be able to access whether the toggled state is active,
/// you should use a custom resource or a state for that: /// you should use a custom resource or a state for that:
/// ```no_run /// ```no_run
/// use bevy::prelude::*; /// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, Update};
/// use bevy::input::common_conditions::input_just_pressed; /// # use bevy_ecs::prelude::{IntoSystemConfigs, Res, ResMut, Resource};
/// # use bevy_input::{common_conditions::input_just_pressed, prelude::KeyCode};
/// ///
/// #[derive(Resource, Default)] /// #[derive(Resource, Default)]
/// struct Paused(bool); /// struct Paused(bool);
@ -72,8 +74,9 @@ where
/// Run condition that is active if [`ButtonInput::just_pressed`] is true for the given input. /// Run condition that is active if [`ButtonInput::just_pressed`] is true for the given input.
/// ///
/// ```no_run /// ```no_run
/// use bevy::prelude::*; /// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, Update};
/// use bevy::input::common_conditions::input_just_pressed; /// # use bevy_ecs::prelude::IntoSystemConfigs;
/// # use bevy_input::{common_conditions::input_just_pressed, prelude::KeyCode};
/// fn main() { /// fn main() {
/// App::new() /// App::new()
/// .add_plugins(DefaultPlugins) /// .add_plugins(DefaultPlugins)
@ -101,7 +104,8 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use bevy::prelude::{IntoSystemConfigs, KeyCode, Schedule}; use crate::prelude::KeyCode;
use bevy_ecs::schedule::{IntoSystemConfigs, Schedule};
fn test_system() {} fn test_system() {}