Fix veloren-server compilation

As veloren-server enables plugin feature automatically, it results in
veloren-common-state inherit this feature, which enables
common/state/plugin/mod.rs which asks for common::assets function that
is enabled only if plugin feature is enabled, but because
veloren-common-state doesn't depend on common::assets, this feature is
kind of lost half-way.

This commit fixes this by adding explicit optional dependency on
common-assets in common-state that is enabled by plugin feature.
This commit is contained in:
juliancoffee 2024-01-05 21:36:09 +02:00
parent f4939220cc
commit 18742bc7fb
3 changed files with 8 additions and 6 deletions

1
Cargo.lock generated
View File

@ -7088,6 +7088,7 @@ dependencies = [
"tracing",
"vek 0.15.8",
"veloren-common",
"veloren-common-assets",
"veloren-common-base",
"veloren-common-ecs",
"veloren-common-net",

View File

@ -31,14 +31,14 @@ pub use walk::{walk_tree, Walk};
#[cfg(feature = "plugins")]
lazy_static! {
/// The HashMap where all loaded assets are stored in.
static ref ASSETS: plugin_cache::CombinedCache = plugin_cache::CombinedCache::new().unwrap();
/// The HashMap where all loaded assets are stored in.
static ref ASSETS: plugin_cache::CombinedCache = plugin_cache::CombinedCache::new().unwrap();
}
#[cfg(not(feature = "plugins"))]
lazy_static! {
/// The HashMap where all loaded assets are stored in.
static ref ASSETS: AssetCache<fs::FileSystem> =
AssetCache::with_source(fs::FileSystem::new().unwrap());
/// The HashMap where all loaded assets are stored in.
static ref ASSETS: AssetCache<fs::FileSystem> =
AssetCache::with_source(fs::FileSystem::new().unwrap());
}
#[cfg(feature = "hot-reloading")]

View File

@ -6,7 +6,7 @@ version = "0.10.0"
[features]
simd = ["vek/platform_intrinsics"]
plugins = ["toml", "tar", "wasmer", "wasmer-wasix-types", "bincode", "plugin-api", "serde"]
plugins = ["common-assets/plugins", "toml", "tar", "wasmer", "wasmer-wasix-types", "bincode", "plugin-api", "serde"]
default = ["simd"]
@ -15,6 +15,7 @@ common = { package = "veloren-common", path = ".." }
common-net = { package = "veloren-common-net", path = "../net" }
common-ecs = { package = "veloren-common-ecs", path = "../ecs" }
common-base = { package = "veloren-common-base", path = "../base" }
common-assets = { package = "veloren-common-assets", path = "../assets", optional = true}
rayon = { workspace = true }
num_cpus = "1.0"