Skip to content

Commit 387bd81

Browse files
authored
Merge pull request #942 from godot-rust/bugfix/register-docs-tests
Fix `register-docs` feature not being tested
2 parents 361aec8 + fba9f61 commit 387bd81

File tree

22 files changed

+69
-51
lines changed

22 files changed

+69
-51
lines changed

.github/workflows/full-ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ on:
1313

1414

1515
env:
16-
GDEXT_FEATURES: ''
16+
# Applies to all 'register-docs' features across crates.
17+
CLIPPY_FEATURES: '--features register-docs'
18+
TEST_FEATURES: ''
1719
RETRY: ${{ github.workspace }}/.github/other/retry.sh
1820

1921
# ASan options: https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
@@ -99,7 +101,7 @@ jobs:
99101
# Note: could use `-- --no-deps` to not lint dependencies, however it doesn't really speed up and also skips deps in workspace.
100102
- name: "Check clippy"
101103
run: |
102-
cargo clippy --all-targets $GDEXT_FEATURES -- \
104+
cargo clippy --all-targets $CLIPPY_FEATURES -- \
103105
-D clippy::suspicious \
104106
-D clippy::style \
105107
-D clippy::complexity \
@@ -161,10 +163,10 @@ jobs:
161163
run: cargo +nightly update -Z minimal-versions
162164

163165
- name: "Compile tests"
164-
run: cargo test $GDEXT_FEATURES --no-run ${{ matrix.rust-extra-args }}
166+
run: cargo test $TEST_FEATURES --no-run ${{ matrix.rust-extra-args }}
165167

166168
- name: "Test"
167-
run: cargo test $GDEXT_FEATURES ${{ matrix.rust-extra-args }}
169+
run: cargo test $TEST_FEATURES ${{ matrix.rust-extra-args }}
168170

169171

170172
miri-test:

.github/workflows/minimal-ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ on:
2121

2222

2323
env:
24-
GDEXT_FEATURES: ''
25-
# GDEXT_FEATURES: '--features crate/feature'
24+
# Applies to all 'register-docs' features across crates.
25+
CLIPPY_FEATURES: '--features register-docs'
26+
TEST_FEATURES: ''
2627
# GDEXT_CRATE_ARGS: '-p godot-codegen -p godot-ffi -p godot-core -p godot-macros -p godot'
2728
RETRY: ${{ github.workspace }}/.github/other/retry.sh
2829

@@ -96,7 +97,7 @@ jobs:
9697

9798
- name: "Check clippy"
9899
run: |
99-
cargo clippy --all-targets $GDEXT_FEATURES -- \
100+
cargo clippy --all-targets $CLIPPY_FEATURES -- \
100101
-D clippy::suspicious \
101102
-D clippy::style \
102103
-D clippy::complexity \
@@ -120,10 +121,10 @@ jobs:
120121
uses: ./.github/composite/rust
121122

122123
- name: "Compile tests"
123-
run: cargo test $GDEXT_FEATURES --no-run
124+
run: cargo test $TEST_FEATURES --no-run
124125

125126
- name: "Test"
126-
run: cargo test $GDEXT_FEATURES
127+
run: cargo test $TEST_FEATURES
127128

128129

129130
# For complex matrix workflow, see https://stackoverflow.com/a/65434401

godot-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ homepage = "https://godot-rust.github.io"
1212

1313
[features]
1414
default = []
15-
docs = []
15+
register-docs = []
1616
codegen-rustfmt = ["godot-ffi/codegen-rustfmt", "godot-codegen/codegen-rustfmt"]
1717
codegen-full = ["godot-codegen/codegen-full"]
1818
codegen-lazy-fptrs = [

godot-core/src/docs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ pub fn gather_xml_docs() -> impl Iterator<Item = String> {
8989
PluginItem::Struct {
9090
docs: Some(docs), ..
9191
} => map.entry(class_name).or_default().definition = docs,
92+
9293
_ => (),
9394
}
9495
});

godot-core/src/init/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ unsafe fn gdext_on_level_init(level: InitLevel) {
143143
unsafe { ensure_godot_features_compatible() };
144144
}
145145
InitLevel::Editor => {
146-
#[cfg(all(since_api = "4.3", feature = "docs"))]
146+
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
147147
// SAFETY: Godot binding is initialized, and this is called from the main thread.
148148
unsafe {
149149
crate::docs::register();

godot-core/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
pub mod builder;
1616
pub mod builtin;
1717
pub mod classes;
18-
#[cfg(all(since_api = "4.3", feature = "docs"))]
18+
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
1919
pub mod docs;
2020
#[doc(hidden)]
2121
pub mod possibly_docs {
22-
#[cfg(all(since_api = "4.3", feature = "docs"))]
22+
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
2323
pub use crate::docs::*;
2424
}
2525
pub mod global;
@@ -35,7 +35,7 @@ pub use godot_ffi as sys;
3535
// ----------------------------------------------------------------------------------------------------------------------------------------------
3636
// Validations (see also godot/lib.rs)
3737

38-
#[cfg(all(feature = "docs", before_api = "4.3"))]
38+
#[cfg(all(feature = "register-docs", before_api = "4.3"))]
3939
compile_error!("Generating editor docs for Rust symbols requires at least Godot 4.3.");
4040

4141
// ----------------------------------------------------------------------------------------------------------------------------------------------

godot-core/src/registry/class.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ fn fill_class_info(item: PluginItem, c: &mut ClassRegistrationInfo) {
243243
is_editor_plugin,
244244
is_internal,
245245
is_instantiable,
246-
#[cfg(all(since_api = "4.3", feature = "docs"))]
246+
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
247247
docs: _,
248248
} => {
249249
c.parent_class_name = Some(base_class_name);
@@ -296,7 +296,7 @@ fn fill_class_info(item: PluginItem, c: &mut ClassRegistrationInfo) {
296296
PluginItem::InherentImpl(InherentImpl {
297297
register_methods_constants_fn,
298298
register_rpcs_fn: _,
299-
#[cfg(all(since_api = "4.3", feature = "docs"))]
299+
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
300300
docs: _,
301301
}) => {
302302
c.register_methods_constants_fn = Some(register_methods_constants_fn);
@@ -315,7 +315,7 @@ fn fill_class_info(item: PluginItem, c: &mut ClassRegistrationInfo) {
315315
user_free_property_list_fn,
316316
user_property_can_revert_fn,
317317
user_property_get_revert_fn,
318-
#[cfg(all(since_api = "4.3", feature = "docs"))]
318+
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
319319
virtual_method_docs: _,
320320
} => {
321321
c.user_register_fn = user_register_fn;

godot-core/src/registry/plugin.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
66
*/
77

8-
#[cfg(all(since_api = "4.3", feature = "docs"))]
8+
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
99
use crate::docs::*;
1010
use crate::init::InitLevel;
1111
use crate::meta::ClassName;
@@ -65,7 +65,7 @@ pub struct InherentImpl {
6565
///
6666
/// This function is called in [`UserClass::__before_ready()`](crate::obj::UserClass::__before_ready) definitions generated by the `#[derive(GodotClass)]` macro.
6767
pub register_rpcs_fn: Option<ErasedRegisterRpcsFn>,
68-
#[cfg(all(since_api = "4.3", feature = "docs"))]
68+
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
6969
pub docs: InherentImplDocs,
7070
}
7171

@@ -121,7 +121,7 @@ pub enum PluginItem {
121121

122122
/// Whether the class has a default constructor.
123123
is_instantiable: bool,
124-
#[cfg(all(since_api = "4.3", feature = "docs"))]
124+
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
125125
docs: Option<StructDocs>,
126126
},
127127

@@ -130,7 +130,7 @@ pub enum PluginItem {
130130

131131
/// Collected from `#[godot_api] impl I... for MyClass`.
132132
ITraitImpl {
133-
#[cfg(all(since_api = "4.3", feature = "docs"))]
133+
#[cfg(all(since_api = "4.3", feature = "register-docs"))]
134134
/// Virtual method documentation.
135135
virtual_method_docs: &'static str,
136136
/// Callback to user-defined `register_class` function.

godot-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ homepage = "https://godot-rust.github.io"
1212

1313
[features]
1414
api-custom = ["godot-bindings/api-custom"]
15-
docs = ["dep:markdown"]
15+
register-docs = ["dep:markdown"]
1616
codegen-full = ["godot/__codegen-full"]
1717

1818
[lib]

godot-macros/src/class/data_models/field.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct Field {
1515
pub var: Option<FieldVar>,
1616
pub export: Option<FieldExport>,
1717
pub is_onready: bool,
18-
#[cfg(feature = "docs")]
18+
#[cfg(feature = "register-docs")]
1919
pub attributes: Vec<venial::Attribute>,
2020
}
2121

@@ -28,7 +28,7 @@ impl Field {
2828
var: None,
2929
export: None,
3030
is_onready: false,
31-
#[cfg(feature = "docs")]
31+
#[cfg(feature = "register-docs")]
3232
attributes: field.attributes.clone(),
3333
}
3434
}

0 commit comments

Comments
 (0)