mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
default features from bevy_asset
and bevy_ecs
can actually be disabled (#3097)
# Objective - `bevy_ecs` exposes as an optional feature `bevy_reflect`. Disabling it doesn't compile. - `bevy_asset` exposes as an optional feature `filesystem_watcher`. Disabling it doesn't compile. It is also not possible to disable this feature from Bevy ## Solution - Fix compilation errors when disabling the default features. Make it possible to disable the feature `filesystem_watcher` from Bevy
This commit is contained in:
parent
71f4ff46f1
commit
ac06ea3d17
8 changed files with 29 additions and 9 deletions
|
@ -27,6 +27,7 @@ default = [
|
|||
"hdr",
|
||||
"mp3",
|
||||
"x11",
|
||||
"filesystem_watcher"
|
||||
]
|
||||
|
||||
# Force dynamic linking, which improves iterative compile times
|
||||
|
@ -68,6 +69,9 @@ mp3 = ["bevy_internal/mp3"]
|
|||
vorbis = ["bevy_internal/vorbis"]
|
||||
wav = ["bevy_internal/wav"]
|
||||
|
||||
# Enable watching file system for asset hot reload
|
||||
filesystem_watcher = ["bevy_internal/filesystem_watcher"]
|
||||
|
||||
serialize = ["bevy_internal/serialize"]
|
||||
|
||||
# Display server protocol support (X11 is enabled by default)
|
||||
|
|
|
@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
|
|||
keywords = ["bevy"]
|
||||
|
||||
[features]
|
||||
default = ["filesystem_watcher"]
|
||||
default = []
|
||||
filesystem_watcher = ["notify"]
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
use crate::{filesystem_watcher::FilesystemWatcher, AssetIo, AssetIoError, AssetServer};
|
||||
#[cfg(feature = "filesystem_watcher")]
|
||||
use crate::{filesystem_watcher::FilesystemWatcher, AssetServer};
|
||||
use crate::{AssetIo, AssetIoError};
|
||||
use anyhow::Result;
|
||||
#[cfg(feature = "filesystem_watcher")]
|
||||
use bevy_ecs::system::Res;
|
||||
use bevy_utils::{BoxedFuture, HashSet};
|
||||
use bevy_utils::BoxedFuture;
|
||||
#[cfg(feature = "filesystem_watcher")]
|
||||
use bevy_utils::HashSet;
|
||||
#[cfg(feature = "filesystem_watcher")]
|
||||
use crossbeam_channel::TryRecvError;
|
||||
use fs::File;
|
||||
use io::Read;
|
||||
#[cfg(feature = "filesystem_watcher")]
|
||||
use parking_lot::RwLock;
|
||||
#[cfg(feature = "filesystem_watcher")]
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
env, fs, io,
|
||||
env, fs,
|
||||
io::Read,
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
pub struct FileAssetIo {
|
||||
|
@ -21,6 +29,7 @@ pub struct FileAssetIo {
|
|||
impl FileAssetIo {
|
||||
pub fn new<P: AsRef<Path>>(path: P) -> Self {
|
||||
FileAssetIo {
|
||||
#[cfg(feature = "filesystem_watcher")]
|
||||
filesystem_watcher: Default::default(),
|
||||
root_path: Self::get_root_path().join(path.as_ref()),
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ keywords = ["bevy"]
|
|||
|
||||
[dependencies]
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.5.0" }
|
||||
bevy_app = { path = "../bevy_app", version = "0.5.0", features = ["bevy_reflect"] }
|
||||
bevy_derive = { path = "../bevy_derive", version = "0.5.0" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.5.0" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.5.0", features = ["bevy_reflect"] }
|
||||
bevy_math = { path = "../bevy_math", version = "0.5.0" }
|
||||
bevy_reflect = { path = "../bevy_reflect", version = "0.5.0", features = ["bevy"] }
|
||||
bevy_tasks = { path = "../bevy_tasks", version = "0.5.0" }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! Types that detect when their internal data mutate.
|
||||
|
||||
use crate::{component::ComponentTicks, system::Resource};
|
||||
#[cfg(feature = "bevy_reflect")]
|
||||
use bevy_reflect::Reflect;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
|
@ -188,9 +189,11 @@ impl_into_inner!(Mut<'a, T>, T,);
|
|||
impl_debug!(Mut<'a, T>,);
|
||||
|
||||
/// Unique mutable borrow of a Reflected component
|
||||
#[cfg(feature = "bevy_reflect")]
|
||||
pub struct ReflectMut<'a> {
|
||||
pub(crate) value: &'a mut dyn Reflect,
|
||||
pub(crate) ticks: Ticks<'a>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "bevy_reflect")]
|
||||
change_detection_impl!(ReflectMut<'a>, dyn Reflect,);
|
||||
|
|
|
@ -29,6 +29,9 @@ mp3 = ["bevy_audio/mp3"]
|
|||
vorbis = ["bevy_audio/vorbis"]
|
||||
wav = ["bevy_audio/wav"]
|
||||
|
||||
# Enable watching file system for asset hot reload
|
||||
filesystem_watcher = ["bevy_asset/filesystem_watcher"]
|
||||
|
||||
serialize = ["bevy_input/serialize"]
|
||||
|
||||
# Display server protocol support (X11 is enabled by default)
|
||||
|
|
|
@ -11,7 +11,7 @@ keywords = ["bevy"]
|
|||
[dependencies]
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.5.0" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.5.0" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.5.0", features = ["bevy_reflect"] }
|
||||
bevy_math = { path = "../bevy_math", version = "0.5.0" }
|
||||
bevy_reflect = { path = "../bevy_reflect", version = "0.5.0", features = ["bevy"] }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.5.0" }
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|hdr|[HDR](https://en.wikipedia.org/wiki/High_dynamic_range) support.|
|
||||
|mp3|MP3 audio format support.|
|
||||
|x11|Make GUI applications use X11 protocol. You could enable wayland feature to override this.|
|
||||
|filesystem_watcher|Enable watching the file system for asset hot reload|
|
||||
|
||||
## Optional Features
|
||||
|
||||
|
|
Loading…
Reference in a new issue