From 18742bc7fba2b7995ee2dd2aae266f3a79b5bdc8 Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Fri, 5 Jan 2024 21:36:09 +0200 Subject: [PATCH] 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. --- Cargo.lock | 1 + common/assets/src/lib.rs | 10 +++++----- common/state/Cargo.toml | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07cfe7aa8c..86350ff101 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7088,6 +7088,7 @@ dependencies = [ "tracing", "vek 0.15.8", "veloren-common", + "veloren-common-assets", "veloren-common-base", "veloren-common-ecs", "veloren-common-net", diff --git a/common/assets/src/lib.rs b/common/assets/src/lib.rs index 952c196e9d..f6368a20c9 100644 --- a/common/assets/src/lib.rs +++ b/common/assets/src/lib.rs @@ -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 = - AssetCache::with_source(fs::FileSystem::new().unwrap()); + /// The HashMap where all loaded assets are stored in. + static ref ASSETS: AssetCache = + AssetCache::with_source(fs::FileSystem::new().unwrap()); } #[cfg(feature = "hot-reloading")] diff --git a/common/state/Cargo.toml b/common/state/Cargo.toml index 2e71eb301d..a94ba64808 100644 --- a/common/state/Cargo.toml +++ b/common/state/Cargo.toml @@ -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"