mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 06:00:20 +00:00
Update serialize flag for bevy_ecs (#13740)
# Objective There were some issues with the `serialize` feature: - `bevy_app` had a `serialize` feature and a dependency on `serde` even there is no usage of serde at all inside `bevy_app` - the `bevy_app/serialize` feature enabled `bevy_ecs/serde`, which is strange - `bevy_internal/serialize` did not enable `bevy_app/serialize` so there was no way of serializing an Entity in bevy 0.14 ## Solution - Remove `serde` and `bevy_app/serialize` - Add a `serialize` flag on `bevy_ecs` that enables `serde` - ` bevy_internal/serialize` now enables `bevy_ecs/serialize`
This commit is contained in:
parent
70a38ab1f6
commit
93f3432400
5 changed files with 8 additions and 8 deletions
|
@ -13,7 +13,6 @@ trace = []
|
|||
bevy_debug_stepping = []
|
||||
default = ["bevy_reflect"]
|
||||
bevy_reflect = ["dep:bevy_reflect", "bevy_ecs/bevy_reflect"]
|
||||
serialize = ["bevy_ecs/serde"]
|
||||
|
||||
[dependencies]
|
||||
# bevy
|
||||
|
@ -24,7 +23,6 @@ bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
|||
bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
|
||||
|
||||
# other
|
||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||
downcast-rs = "1.2.0"
|
||||
thiserror = "1.0"
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ trace = []
|
|||
multi_threaded = ["bevy_tasks/multi_threaded", "arrayvec"]
|
||||
bevy_debug_stepping = []
|
||||
default = ["bevy_reflect"]
|
||||
serialize = ["dep:serde"]
|
||||
|
||||
[dependencies]
|
||||
bevy_ptr = { path = "../bevy_ptr", version = "0.14.0-dev" }
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
mod map_entities;
|
||||
#[cfg(feature = "bevy_reflect")]
|
||||
use bevy_reflect::Reflect;
|
||||
#[cfg(all(feature = "bevy_reflect", feature = "serde"))]
|
||||
#[cfg(all(feature = "bevy_reflect", feature = "serialize"))]
|
||||
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
||||
pub use map_entities::*;
|
||||
|
||||
|
@ -57,7 +57,7 @@ use crate::{
|
|||
},
|
||||
storage::{SparseSetIndex, TableId, TableRow},
|
||||
};
|
||||
#[cfg(feature = "serde")]
|
||||
#[cfg(feature = "serialize")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{fmt, hash::Hash, mem, num::NonZeroU32, sync::atomic::Ordering};
|
||||
|
||||
|
@ -146,7 +146,7 @@ type IdCursor = isize;
|
|||
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
|
||||
#[cfg_attr(feature = "bevy_reflect", reflect_value(Hash, PartialEq))]
|
||||
#[cfg_attr(
|
||||
all(feature = "bevy_reflect", feature = "serde"),
|
||||
all(feature = "bevy_reflect", feature = "serialize"),
|
||||
reflect_value(Serialize, Deserialize)
|
||||
)]
|
||||
// Alignment repr necessary to allow LLVM to better output
|
||||
|
@ -368,7 +368,7 @@ impl From<Entity> for Identifier {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
#[cfg(feature = "serialize")]
|
||||
impl Serialize for Entity {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
|
@ -378,7 +378,7 @@ impl Serialize for Entity {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
#[cfg(feature = "serialize")]
|
||||
impl<'de> Deserialize<'de> for Entity {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
|
|
|
@ -71,6 +71,7 @@ shader_format_spirv = ["bevy_render/shader_format_spirv"]
|
|||
serialize = [
|
||||
"bevy_core/serialize",
|
||||
"bevy_input/serialize",
|
||||
"bevy_ecs/serialize",
|
||||
"bevy_time/serialize",
|
||||
"bevy_window/serialize",
|
||||
"bevy_winit?/serialize",
|
||||
|
|
|
@ -10,7 +10,7 @@ keywords = ["bevy"]
|
|||
|
||||
[features]
|
||||
default = ["serialize"]
|
||||
serialize = ["dep:serde", "uuid/serde", "bevy_app/serialize"]
|
||||
serialize = ["dep:serde", "uuid/serde", "bevy_ecs/serialize"]
|
||||
|
||||
[dependencies]
|
||||
# bevy
|
||||
|
|
Loading…
Reference in a new issue