Skip to content

Commit 7e92794

Browse files
committed
Sort XML blocks for deterministic output; update expected XML
1 parent bcc4789 commit 7e92794

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

godot-core/src/docs.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ pub fn gather_xml_docs() -> impl Iterator<Item = String> {
174174
})
175175
}
176176

177-
fn wrap_in_xml_block(tag: &str, blocks: Vec<&'static str>) -> String {
177+
fn wrap_in_xml_block(tag: &str, mut blocks: Vec<&'static str>) -> String {
178+
// We sort the blocks for deterministic output. No need to sort individual methods/signals/constants, this is already done by Godot.
179+
// See https://github.com/godot-rust/gdext/pull/1391 for more information.
180+
blocks.sort();
181+
178182
let content = String::from_iter(blocks);
179183

180184
if content.is_empty() {

itest/rust/src/register_tests/res/registered_docs.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ public class Player : Node2D
2525
</description>
2626
</method>
2727

28+
<method name="secondary_but_documented">
29+
<return type="()" />
30+
<param index="0" name="smth" type="i64" />
31+
<description>
32+
Documented method in godot_api secondary block
33+
</description>
34+
</method>
35+
36+
<method name="tertiary_but_documented">
37+
<return type="()" />
38+
<param index="0" name="smth" type="i64" />
39+
<description>
40+
Documented method in other godot_api secondary block
41+
</description>
42+
</method>
43+
2844
<method name="ye">
2945
<return type="f32" />
3046

@@ -72,22 +88,6 @@ public class Player : Node2D
7288
????? probably
7389
</description>
7490
</method>
75-
76-
<method name="secondary_but_documented">
77-
<return type="()" />
78-
<param index="0" name="smth" type="i64" />
79-
<description>
80-
Documented method in godot_api secondary block
81-
</description>
82-
</method>
83-
84-
<method name="tertiary_but_documented">
85-
<return type="()" />
86-
<param index="0" name="smth" type="i64" />
87-
<description>
88-
Documented method in other godot_api secondary block
89-
</description>
90-
</method>
9191
</methods>
9292
<constants><constant name="RANDOM" value="4">Documentation.</constant><constant name="A" value="128" deprecated="Did you know that constants can be deprecated?">Hmmmm</constant><constant name="B" value="128" experimental="Did you know that constants can be experimental?">Who would know that!</constant><constant name="XML" value="1">this docstring has &lt; a special character</constant></constants>
9393
<signals>

0 commit comments

Comments
 (0)