Skip to content

Commit

Permalink
Rename schedule v3 to schedule (#7519)
Browse files Browse the repository at this point in the history
# Objective

- Follow up of #7267

## Solution

- Rename schedule_v3 to schedule
- Suppress "module inception" lint
  • Loading branch information
lewiszlw committed Feb 6, 2023
1 parent a9e2dee commit aa4170d
Show file tree
Hide file tree
Showing 33 changed files with 62 additions and 65 deletions.
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/components/archetype_updates.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy_ecs::{component::Component, schedule_v3::Schedule, world::World};
use bevy_ecs::{component::Component, schedule::Schedule, world::World};
use criterion::{BenchmarkId, Criterion};

#[derive(Component)]
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/scheduling/running_systems.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy_ecs::{component::Component, schedule_v3::Schedule, system::Query, world::World};
use bevy_ecs::{component::Component, schedule::Schedule, system::Query, world::World};
use criterion::Criterion;

#[derive(Component)]
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{CoreSchedule, CoreSet, Plugin, PluginGroup, StartupSet};
pub use bevy_derive::AppLabel;
use bevy_ecs::{
prelude::*,
schedule_v3::{
schedule::{
apply_state_transition, common_conditions::run_once as run_once_condition,
run_enter_schedule, BoxedScheduleLabel, IntoSystemConfig, IntoSystemSetConfigs,
ScheduleLabel,
Expand Down Expand Up @@ -100,7 +100,7 @@ impl Debug for App {
/// ```rust
/// # use bevy_app::{App, AppLabel, SubApp, CoreSchedule};
/// # use bevy_ecs::prelude::*;
/// # use bevy_ecs::schedule_v3::ScheduleLabel;
/// # use bevy_ecs::schedule::ScheduleLabel;
///
/// #[derive(Resource, Default)]
/// struct Val(pub i32);
Expand Down Expand Up @@ -315,7 +315,7 @@ impl App {
/// These systems sets only run if the [`State<S>`] resource matches their label.
///
/// If you would like to control how other systems run based on the current state,
/// you can emulate this behavior using the [`state_equals`] [`Condition`](bevy_ecs::schedule_v3::Condition).
/// you can emulate this behavior using the [`state_equals`] [`Condition`](bevy_ecs::schedule::Condition).
///
/// Note that you can also apply state transitions at other points in the schedule
/// by adding the [`apply_state_transition`] system manually.
Expand Down Expand Up @@ -526,7 +526,7 @@ impl App {
///
/// ```
/// use bevy_app::App;
/// use bevy_ecs::schedule_v3::Schedules;
/// use bevy_ecs::schedule::Schedules;
///
/// let app = App::empty()
/// .init_resource::<Schedules>()
Expand All @@ -549,7 +549,7 @@ impl App {
}

self.edit_schedule(CoreSchedule::Outer, |schedule| {
schedule.set_executor_kind(bevy_ecs::schedule_v3::ExecutorKind::SingleThreaded);
schedule.set_executor_kind(bevy_ecs::schedule::ExecutorKind::SingleThreaded);
schedule.add_system(run_main_schedule);
});

Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub mod prelude {
}

use bevy_ecs::{
schedule_v3::{
schedule::{
apply_system_buffers, IntoSystemConfig, IntoSystemSetConfig, IntoSystemSetConfigs,
Schedule, ScheduleLabel, SystemSet,
},
Expand All @@ -38,7 +38,7 @@ use bevy_ecs::{

/// The names of the default [`App`] schedules.
///
/// The corresponding [`Schedule`](bevy_ecs::schedule_v3::Schedule) objects are added by [`App::add_default_schedules`].
/// The corresponding [`Schedule`](bevy_ecs::schedule::Schedule) objects are added by [`App::add_default_schedules`].
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub enum CoreSchedule {
/// The schedule that runs once when the app starts.
Expand Down Expand Up @@ -74,7 +74,7 @@ impl CoreSchedule {
/// Initializes a single threaded schedule for [`CoreSchedule::Outer`] that contains the [`outer_loop`](CoreSchedule::outer_loop) system.
pub fn outer_schedule() -> Schedule {
let mut schedule = Schedule::new();
schedule.set_executor_kind(bevy_ecs::schedule_v3::ExecutorKind::SingleThreaded);
schedule.set_executor_kind(bevy_ecs::schedule::ExecutorKind::SingleThreaded);
schedule.add_system(Self::outer_loop);
schedule
}
Expand All @@ -84,7 +84,7 @@ impl CoreSchedule {
///
/// These are ordered in the same order they are listed.
///
/// The corresponding [`SystemSets`](bevy_ecs::schedule_v3::SystemSet) are added by [`App::add_default_schedules`].
/// The corresponding [`SystemSets`](bevy_ecs::schedule::SystemSet) are added by [`App::add_default_schedules`].
///
/// The `*Flush` sets are assigned to the copy of [`apply_system_buffers`]
/// that runs immediately after the matching system set.
Expand All @@ -100,7 +100,7 @@ pub enum CoreSet {
PreUpdate,
/// The copy of [`apply_system_buffers`] that runs immediately after `PreUpdate`.
PreUpdateFlush,
/// Applies [`State`](bevy_ecs::schedule_v3::State) transitions
/// Applies [`State`](bevy_ecs::schedule::State) transitions
StateTransitions,
/// Runs systems that should only occur after a fixed period of time.
///
Expand Down Expand Up @@ -160,7 +160,7 @@ impl CoreSet {

/// The names of the default [`App`] startup sets, which live in [`CoreSchedule::Startup`].
///
/// The corresponding [`SystemSets`](bevy_ecs::schedule_v3::SystemSet) are added by [`App::add_default_schedules`].
/// The corresponding [`SystemSets`](bevy_ecs::schedule::SystemSet) are added by [`App::add_default_schedules`].
///
/// The `*Flush` sets are assigned to the copy of [`apply_system_buffers`]
/// that runs immediately after the matching system set.
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_app/src/schedule_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ use std::{cell::RefCell, rc::Rc};
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::{prelude::*, JsCast};

/// Determines the method used to run an [`App`]'s [`Schedule`](bevy_ecs::schedule_v3::Schedule).
/// Determines the method used to run an [`App`]'s [`Schedule`](bevy_ecs::schedule::Schedule).
///
/// It is used in the [`ScheduleRunnerSettings`].
#[derive(Copy, Clone, Debug)]
pub enum RunMode {
/// Indicates that the [`App`]'s schedule should run repeatedly.
Loop {
/// The minimum [`Duration`] to wait after a [`Schedule`](bevy_ecs::schedule_v3::Schedule)
/// The minimum [`Duration`] to wait after a [`Schedule`](bevy_ecs::schedule::Schedule)
/// has completed before repeating. A value of [`None`] will not wait.
wait: Option<Duration>,
},
Expand All @@ -37,7 +37,7 @@ impl Default for RunMode {
/// It gets added as a [`Resource`](bevy_ecs::system::Resource) inside of the [`ScheduleRunnerPlugin`].
#[derive(Copy, Clone, Default, Resource)]
pub struct ScheduleRunnerSettings {
/// Determines whether the [`Schedule`](bevy_ecs::schedule_v3::Schedule) is run once or repeatedly.
/// Determines whether the [`Schedule`](bevy_ecs::schedule::Schedule) is run once or repeatedly.
pub run_mode: RunMode,
}

Expand All @@ -59,15 +59,15 @@ impl ScheduleRunnerSettings {
}
}

/// Configures an [`App`] to run its [`Schedule`](bevy_ecs::schedule_v3::Schedule) according to a given
/// Configures an [`App`] to run its [`Schedule`](bevy_ecs::schedule::Schedule) according to a given
/// [`RunMode`].
///
/// [`ScheduleRunnerPlugin`] is included in the
/// [`MinimalPlugins`](https://docs.rs/bevy/latest/bevy/struct.MinimalPlugins.html) plugin group.
///
/// [`ScheduleRunnerPlugin`] is *not* included in the
/// [`DefaultPlugins`](https://docs.rs/bevy/latest/bevy/struct.DefaultPlugins.html) plugin group
/// which assumes that the [`Schedule`](bevy_ecs::schedule_v3::Schedule) will be executed by other means:
/// which assumes that the [`Schedule`](bevy_ecs::schedule::Schedule) will be executed by other means:
/// typically, the `winit` event loop
/// (see [`WinitPlugin`](https://docs.rs/bevy/latest/bevy/winit/struct.WinitPlugin.html))
/// executes the schedule making [`ScheduleRunnerPlugin`] unnecessary.
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_diagnostic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod log_diagnostics_plugin;
mod system_information_diagnostics_plugin;

use bevy_app::prelude::*;
use bevy_ecs::schedule_v3::IntoSystemConfig;
use bevy_ecs::schedule::IntoSystemConfig;
pub use diagnostic::*;
pub use entity_count_diagnostics_plugin::EntityCountDiagnosticsPlugin;
pub use frame_time_diagnostics_plugin::FrameTimeDiagnosticsPlugin;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/examples/change_detection.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy_ecs::{prelude::*, schedule_v3::IntoSystemConfig};
use bevy_ecs::{prelude::*, schedule::IntoSystemConfig};
use rand::Rng;
use std::ops::Deref;

Expand Down
8 changes: 2 additions & 6 deletions crates/bevy_ecs/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,7 @@ pub fn derive_world_query(input: TokenStream) -> TokenStream {
pub fn derive_schedule_label(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
let mut trait_path = bevy_ecs_path();
trait_path
.segments
.push(format_ident!("schedule_v3").into());
trait_path.segments.push(format_ident!("schedule").into());
trait_path
.segments
.push(format_ident!("ScheduleLabel").into());
Expand All @@ -542,9 +540,7 @@ pub fn derive_schedule_label(input: TokenStream) -> TokenStream {
pub fn derive_system_set(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
let mut trait_path = bevy_ecs_path();
trait_path
.segments
.push(format_ident!("schedule_v3").into());
trait_path.segments.push(format_ident!("schedule").into());
trait_path.segments.push(format_ident!("SystemSet").into());
derive_set(input, &trait_path)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub mod query;
#[cfg(feature = "bevy_reflect")]
pub mod reflect;
pub mod removal_detection;
pub mod schedule_v3;
pub mod schedule;
pub mod storage;
pub mod system;
pub mod world;
Expand All @@ -35,7 +35,7 @@ pub mod prelude {
event::{Event, EventReader, EventWriter, Events},
query::{Added, AnyOf, ChangeTrackers, Changed, Or, QueryState, With, Without},
removal_detection::RemovedComponents,
schedule_v3::{
schedule::{
apply_state_transition, apply_system_buffers, common_conditions::*, IntoSystemConfig,
IntoSystemConfigs, IntoSystemSet, IntoSystemSetConfig, IntoSystemSetConfigs, NextState,
OnEnter, OnExit, OnUpdate, Schedule, Schedules, State, States, SystemSet,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mod sealed {
}

pub mod common_conditions {
use crate::schedule_v3::{State, States};
use crate::schedule::{State, States};
use crate::system::{Res, Resource};

/// Generates a [`Condition`](super::Condition)-satisfying closure that returns `true`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bevy_ecs_macros::all_tuples;

use crate::{
schedule_v3::{
schedule::{
condition::{BoxedCondition, Condition},
graph_utils::{Ambiguity, Dependency, DependencyKind, GraphInfo},
set::{BoxedSystemSet, IntoSystemSet, SystemSet},
Expand Down Expand Up @@ -488,7 +488,7 @@ impl IntoSystemConfig<()> for SystemConfig {
// only `System<In=(), Out=()>` system objects can be scheduled
mod sealed {
use crate::{
schedule_v3::{BoxedSystemSet, SystemSet},
schedule::{BoxedSystemSet, SystemSet},
system::{BoxedSystem, IntoSystem},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub use self::single_threaded::SingleThreadedExecutor;
use fixedbitset::FixedBitSet;

use crate::{
schedule_v3::{BoxedCondition, NodeId},
schedule::{BoxedCondition, NodeId},
system::BoxedSystem,
world::World,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{
archetype::ArchetypeComponentId,
prelude::Resource,
query::Access,
schedule_v3::{
schedule::{
is_apply_system_buffers, BoxedCondition, ExecutorKind, SystemExecutor, SystemSchedule,
},
system::BoxedSystem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use bevy_utils::tracing::info_span;
use fixedbitset::FixedBitSet;

use crate::{
schedule_v3::{BoxedCondition, ExecutorKind, SystemExecutor, SystemSchedule},
schedule::{BoxedCondition, ExecutorKind, SystemExecutor, SystemSchedule},
world::World,
};

/// A variant of [`SingleThreadedExecutor`](crate::schedule_v3::SingleThreadedExecutor) that calls
/// A variant of [`SingleThreadedExecutor`](crate::schedule::SingleThreadedExecutor) that calls
/// [`apply_buffers`](crate::system::System::apply_buffers) immediately after running each system.
#[derive(Default)]
pub struct SimpleExecutor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy_utils::tracing::info_span;
use fixedbitset::FixedBitSet;

use crate::{
schedule_v3::{
schedule::{
is_apply_system_buffers, BoxedCondition, ExecutorKind, SystemExecutor, SystemSchedule,
},
world::World,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bevy_utils::{
};
use fixedbitset::FixedBitSet;

use crate::schedule_v3::set::*;
use crate::schedule::set::*;

/// Unique identifier for a system or system set.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mod condition;
mod config;
mod executor;
mod graph_utils;
#[allow(clippy::module_inception)]
mod schedule;
mod set;
mod state;
Expand All @@ -20,7 +21,7 @@ mod tests {
use std::sync::atomic::{AtomicU32, Ordering};

pub use crate as bevy_ecs;
pub use crate::schedule_v3::{IntoSystemConfig, IntoSystemSetConfig, Schedule, SystemSet};
pub use crate::schedule::{IntoSystemConfig, IntoSystemSetConfig, Schedule, SystemSet};
pub use crate::system::{Res, ResMut};
pub use crate::{prelude::World, system::Resource};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use fixedbitset::FixedBitSet;
use crate::{
self as bevy_ecs,
component::{ComponentId, Components},
schedule_v3::*,
schedule::*,
system::{BoxedSystem, Resource},
world::World,
};
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::hash::Hash;
use std::mem;

use crate as bevy_ecs;
use crate::schedule_v3::{ScheduleLabel, SystemSet};
use crate::schedule::{ScheduleLabel, SystemSet};
use crate::system::Resource;
use crate::world::World;

Expand Down Expand Up @@ -61,7 +61,7 @@ pub struct OnExit<S: States>(pub S);

/// A [`SystemSet`] that will run within `CoreSet::StateTransitions` when this state is active.
///
/// This is provided for convenience. A more general [`state_equals`](crate::schedule_v3::common_conditions::state_equals)
/// This is provided for convenience. A more general [`state_equals`](crate::schedule::common_conditions::state_equals)
/// [condition](super::Condition) also exists for systems that need to run elsewhere.
#[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)]
pub struct OnUpdate<S: States>(pub S);
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/system/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ pub trait Command: Send + 'static {
/// ```
///
/// [`System::apply_buffers`]: crate::system::System::apply_buffers
/// [`apply_system_buffers`]: crate::schedule_v3::apply_system_buffers
/// [`Schedule::apply_system_buffers`]: crate::schedule_v3::Schedule::apply_system_buffers
/// [`apply_system_buffers`]: crate::schedule::apply_system_buffers
/// [`Schedule::apply_system_buffers`]: crate::schedule::Schedule::apply_system_buffers
pub struct Commands<'w, 's> {
queue: &'s mut CommandQueue,
entities: &'w Entities,
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/system/exclusive_function_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ where
);
}

fn default_system_sets(&self) -> Vec<Box<dyn crate::schedule_v3::SystemSet>> {
let set = crate::schedule_v3::SystemTypeSet::<F>::new();
fn default_system_sets(&self) -> Vec<Box<dyn crate::schedule::SystemSet>> {
let set = crate::schedule::SystemTypeSet::<F>::new();
vec![Box::new(set)]
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/system/function_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ where
);
}

fn default_system_sets(&self) -> Vec<Box<dyn crate::schedule_v3::SystemSet>> {
let set = crate::schedule_v3::SystemTypeSet::<F>::new();
fn default_system_sets(&self) -> Vec<Box<dyn crate::schedule::SystemSet>> {
let set = crate::schedule::SystemTypeSet::<F>::new();
vec![Box::new(set)]
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_ecs/src/system/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Tools for controlling behavior in an ECS application.
//!
//! Systems define how an ECS based application behaves.
//! Systems are added to a [`Schedule`](crate::schedule_v3::Schedule), which is then run.
//! Systems are added to a [`Schedule`](crate::schedule::Schedule), which is then run.
//! A system is usually written as a normal function, which is automatically converted into a system.
//!
//! System functions can have parameters, through which one can query and mutate Bevy ECS state.
Expand Down Expand Up @@ -49,7 +49,7 @@
//! - by adding them to a [`SystemSet`], and then using `.configure_set(ThisSet.before(ThatSet))` syntax to configure many systems at once
//! - through the use of `.add_systems((system_a, system_b, system_c).chain())`
//!
//! [`SystemSet`]: crate::schedule_v3::SystemSet
//! [`SystemSet`]: crate::schedule::SystemSet
//!
//! ## Example
//!
Expand Down Expand Up @@ -144,7 +144,7 @@ mod tests {
prelude::AnyOf,
query::{Added, Changed, Or, With, Without},
removal_detection::RemovedComponents,
schedule_v3::{apply_system_buffers, IntoSystemConfig, Schedule},
schedule::{apply_system_buffers, IntoSystemConfig, Schedule},
system::{
Commands, IntoSystem, Local, NonSend, NonSendMut, ParamSet, Query, QueryComponentError,
Res, ResMut, Resource, System, SystemState,
Expand Down
Loading

0 comments on commit aa4170d

Please sign in to comment.