mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +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
3ced49f672
commit
effbcdfc92
5 changed files with 8 additions and 8 deletions
|
@ -13,7 +13,6 @@ 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 +23,6 @@ bevy_utils = { path = "../bevy_utils", version = "0.14.0-rc.2" }
|
||||||
bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-rc.2" }
|
bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-rc.2" }
|
||||||
|
|
||||||
# other
|
# other
|
||||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
|
||||||
downcast-rs = "1.2.0"
|
downcast-rs = "1.2.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ trace = []
|
||||||
multi_threaded = ["bevy_tasks/multi_threaded", "arrayvec"]
|
multi_threaded = ["bevy_tasks/multi_threaded", "arrayvec"]
|
||||||
bevy_debug_stepping = []
|
bevy_debug_stepping = []
|
||||||
default = ["bevy_reflect"]
|
default = ["bevy_reflect"]
|
||||||
|
serialize = ["dep:serde"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy_ptr = { path = "../bevy_ptr", version = "0.14.0-rc.2" }
|
bevy_ptr = { path = "../bevy_ptr", version = "0.14.0-rc.2" }
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
mod map_entities;
|
mod map_entities;
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::Reflect;
|
||||||
#[cfg(all(feature = "bevy_reflect", feature = "serde"))]
|
#[cfg(all(feature = "bevy_reflect", feature = "serialize"))]
|
||||||
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
||||||
pub use map_entities::*;
|
pub use map_entities::*;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ use crate::{
|
||||||
},
|
},
|
||||||
storage::{SparseSetIndex, TableId, TableRow},
|
storage::{SparseSetIndex, TableId, TableRow},
|
||||||
};
|
};
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serialize")]
|
||||||
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};
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ type IdCursor = isize;
|
||||||
#[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(feature = "bevy_reflect", reflect_value(Hash, PartialEq))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
all(feature = "bevy_reflect", feature = "serde"),
|
all(feature = "bevy_reflect", feature = "serialize"),
|
||||||
reflect_value(Serialize, Deserialize)
|
reflect_value(Serialize, Deserialize)
|
||||||
)]
|
)]
|
||||||
// Alignment repr necessary to allow LLVM to better output
|
// 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 {
|
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
|
||||||
|
@ -378,7 +378,7 @@ impl Serialize for Entity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serialize")]
|
||||||
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
|
||||||
|
|
|
@ -71,6 +71,7 @@ shader_format_spirv = ["bevy_render/shader_format_spirv"]
|
||||||
serialize = [
|
serialize = [
|
||||||
"bevy_core/serialize",
|
"bevy_core/serialize",
|
||||||
"bevy_input/serialize",
|
"bevy_input/serialize",
|
||||||
|
"bevy_ecs/serialize",
|
||||||
"bevy_time/serialize",
|
"bevy_time/serialize",
|
||||||
"bevy_window/serialize",
|
"bevy_window/serialize",
|
||||||
"bevy_winit?/serialize",
|
"bevy_winit?/serialize",
|
||||||
|
|
|
@ -10,7 +10,7 @@ keywords = ["bevy"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["serialize"]
|
default = ["serialize"]
|
||||||
serialize = ["dep:serde", "uuid/serde", "bevy_app/serialize"]
|
serialize = ["dep:serde", "uuid/serde", "bevy_ecs/serialize"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# bevy
|
# bevy
|
||||||
|
|
Loading…
Reference in a new issue