Skip to content

Commit f2bb63f

Browse files
committed
Codegen excludes classes only on certain targets
Newly exclude JavaObject, which now caused CI failures. Previously, classes like JavaClass etc. were not available at all, because Desktop Godot targets did not support them. Now, they are conditionally included for Wasm/Android.
1 parent 26a5aca commit f2bb63f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

godot-codegen/src/special_cases/special_cases.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub fn is_native_struct_excluded(ty: &str) -> bool {
9797
codegen_special_cases::is_native_struct_excluded(ty)
9898
}
9999

100+
#[rustfmt::skip]
100101
pub fn is_godot_type_deleted(godot_ty: &str) -> bool {
101102
// Note: parameter can be a class or builtin name, but also something like "enum::AESContext.Mode".
102103

@@ -117,15 +118,20 @@ pub fn is_godot_type_deleted(godot_ty: &str) -> bool {
117118
}
118119
}
119120

121+
// cfg!(target_os = "...") are relatively new and need more testing. If causing problems, revert to `true` (deleted) for now.
122+
// TODO(v0.5): for doc generation, consider moving the target-filters to the generated code, so that API docs still show the classes.
120123
match godot_ty {
121-
// Hardcoded cases that are not accessible.
122124
// Only on Android.
125+
| "JavaClass"
123126
| "JavaClassWrapper"
127+
| "JavaObject"
124128
| "JNISingleton"
125-
| "JavaClass"
129+
=> !cfg!(target_os = "android"),
130+
126131
// Only on Wasm.
127132
| "JavaScriptBridge"
128133
| "JavaScriptObject"
134+
=> !cfg!(target_os = "emscripten"),
129135

130136
// Thread APIs.
131137
| "Thread"

0 commit comments

Comments
 (0)