Clean up some low level dependencies (#12858)
# Objective Minimize the number of dependencies low in the tree. ## Solution * Remove the dependency on rustc-hash in bevy_ecs (not used) and bevy_macro_utils (only used in one spot). * Deduplicate the dependency on `sha1_smol` with the existing blake3 dependency already being used for bevy_asset. * Remove the unused `ron` dependency on `bevy_app` * Make the `serde` dependency for `bevy_ecs` optional. It's only used for serializing Entity. * Change the `wgpu` dependency to `wgpu-types`, and make it optional for `bevy_color`. * Remove the unused `thread-local` dependency on `bevy_render`. * Make multiple dependencies for `bevy_tasks` optional and enabled only when running with the `multi-threaded` feature. Preferably they'd be disabled all the time on wasm, but I couldn't find a clean way to do this. --- ## Changelog TODO ## Migration Guide TODO
This commit is contained in:
parent
627ad6d2cc
commit
934f2cfadf
@ -33,7 +33,7 @@ fixedbitset = "0.5"
|
|||||||
petgraph = { version = "0.6", features = ["serde-1"] }
|
petgraph = { version = "0.6", features = ["serde-1"] }
|
||||||
ron = "0.8"
|
ron = "0.8"
|
||||||
serde = "1"
|
serde = "1"
|
||||||
sha1_smol = { version = "1.0" }
|
blake3 = { version = "1.0" }
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
thread_local = "1"
|
thread_local = "1"
|
||||||
uuid = { version = "1.7", features = ["v4"] }
|
uuid = { version = "1.7", features = ["v4"] }
|
||||||
|
@ -39,7 +39,6 @@ use graph::{AnimationGraph, AnimationNodeIndex};
|
|||||||
use petgraph::graph::NodeIndex;
|
use petgraph::graph::NodeIndex;
|
||||||
use petgraph::Direction;
|
use petgraph::Direction;
|
||||||
use prelude::{AnimationGraphAssetLoader, AnimationTransitions};
|
use prelude::{AnimationGraphAssetLoader, AnimationTransitions};
|
||||||
use sha1_smol::Sha1;
|
|
||||||
use thread_local::ThreadLocal;
|
use thread_local::ThreadLocal;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
@ -1160,10 +1159,12 @@ impl AnimationTargetId {
|
|||||||
/// Typically, this will be the path from the animation root to the
|
/// Typically, this will be the path from the animation root to the
|
||||||
/// animation target (e.g. bone) that is to be animated.
|
/// animation target (e.g. bone) that is to be animated.
|
||||||
pub fn from_names<'a>(names: impl Iterator<Item = &'a Name>) -> Self {
|
pub fn from_names<'a>(names: impl Iterator<Item = &'a Name>) -> Self {
|
||||||
let mut sha1 = Sha1::new();
|
let mut blake3 = blake3::Hasher::new();
|
||||||
sha1.update(ANIMATION_TARGET_NAMESPACE.as_bytes());
|
blake3.update(ANIMATION_TARGET_NAMESPACE.as_bytes());
|
||||||
names.for_each(|name| sha1.update(name.as_bytes()));
|
for name in names {
|
||||||
let hash = sha1.digest().bytes()[0..16].try_into().unwrap();
|
blake3.update(name.as_bytes());
|
||||||
|
}
|
||||||
|
let hash = blake3.finalize().as_bytes()[0..16].try_into().unwrap();
|
||||||
Self(*uuid::Builder::from_sha1_bytes(hash).as_uuid())
|
Self(*uuid::Builder::from_sha1_bytes(hash).as_uuid())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ trace = []
|
|||||||
bevy_debug_stepping = []
|
bevy_debug_stepping = []
|
||||||
default = ["bevy_reflect"]
|
default = ["bevy_reflect"]
|
||||||
bevy_reflect = ["dep:bevy_reflect", "bevy_ecs/bevy_reflect"]
|
bevy_reflect = ["dep:bevy_reflect", "bevy_ecs/bevy_reflect"]
|
||||||
|
serialize = ["bevy_ecs/serde"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# bevy
|
# bevy
|
||||||
@ -24,7 +25,6 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
|
|||||||
|
|
||||||
# other
|
# other
|
||||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||||
ron = { version = "0.8.0", optional = true }
|
|
||||||
downcast-rs = "1.2.0"
|
downcast-rs = "1.2.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", features = [
|
|||||||
bytemuck = "1"
|
bytemuck = "1"
|
||||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
wgpu = { version = "0.19.3", default-features = false }
|
wgpu-types = { version = "0.19", default-features = false, optional = true }
|
||||||
encase = { version = "0.7", default-features = false }
|
encase = { version = "0.7", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -293,9 +293,10 @@ impl From<LinearRgba> for Vec4 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<LinearRgba> for wgpu::Color {
|
#[cfg(feature = "wgpu-types")]
|
||||||
|
impl From<LinearRgba> for wgpu_types::Color {
|
||||||
fn from(color: LinearRgba) -> Self {
|
fn from(color: LinearRgba) -> Self {
|
||||||
wgpu::Color {
|
wgpu_types::Color {
|
||||||
r: color.red as f64,
|
r: color.red as f64,
|
||||||
g: color.green as f64,
|
g: color.green as f64,
|
||||||
b: color.blue as f64,
|
b: color.blue as f64,
|
||||||
|
@ -21,13 +21,12 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", optional = tr
|
|||||||
bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
|
bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
|
||||||
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
||||||
bevy_ecs_macros = { path = "macros", version = "0.14.0-dev" }
|
bevy_ecs_macros = { path = "macros", version = "0.14.0-dev" }
|
||||||
petgraph = "0.6"
|
|
||||||
|
|
||||||
|
petgraph = "0.6"
|
||||||
bitflags = "2.3"
|
bitflags = "2.3"
|
||||||
concurrent-queue = "2.4.0"
|
concurrent-queue = "2.4.0"
|
||||||
fixedbitset = "0.5"
|
fixedbitset = "0.5"
|
||||||
rustc-hash = "1.1"
|
serde = { version = "1", optional = true, default-features = false }
|
||||||
serde = "1"
|
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
nonmax = "0.5"
|
nonmax = "0.5"
|
||||||
arrayvec = { version = "0.7.4", optional = true }
|
arrayvec = { version = "0.7.4", optional = true }
|
||||||
|
@ -37,7 +37,9 @@
|
|||||||
//! [`EntityWorldMut::remove`]: crate::world::EntityWorldMut::remove
|
//! [`EntityWorldMut::remove`]: crate::world::EntityWorldMut::remove
|
||||||
mod map_entities;
|
mod map_entities;
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
|
use bevy_reflect::Reflect;
|
||||||
|
#[cfg(all(feature = "bevy_reflect", feature = "serde"))]
|
||||||
|
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
||||||
pub use map_entities::*;
|
pub use map_entities::*;
|
||||||
|
|
||||||
mod hash;
|
mod hash;
|
||||||
@ -55,6 +57,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
storage::{SparseSetIndex, TableId, TableRow},
|
storage::{SparseSetIndex, TableId, TableRow},
|
||||||
};
|
};
|
||||||
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{fmt, hash::Hash, mem, num::NonZeroU32, sync::atomic::Ordering};
|
use std::{fmt, hash::Hash, mem, num::NonZeroU32, sync::atomic::Ordering};
|
||||||
|
|
||||||
@ -141,9 +144,10 @@ type IdCursor = isize;
|
|||||||
/// [SemVer]: https://semver.org/
|
/// [SemVer]: https://semver.org/
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
|
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
|
||||||
|
#[cfg_attr(feature = "bevy_reflect", reflect_value(Hash, PartialEq))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "bevy_reflect",
|
all(feature = "bevy_reflect", feature = "serde"),
|
||||||
reflect_value(Hash, PartialEq, Serialize, Deserialize)
|
reflect_value(Serialize, Deserialize)
|
||||||
)]
|
)]
|
||||||
// Alignment repr necessary to allow LLVM to better output
|
// Alignment repr necessary to allow LLVM to better output
|
||||||
// optimised codegen for `to_bits`, `PartialEq` and `Ord`.
|
// optimised codegen for `to_bits`, `PartialEq` and `Ord`.
|
||||||
@ -364,6 +368,7 @@ impl From<Entity> for Identifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "serde")]
|
||||||
impl Serialize for Entity {
|
impl Serialize for Entity {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
@ -373,6 +378,7 @@ impl Serialize for Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "serde")]
|
||||||
impl<'de> Deserialize<'de> for Entity {
|
impl<'de> Deserialize<'de> for Entity {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
|
@ -14,7 +14,6 @@ toml_edit = { version = "0.22.7", default-features = false, features = [
|
|||||||
] }
|
] }
|
||||||
syn = "2.0"
|
syn = "2.0"
|
||||||
quote = "1.0"
|
quote = "1.0"
|
||||||
rustc-hash = "1.0"
|
|
||||||
proc-macro2 = "1.0"
|
proc-macro2 = "1.0"
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use proc_macro::{TokenStream, TokenTree};
|
use proc_macro::{TokenStream, TokenTree};
|
||||||
use quote::{quote, quote_spanned};
|
use quote::{quote, quote_spanned};
|
||||||
use rustc_hash::FxHashSet;
|
use std::collections::HashSet;
|
||||||
use syn::{spanned::Spanned, Ident};
|
use syn::{spanned::Spanned, Ident};
|
||||||
|
|
||||||
/// Finds an identifier that will not conflict with the specified set of tokens.
|
/// Finds an identifier that will not conflict with the specified set of tokens.
|
||||||
@ -15,7 +15,7 @@ pub fn ensure_no_collision(value: Ident, haystack: TokenStream) -> Ident {
|
|||||||
// List of token streams that will be visited in future loop iterations.
|
// List of token streams that will be visited in future loop iterations.
|
||||||
let mut unvisited = vec![haystack];
|
let mut unvisited = vec![haystack];
|
||||||
// Identifiers we have found while searching tokens.
|
// Identifiers we have found while searching tokens.
|
||||||
let mut found = FxHashSet::default();
|
let mut found = HashSet::new();
|
||||||
while let Some(tokens) = unvisited.pop() {
|
while let Some(tokens) = unvisited.pop() {
|
||||||
for t in tokens {
|
for t in tokens {
|
||||||
match t {
|
match t {
|
||||||
|
@ -16,7 +16,7 @@ shader_format_glsl = ["bevy_render/shader_format_glsl"]
|
|||||||
trace = ["bevy_render/trace"]
|
trace = ["bevy_render/trace"]
|
||||||
ios_simulator = ["bevy_render/ios_simulator"]
|
ios_simulator = ["bevy_render/ios_simulator"]
|
||||||
# Enables the meshlet renderer for dense high-poly scenes (experimental)
|
# Enables the meshlet renderer for dense high-poly scenes (experimental)
|
||||||
meshlet = []
|
meshlet = ["dep:range-alloc", "dep:bincode"]
|
||||||
# Enables processing meshes into meshlet meshes
|
# Enables processing meshes into meshlet meshes
|
||||||
meshlet_processor = ["dep:meshopt", "dep:thiserror"]
|
meshlet_processor = ["dep:meshopt", "dep:thiserror"]
|
||||||
|
|
||||||
@ -47,8 +47,8 @@ bytemuck = { version = "1", features = ["derive", "must_cast"] }
|
|||||||
radsort = "0.1"
|
radsort = "0.1"
|
||||||
smallvec = "1.6"
|
smallvec = "1.6"
|
||||||
serde = { version = "1", features = ["derive", "rc"] }
|
serde = { version = "1", features = ["derive", "rc"] }
|
||||||
bincode = "1"
|
bincode = { version = "1", optional = true }
|
||||||
range-alloc = "0.1"
|
range-alloc = { version = "0.1", optional = true }
|
||||||
nonmax = "0.5"
|
nonmax = "0.5"
|
||||||
static_assertions = "1"
|
static_assertions = "1"
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ bevy_app = { path = "../bevy_app", version = "0.14.0-dev" }
|
|||||||
bevy_asset = { path = "../bevy_asset", version = "0.14.0-dev" }
|
bevy_asset = { path = "../bevy_asset", version = "0.14.0-dev" }
|
||||||
bevy_color = { path = "../bevy_color", version = "0.14.0-dev", features = [
|
bevy_color = { path = "../bevy_color", version = "0.14.0-dev", features = [
|
||||||
"serialize",
|
"serialize",
|
||||||
|
"wgpu-types",
|
||||||
] }
|
] }
|
||||||
bevy_core = { path = "../bevy_core", version = "0.14.0-dev" }
|
bevy_core = { path = "../bevy_core", version = "0.14.0-dev" }
|
||||||
bevy_derive = { path = "../bevy_derive", version = "0.14.0-dev" }
|
bevy_derive = { path = "../bevy_derive", version = "0.14.0-dev" }
|
||||||
@ -82,7 +83,6 @@ serde = { version = "1", features = ["derive"] }
|
|||||||
bitflags = { version = "2.3", features = ["serde"] }
|
bitflags = { version = "2.3", features = ["serde"] }
|
||||||
bytemuck = { version = "1.5", features = ["derive", "must_cast"] }
|
bytemuck = { version = "1.5", features = ["derive", "must_cast"] }
|
||||||
downcast-rs = "1.2.0"
|
downcast-rs = "1.2.0"
|
||||||
thread_local = "1.1"
|
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
futures-lite = "2.0.1"
|
futures-lite = "2.0.1"
|
||||||
hexasphere = "10.0"
|
hexasphere = "10.0"
|
||||||
|
@ -10,7 +10,7 @@ keywords = ["bevy"]
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["serialize"]
|
default = ["serialize"]
|
||||||
serialize = ["dep:serde", "uuid/serde"]
|
serialize = ["dep:serde", "uuid/serde", "bevy_app/serialize"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# bevy
|
# bevy
|
||||||
|
@ -9,15 +9,15 @@ license = "MIT OR Apache-2.0"
|
|||||||
keywords = ["bevy"]
|
keywords = ["bevy"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
multi-threaded = []
|
multi-threaded = ["dep:async-channel", "dep:async-task", "dep:concurrent-queue"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures-lite = "2.0.1"
|
futures-lite = "2.0.1"
|
||||||
async-executor = "1.7.2"
|
async-executor = "1.7.2"
|
||||||
async-channel = "2.2.0"
|
async-channel = { version = "2.2.0", optional = true }
|
||||||
async-io = { version = "2.0.0", optional = true }
|
async-io = { version = "2.0.0", optional = true }
|
||||||
async-task = "4.2.0"
|
async-task = { version = "4.2.0", optional = true }
|
||||||
concurrent-queue = "2.0.0"
|
concurrent-queue = { version = "2.0.0", optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
wasm-bindgen-futures = "0.4"
|
wasm-bindgen-futures = "0.4"
|
||||||
|
Loading…
Reference in New Issue
Block a user