Skip to content

Commit

Permalink
CI test do not cover separated features (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
TitanNano authored Nov 5, 2023
1 parent 54fbe15 commit 80b730c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 9 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rust-script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 1 addition & 2 deletions rust-script/src/runtime/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
24 changes: 20 additions & 4 deletions rust-script/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
)
};
Expand Down
2 changes: 1 addition & 1 deletion rust-script/src/shared.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use abi_stable::std_types::RVec;

use crate::RemoteScriptMetaData;
use crate::script_registry::RemoteScriptMetaData;

pub type BindingInit = godot::sys::GodotBinding;

Expand Down
2 changes: 1 addition & 1 deletion tests-scripts-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]



0 comments on commit 80b730c

Please sign in to comment.