From 750b9e198dbb4c127490ac793390aa3772c7f750 Mon Sep 17 00:00:00 2001 From: Songtronix Date: Wed, 24 Jun 2020 14:35:52 +0200 Subject: [PATCH] fix: hot-anim feature --- Cargo.lock | 14 +++++++++++++- voxygen/Cargo.toml | 2 +- voxygen/src/anim/Cargo.toml | 4 ++-- voxygen/src/anim/src/dyn_lib.rs | 11 +++++++++-- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7c3998c28b..7ab782ca36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4187,6 +4187,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f" dependencies = [ "cfg-if", + "tracing-attributes", "tracing-core", ] @@ -4201,6 +4202,17 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "tracing-attributes" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.31", +] + [[package]] name = "tracing-core" version = "0.1.10" @@ -4580,8 +4592,8 @@ version = "0.6.0" dependencies = [ "lazy_static", "libloading 0.6.2", - "log", "notify", + "tracing", "vek", "veloren-common", ] diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 4f1cea843a..7118185adb 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -72,7 +72,7 @@ authc = { git = "https://gitlab.com/veloren/auth.git", rev = "223a4097f7ebc8d451 const-tweaker = { version = "0.2.5", optional = true } # Logging -tracing = { version = "0.1", default-features = false } +tracing = "0.1" tracing-subscriber = { version = "0.2.3", default-features = false, features = ["env-filter", "fmt", "chrono", "ansi", "smallvec" , "tracing-log"] } tracing-log = "0.1.1" tracing-appender = "0.1" diff --git a/voxygen/src/anim/Cargo.toml b/voxygen/src/anim/Cargo.toml index 0a2434cd64..93aa1deb71 100644 --- a/voxygen/src/anim/Cargo.toml +++ b/voxygen/src/anim/Cargo.toml @@ -11,7 +11,7 @@ name = "voxygen_anim" #crate-type = ["lib", "cdylib"] [features] -use-dyn-lib = ["libloading", "notify", "lazy_static", "log"] +use-dyn-lib = ["libloading", "notify", "lazy_static", "tracing"] be-dyn-lib = [] default = ["be-dyn-lib"] @@ -22,4 +22,4 @@ common = { package = "veloren-common", path = "../../../common" } libloading = { version = "0.6.2", optional = true } notify = { version = "5.0.0-pre.2", optional = true } lazy_static = { version = "1.4.0", optional = true } -log = { version = "0.4.8", optional = true } +tracing = { version = "0.1", optional = true } diff --git a/voxygen/src/anim/src/dyn_lib.rs b/voxygen/src/anim/src/dyn_lib.rs index b6b5d36c8a..f568fd69f8 100644 --- a/voxygen/src/anim/src/dyn_lib.rs +++ b/voxygen/src/anim/src/dyn_lib.rs @@ -7,6 +7,7 @@ use std::{ thread, time::Duration, }; +use tracing::{error, warn}; lazy_static! { pub static ref LIB: Mutex> = Mutex::new(Some(LoadedLib::compile_load())); @@ -29,9 +30,15 @@ impl LoadedLib { fn load() -> Self { #[cfg(target_os = "windows")] - let lib = Library::new("../target/debug/voxygen_anim_active.dll").unwrap(); + let lib = Library::new("../target/debug/voxygen_anim_active.dll").expect( + "To use hot animation reloading you need to uncomment a line in \ + `voxygen/src/anim/Cargo.toml`.", + ); #[cfg(not(target_os = "windows"))] - let lib = Library::new("../target/debug/libvoxygen_anim.so").unwrap(); + let lib = Library::new("../target/debug/libvoxygen_anim.so").expect( + "To use hot animation reloading you need to uncomment a line in \ + `voxygen/src/anim/Cargo.toml`.", + ); Self { lib } }