diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 52fbe9a..46ee82b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,6 +31,14 @@ jobs: run: | set -o pipefail cargo build --workspace --all-features --message-format json | clippy-sarif | tee rust-build-results.sarif | sarif-fmt + - name: Build Debug Runtime + run: | + set -o pipefail + cargo build -p godot-rust-script --features "runtime" --message-format json | clippy-sarif | tee rust-build-results.sarif | sarif-fmt + - name: Build Debug Scripts + run: | + set -o pipefail + cargo build -p godot-rust-script --features "scripts" --message-format json | clippy-sarif | tee rust-build-results.sarif | sarif-fmt - name: Build Release run: | set -o pipefail diff --git a/rust-script/Cargo.toml b/rust-script/Cargo.toml index 97728a0..8a99544 100644 --- a/rust-script/Cargo.toml +++ b/rust-script/Cargo.toml @@ -18,7 +18,7 @@ process_path = { workspace = true, optional = true } godot-rust-script-derive = { workspace = true, optional = true } [dev-dependencies] -tests-scripts-lib = { path = "../tests-scripts-lib", features = ["hot-reload"] } +tests-scripts-lib = { path = "../tests-scripts-lib", features = ["test-hot-reload"] } godot-rust-script = { path = "./", features = ["runtime"] } [features] diff --git a/rust-script/src/runtime/metadata.rs b/rust-script/src/runtime/metadata.rs index ab195d5..8c73f3b 100644 --- a/rust-script/src/runtime/metadata.rs +++ b/rust-script/src/runtime/metadata.rs @@ -11,8 +11,7 @@ use godot::{ use crate::{ apply::Apply, - script_registry::{CreateScriptInstanceData_TO, RemoteGodotScript_TO}, - RemoteScriptMetaData, + script_registry::{CreateScriptInstanceData_TO, RemoteGodotScript_TO, RemoteScriptMetaData}, }; #[derive(Debug)] diff --git a/rust-script/src/runtime/mod.rs b/rust-script/src/runtime/mod.rs index ee940e3..7ac3d2a 100644 --- a/rust-script/src/runtime/mod.rs +++ b/rust-script/src/runtime/mod.rs @@ -28,10 +28,10 @@ use self::rust_script_language::RustScriptLanguage; #[cfg(all(feature = "hot-reload", debug_assertions))] use hot_reloader::{HotReloadEntry, HotReloader}; +#[cfg(all(feature = "hot-reload", debug_assertions))] #[macro_export] macro_rules! setup { ($lib_crate:tt) => { - #[cfg(all(feature = "hot-reload", debug_assertions))] #[$crate::private_export::hot_module(dylib = stringify!($lib_crate), lib_dir=process_path::get_dylib_path().and_then(|path| path.parent().map(std::path::Path::to_path_buf)).unwrap_or_default())] mod scripts_lib { use $crate::private_export::RVec; @@ -50,21 +50,37 @@ macro_rules! setup { pub use ::$lib_crate::__GODOT_RUST_SCRIPT_SRC_ROOT; } - - #[cfg(not(all(feature = "hot-reload", debug_assertions)))] + }; +} + +#[cfg(not(all(feature = "hot-reload", debug_assertions)))] +#[macro_export] +macro_rules! setup { + ($lib_crate:tt) => { mod scripts_lib { pub use ::$lib_crate::{__godot_rust_script_init, __GODOT_RUST_SCRIPT_SRC_ROOT}; } }; } +#[cfg(not(all(feature = "hot-reload", debug_assertions)))] +#[macro_export] +macro_rules! init { + () => { + $crate::RustScriptExtensionLayer::new( + scripts_lib::__godot_rust_script_init, + scripts_lib::__GODOT_RUST_SCRIPT_SRC_ROOT, + ) + }; +} + +#[cfg(all(feature = "hot-reload", debug_assertions))] #[macro_export] macro_rules! init { () => { $crate::RustScriptExtensionLayer::new( scripts_lib::__godot_rust_script_init, scripts_lib::__GODOT_RUST_SCRIPT_SRC_ROOT, - #[cfg(all(feature = "hot-reload", debug_assertions))] scripts_lib::subscribe, ) }; diff --git a/rust-script/src/shared.rs b/rust-script/src/shared.rs index 56b8c34..da88c41 100644 --- a/rust-script/src/shared.rs +++ b/rust-script/src/shared.rs @@ -1,6 +1,6 @@ use abi_stable::std_types::RVec; -use crate::RemoteScriptMetaData; +use crate::script_registry::RemoteScriptMetaData; pub type BindingInit = godot::sys::GodotBinding; diff --git a/tests-scripts-lib/Cargo.toml b/tests-scripts-lib/Cargo.toml index 534fa9b..4ee6bd6 100644 --- a/tests-scripts-lib/Cargo.toml +++ b/tests-scripts-lib/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["dylib", "rlib"] godot-rust-script = { path = "../rust-script", features = ["hot-reload", "scripts"] } [features] -hot-reload = ["godot-rust-script/hot-reload"] +test-hot-reload = ["godot-rust-script/hot-reload"]