File tree 3 files changed +19
-1
lines changed
3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,13 @@ use std::path::{Path, PathBuf};
43
43
44
44
pub type SubmitFn = dyn FnMut ( PathBuf , TokenStream ) ;
45
45
46
+ #[ cfg( not( feature = "codegen-full" ) ) ]
47
+ pub const IS_CODEGEN_FULL : bool = false ;
48
+
49
+ /// Used by itest to determine true codegen status; see itest/build.rs.
50
+ #[ cfg( feature = "codegen-full" ) ]
51
+ pub const IS_CODEGEN_FULL : bool = true ;
52
+
46
53
fn write_file ( path : & Path , contents : String ) {
47
54
let dir = path. parent ( ) . unwrap ( ) ;
48
55
let _ = std:: fs:: create_dir_all ( dir) ;
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ publish = false
10
10
crate-type = [" cdylib" ]
11
11
12
12
[features ]
13
- default = [" codegen-full" ]
13
+ # Default feature MUST be empty for workflow reasons, even if it differs from the default feature set in upstream `godot` crate.
14
+ default = []
14
15
codegen-full = [" godot/__codegen-full" ]
15
16
codegen-full-experimental = [" codegen-full" , " godot/experimental-godot-api" ]
16
17
experimental-threads = [" godot/experimental-threads" ]
@@ -28,6 +29,7 @@ serde_json = { version = "1.0", optional = true }
28
29
[build-dependencies ]
29
30
godot-bindings = { path = " ../../godot-bindings" } # emit_godot_version_cfg
30
31
repo-tweak = { path = " ../repo-tweak" }
32
+ godot-codegen = { path = " ../../godot-codegen" } # IS_CODEGEN_FULL
31
33
32
34
# Minimum versions compatible with -Zminimal-versions
33
35
proc-macro2 = " 1.0.80" # Literal::c_string() added in 1.0.80.
Original file line number Diff line number Diff line change @@ -269,6 +269,15 @@ fn main() {
269
269
rustfmt_if_needed ( vec ! [ rust_file] ) ;
270
270
271
271
godot_bindings:: emit_godot_version_cfg ( ) ;
272
+
273
+ // The godot crate has a __codegen-full default feature that enables the godot-codegen/codegen-full feature. When compiling the entire
274
+ // workspace itest also gets compiled with full codegen due to feature unification. This causes compiler errors since the
275
+ // itest/codegen-full feature does not automatically get enabled in such a situation.
276
+ //
277
+ // By conditionally emitting the feature config we can auto enable the feature for itest as well.
278
+ if godot_codegen:: IS_CODEGEN_FULL {
279
+ println ! ( "cargo::rustc-cfg=feature=\" codegen-full\" " ) ;
280
+ }
272
281
}
273
282
274
283
// TODO remove, or remove code duplication with codegen
You can’t perform that action at this time.
0 commit comments