From 8bb44686cb9faf7e1d98ea4f51592a180229f4f0 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Thu, 30 Jan 2025 22:40:48 +0100 Subject: [PATCH] Fix issue with #[cfg(..)] in release-ci --- godot-codegen/src/generator/mod.rs | 11 +++++++++-- godot/src/lib.rs | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/godot-codegen/src/generator/mod.rs b/godot-codegen/src/generator/mod.rs index c7f9e2e5b..3debd075a 100644 --- a/godot-codegen/src/generator/mod.rs +++ b/godot-codegen/src/generator/mod.rs @@ -40,6 +40,14 @@ pub mod virtual_hashes; // - native_structures pub fn generate_sys_module_file(sys_gen_path: &Path, submit_fn: &mut SubmitFn) { + // Don't delegate #[cfg] to generated code; causes issues in release CI, reproducible with: + // cargo clippy --features godot/experimental-godot-api,godot/codegen-rustfmt,godot/serde + let virtual_hashes_mod = if cfg!(since_api = "4.4") { + quote! { pub mod virtual_hashes; } + } else { + quote! {} + }; + let code = quote! { pub mod table_builtins; pub mod table_builtins_lifecycle; @@ -47,8 +55,7 @@ pub fn generate_sys_module_file(sys_gen_path: &Path, submit_fn: &mut SubmitFn) { pub mod table_scene_classes; pub mod table_editor_classes; pub mod table_utilities; - #[cfg(since_api = "4.4")] - pub mod virtual_hashes; + #virtual_hashes_mod pub mod central; pub mod gdextension_interface; diff --git a/godot/src/lib.rs b/godot/src/lib.rs index c5f687f6a..44d84c479 100644 --- a/godot/src/lib.rs +++ b/godot/src/lib.rs @@ -59,7 +59,7 @@ //! //! ## Cargo features //! -//! The following features can be enabled for this crate. All off them are off by default. +//! The following features can be enabled for this crate. All of them are off by default. //! //! Avoid `default-features = false` unless you know exactly what you are doing; it will disable some required internal features. //!