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

Feature gate use_shortnames #15348

3 changes: 1 addition & 2 deletions crates/bevy_asset/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use crate::{
UntypedAssetId,
};
use bevy_ecs::prelude::*;
use bevy_reflect::{std_traits::ReflectDefault, Reflect, TypePath};
use bevy_utils::ShortName;
use bevy_reflect::{std_traits::ReflectDefault, Reflect, ShortName, TypePath};
use crossbeam_channel::{Receiver, Sender};
use std::{
any::TypeId,
Expand Down
11 changes: 8 additions & 3 deletions crates/bevy_ecs/src/schedule/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ pub enum Chain {
/// fn system_one() { println!("System 1 works!") }
/// fn system_two() { println!("System 2 works!") }
/// fn system_three() { println!("System 3 works!") }
///
///
/// fn main() {
/// let mut world = World::new();
/// let mut schedule = Schedule::default();
Expand Down Expand Up @@ -1607,8 +1607,11 @@ impl ScheduleGraph {
}
}
};
if self.settings.use_shortnames {
name = bevy_utils::ShortName(&name).to_string();
#[cfg(feature = "bevy_reflect")]
{
if self.settings.use_shortnames {
name = bevy_reflect::ShortName(&name).to_string();
}
}
name
}
Expand Down Expand Up @@ -2012,6 +2015,7 @@ pub struct ScheduleBuildSettings {
/// If set to true, node names will be shortened instead of the fully qualified type path.
///
/// Defaults to `true`.
#[cfg(feature = "bevy_reflect")]
pub use_shortnames: bool,
/// If set to true, report all system sets the conflicting systems are part of.
///
Expand All @@ -2033,6 +2037,7 @@ impl ScheduleBuildSettings {
ambiguity_detection: LogLevel::Ignore,
hierarchy_detection: LogLevel::Warn,
auto_insert_apply_deferred: true,
#[cfg(feature = "bevy_reflect")]
use_shortnames: true,
report_sets: true,
}
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_hierarchy/src/valid_parent_check_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use std::marker::PhantomData;
use crate::Parent;
use bevy_ecs::prelude::*;
#[cfg(feature = "bevy_app")]
use bevy_utils::{HashSet, ShortName};
use bevy_reflect::ShortName;
#[cfg(feature = "bevy_app")]
use bevy_utils::HashSet;

/// When enabled, runs [`check_hierarchy_component_has_valid_parent<T>`].
///
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_reflect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["bevy"]
rust-version = "1.76.0"

[features]
default = ["smallvec", "debug"]
default = ["smallvec", "debug", "alloc"]
# When enabled, provides Bevy-related reflection implementations
bevy = ["smallvec", "smol_str"]
glam = ["dep:glam"]
Expand All @@ -25,6 +25,7 @@ debug_stack = []
documentation = ["bevy_reflect_derive/documentation"]
# Enables function reflection
functions = ["bevy_reflect_derive/functions"]
alloc = []

[dependencies]
# bevy
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_reflect/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ mod reflect;
mod reflectable;
mod remote;
mod set;
mod short_name;
mod struct_trait;
mod tuple;
mod tuple_struct;
Expand Down Expand Up @@ -615,6 +616,7 @@ pub use type_registry::*;

pub use bevy_reflect_derive::*;
pub use erased_serde;
pub use short_name::ShortName;

extern crate alloc;

Expand Down Expand Up @@ -2366,7 +2368,7 @@ bevy_reflect::tests::Test {

fn short_type_path() -> &'static str {
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self, _>(|| bevy_utils::ShortName::of::<Self>().to_string())
CELL.get_or_insert::<Self, _>(|| ShortName::of::<Self>().to_string())
}

fn type_ident() -> Option<&'static str> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/// # Examples
///
/// ```rust
/// # use bevy_utils::ShortName;
/// # use bevy_reflect::ShortName;
/// #
/// # mod foo {
/// # pub mod bar {
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ pub mod prelude {
}

pub mod futures;
mod short_names;
pub use short_names::ShortName;
pub mod synccell;
pub mod syncunsafecell;

Expand Down