mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Add bevy_dev_tools crate (#11341)
# Objective - Resolves #11309 ## Solution - Add `bevy_dev_tools` crate as a default feature. - Add `DevToolsPlugin` and add it to an app if the `bevy_dev_tools` feature is enabled. `bevy_dev_tools` is reserved by @alice-i-cecile, should we wait until it gets transferred to cart before merging? --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: BD103 <59022059+BD103@users.noreply.github.com>
This commit is contained in:
parent
13d37c534f
commit
6533170e94
16 changed files with 99 additions and 16 deletions
|
@ -155,6 +155,9 @@ bevy_winit = ["bevy_internal/bevy_winit"]
|
|||
# Adds support for rendering gizmos
|
||||
bevy_gizmos = ["bevy_internal/bevy_gizmos", "bevy_color"]
|
||||
|
||||
# Provides a collection of developer tools
|
||||
bevy_dev_tools = ["bevy_internal/bevy_dev_tools"]
|
||||
|
||||
# Tracing support, saving a file in Chrome Tracing format
|
||||
trace_chrome = ["trace", "bevy_internal/trace_chrome"]
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ keywords = ["bevy"]
|
|||
|
||||
[features]
|
||||
trace = []
|
||||
bevy_ci_testing = ["serde", "ron"]
|
||||
bevy_debug_stepping = []
|
||||
default = ["bevy_reflect", "bevy_debug_stepping"]
|
||||
bevy_reflect = ["dep:bevy_reflect", "bevy_ecs/bevy_reflect"]
|
||||
|
|
|
@ -188,11 +188,6 @@ impl Default for App {
|
|||
|
||||
app.add_event::<AppExit>();
|
||||
|
||||
#[cfg(feature = "bevy_ci_testing")]
|
||||
{
|
||||
crate::ci_testing::setup_app(&mut app);
|
||||
}
|
||||
|
||||
app
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,6 @@ mod plugin;
|
|||
mod plugin_group;
|
||||
mod schedule_runner;
|
||||
|
||||
#[cfg(feature = "bevy_ci_testing")]
|
||||
pub mod ci_testing;
|
||||
|
||||
pub use app::*;
|
||||
pub use bevy_derive::DynamicPlugin;
|
||||
pub use main_schedule::*;
|
||||
|
|
25
crates/bevy_dev_tools/Cargo.toml
Normal file
25
crates/bevy_dev_tools/Cargo.toml
Normal file
|
@ -0,0 +1,25 @@
|
|||
[package]
|
||||
name = "bevy_dev_tools"
|
||||
version = "0.14.0-dev"
|
||||
edition = "2021"
|
||||
description = "Collection of developer tools for the Bevy Engine"
|
||||
homepage = "https://bevyengine.org"
|
||||
repository = "https://github.com/bevyengine/bevy"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["bevy"]
|
||||
|
||||
[features]
|
||||
bevy_ci_testing = ["serde", "ron"]
|
||||
|
||||
[dependencies]
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.14.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.14.0-dev" }
|
||||
|
||||
# other
|
||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||
ron = { version = "0.8.0", optional = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
|
@ -1,6 +1,6 @@
|
|||
//! Utilities for testing in CI environments.
|
||||
|
||||
use crate::{app::AppExit, App, Update};
|
||||
use bevy_app::{App, AppExit, Update};
|
||||
use serde::Deserialize;
|
||||
|
||||
use bevy_ecs::prelude::Resource;
|
44
crates/bevy_dev_tools/src/lib.rs
Normal file
44
crates/bevy_dev_tools/src/lib.rs
Normal file
|
@ -0,0 +1,44 @@
|
|||
//! This crate provides additional utilities for the [Bevy game engine](https://bevyengine.org),
|
||||
//! focused on improving developer experience.
|
||||
|
||||
use bevy_app::prelude::*;
|
||||
#[cfg(feature = "bevy_ci_testing")]
|
||||
pub mod ci_testing;
|
||||
|
||||
/// Enables developer tools in an [`App`]. This plugin is added automatically with `bevy_dev_tools`
|
||||
/// feature.
|
||||
///
|
||||
/// Warning: It is not recommended to enable this in final shipped games or applications.
|
||||
/// Dev tools provide a high level of access to the internals of your application,
|
||||
/// and may interfere with ordinary use and gameplay.
|
||||
///
|
||||
/// To enable developer tools, you can either:
|
||||
///
|
||||
/// - Create a custom crate feature (e.g "`dev_mode`"), which enables the `bevy_dev_tools` feature
|
||||
/// along with any other development tools you might be using:
|
||||
///
|
||||
/// ```toml
|
||||
/// [feature]
|
||||
/// dev_mode = ["bevy/bevy_dev_tools", "other_dev_tools"]
|
||||
/// ```
|
||||
///
|
||||
/// - Use `--feature bevy/bevy_dev_tools` flag when using the `cargo run` command:
|
||||
///
|
||||
/// `cargo run --features bevy/bevy_dev_tools`
|
||||
///
|
||||
/// - Add the `bevy_dev_tools` feature to the bevy dependency in your `Cargo.toml` file:
|
||||
///
|
||||
/// `features = ["bevy_dev_tools"]`
|
||||
///
|
||||
/// Note: The third method is not recommended, as it requires you to remove the feature before
|
||||
/// creating a build for release to the public.
|
||||
pub struct DevToolsPlugin;
|
||||
|
||||
impl Plugin for DevToolsPlugin {
|
||||
fn build(&self, _app: &mut App) {
|
||||
#[cfg(feature = "bevy_ci_testing")]
|
||||
{
|
||||
ci_testing::setup_app(_app);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -114,7 +114,7 @@ webgpu = [
|
|||
|
||||
# enable systems that allow for automated testing on CI
|
||||
bevy_ci_testing = [
|
||||
"bevy_app/bevy_ci_testing",
|
||||
"bevy_dev_tools/bevy_ci_testing",
|
||||
"bevy_time/bevy_ci_testing",
|
||||
"bevy_render?/bevy_ci_testing",
|
||||
"bevy_render?/ci_limits",
|
||||
|
@ -163,6 +163,9 @@ bevy_debug_stepping = [
|
|||
"bevy_app/bevy_debug_stepping",
|
||||
]
|
||||
|
||||
# Provides a collection of developer tools
|
||||
bevy_dev_tools = ["dep:bevy_dev_tools"]
|
||||
|
||||
# Enable support for the ios_simulator by downgrading some rendering capabilities
|
||||
ios_simulator = ["bevy_pbr?/ios_simulator", "bevy_render?/ios_simulator"]
|
||||
|
||||
|
@ -204,6 +207,7 @@ bevy_ui = { path = "../bevy_ui", optional = true, version = "0.14.0-dev" }
|
|||
bevy_winit = { path = "../bevy_winit", optional = true, version = "0.14.0-dev" }
|
||||
bevy_gilrs = { path = "../bevy_gilrs", optional = true, version = "0.14.0-dev" }
|
||||
bevy_gizmos = { path = "../bevy_gizmos", optional = true, version = "0.14.0-dev", default-features = false }
|
||||
bevy_dev_tools = { path = "../bevy_dev_tools/", optional = true, version = "0.14.0-dev" }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -27,6 +27,7 @@ use bevy_app::{Plugin, PluginGroup, PluginGroupBuilder};
|
|||
/// * [`AudioPlugin`](crate::audio::AudioPlugin) - with feature `bevy_audio`
|
||||
/// * [`GilrsPlugin`](crate::gilrs::GilrsPlugin) - with feature `bevy_gilrs`
|
||||
/// * [`AnimationPlugin`](crate::animation::AnimationPlugin) - with feature `bevy_animation`
|
||||
/// * [`DevToolsPlugin`](crate::dev_tools::DevToolsPlugin) - with feature `bevy_dev_tools`
|
||||
///
|
||||
/// [`DefaultPlugins`] obeys *Cargo* *feature* flags. Users may exert control over this plugin group
|
||||
/// by disabling `default-features` in their `Cargo.toml` and enabling only those features
|
||||
|
@ -134,6 +135,11 @@ impl PluginGroup for DefaultPlugins {
|
|||
group = group.add(bevy_gizmos::GizmoPlugin);
|
||||
}
|
||||
|
||||
#[cfg(feature = "bevy_dev_tools")]
|
||||
{
|
||||
group = group.add(bevy_dev_tools::DevToolsPlugin);
|
||||
}
|
||||
|
||||
group = group.add(IgnoreAmbiguitiesPlugin);
|
||||
|
||||
group
|
||||
|
|
|
@ -199,3 +199,9 @@ pub mod dynamic_plugin {
|
|||
//! Dynamic linking of plugins
|
||||
pub use bevy_dynamic_plugin::*;
|
||||
}
|
||||
|
||||
#[cfg(feature = "bevy_dev_tools")]
|
||||
pub mod dev_tools {
|
||||
//! Collection of developer tools
|
||||
pub use bevy_dev_tools::*;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ webp = ["image/webp"]
|
|||
dds = ["ddsfile"]
|
||||
pnm = ["image/pnm"]
|
||||
multi-threaded = ["bevy_tasks/multi-threaded"]
|
||||
bevy_ci_testing = ["bevy_app/bevy_ci_testing"]
|
||||
bevy_ci_testing = ["bevy_dev_tools/bevy_ci_testing"]
|
||||
|
||||
shader_format_glsl = ["naga/glsl-in", "naga/wgsl-out", "naga_oil/glsl"]
|
||||
shader_format_spirv = ["wgpu/spirv", "naga/spv-in", "naga/spv-out"]
|
||||
|
@ -57,6 +57,7 @@ bevy_transform = { path = "../bevy_transform", version = "0.14.0-dev" }
|
|||
bevy_window = { path = "../bevy_window", version = "0.14.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
||||
bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
|
||||
bevy_dev_tools = { path = "../bevy_dev_tools", version = "0.14.0-dev", optional = true }
|
||||
|
||||
# rendering
|
||||
image = { version = "0.24", default-features = false }
|
||||
|
|
|
@ -144,7 +144,7 @@ impl Plugin for ScreenshotPlugin {
|
|||
#[cfg(feature = "bevy_ci_testing")]
|
||||
if app
|
||||
.world
|
||||
.contains_resource::<bevy_app::ci_testing::CiTestingConfig>()
|
||||
.contains_resource::<bevy_dev_tools::ci_testing::CiTestingConfig>()
|
||||
{
|
||||
app.add_systems(bevy_app::Update, ci_testing_screenshot_at);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ impl Plugin for ScreenshotPlugin {
|
|||
#[cfg(feature = "bevy_ci_testing")]
|
||||
fn ci_testing_screenshot_at(
|
||||
mut current_frame: Local<u32>,
|
||||
ci_testing_config: Res<bevy_app::ci_testing::CiTestingConfig>,
|
||||
ci_testing_config: Res<bevy_dev_tools::ci_testing::CiTestingConfig>,
|
||||
mut screenshot_manager: ResMut<ScreenshotManager>,
|
||||
main_window: Query<Entity, With<bevy_window::PrimaryWindow>>,
|
||||
) {
|
||||
|
|
|
@ -11,7 +11,7 @@ keywords = ["bevy"]
|
|||
[features]
|
||||
default = []
|
||||
serialize = ["serde"]
|
||||
bevy_ci_testing = ["bevy_app/bevy_ci_testing"]
|
||||
bevy_ci_testing = ["bevy_dev_tools/bevy_ci_testing"]
|
||||
|
||||
[dependencies]
|
||||
# bevy
|
||||
|
@ -23,6 +23,7 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", features = [
|
|||
"bevy",
|
||||
] }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
||||
bevy_dev_tools = { path = "../bevy_dev_tools", version = "0.14.0-dev", optional = true }
|
||||
|
||||
# other
|
||||
crossbeam-channel = "0.5.0"
|
||||
|
|
|
@ -68,7 +68,7 @@ impl Plugin for TimePlugin {
|
|||
#[cfg(feature = "bevy_ci_testing")]
|
||||
if let Some(ci_testing_config) = app
|
||||
.world
|
||||
.get_resource::<bevy_app::ci_testing::CiTestingConfig>()
|
||||
.get_resource::<bevy_dev_tools::ci_testing::CiTestingConfig>()
|
||||
{
|
||||
if let Some(frame_time) = ci_testing_config.frame_time {
|
||||
app.world
|
||||
|
|
|
@ -50,6 +50,7 @@ The default feature set enables most of the expected features of a game engine,
|
|||
|async-io|Use async-io's implementation of block_on instead of futures-lite's implementation. This is preferred if your application uses async-io.|
|
||||
|basis-universal|Basis Universal compressed texture support|
|
||||
|bevy_ci_testing|Enable systems that allow for automated testing on CI|
|
||||
|bevy_dev_tools|Provides a collection of developer tools|
|
||||
|bevy_dynamic_plugin|Plugin for dynamic loading (using [libloading](https://crates.io/crates/libloading))|
|
||||
|bmp|BMP image format support|
|
||||
|dds|DDS compressed texture support|
|
||||
|
|
|
@ -41,6 +41,7 @@ crates=(
|
|||
bevy_a11y
|
||||
bevy_ui
|
||||
bevy_winit
|
||||
bevy_dev_tools
|
||||
bevy_internal
|
||||
bevy_dylib
|
||||
bevy_color
|
||||
|
|
Loading…
Reference in a new issue