Skip to content

Commit 5f38883

Browse files
bors[bot]Bromeon
andauthored
Merge #860
860: Update XML docs to Godot 3.4, output docs for 'custom-godot' r=Bromeon a=Bromeon Co-authored-by: Jan Haller <[email protected]>
2 parents 1e4ab8b + 3679c22 commit 5f38883

File tree

563 files changed

+13175
-21361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

563 files changed

+13175
-21361
lines changed

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018
3+
Copyright (c) 2017-2022 The godot-rust team
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

bindings-generator/src/godot_api_json.rs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::godot_version;
2+
use std::fs;
23
use std::path::PathBuf;
34
use std::process::Command;
45

@@ -43,20 +44,50 @@ pub fn generate_json_if_needed() -> bool {
4344
exec(
4445
if has_generate_bug { 10 } else { 1 },
4546
Command::new(&godot_bin)
47+
.arg("--no-window")
4648
.arg("--gdnative-generate-json-api")
4749
.arg("api.json"),
4850
);
4951

52+
// Best effort for generating the XML documentation
53+
// Note: this documentation is not the same as shipped by official Godot releases, but it's the best we have.
54+
exec_maybe(
55+
1,
56+
Command::new(&godot_bin)
57+
.arg("--no-window")
58+
.arg("--doctool")
59+
.arg("."),
60+
);
61+
62+
// Godot output structure required structure
63+
//
64+
// +-- api.json
65+
// +-- modules +-- api.json
66+
// +-- doc +-- docs [*]
67+
// +-- classes [*]
68+
//
69+
let _ = fs::remove_dir_all("docs");
70+
let _ = fs::rename("doc/classes", "docs");
71+
let _ = fs::remove_dir("doc");
72+
let _ = fs::remove_dir_all("modules");
73+
5074
true
5175
}
5276

5377
/// Executes a command and returns stdout. Panics on failure.
5478
fn exec(attempts: i32, command: &mut Command) -> String {
79+
exec_maybe(attempts, command)
80+
.unwrap_or_else(|| panic!("Could not execute Godot command (see above)."))
81+
}
82+
83+
fn exec_maybe(attempts: i32, command: &mut Command) -> Option<String> {
5584
let command_line = format!("{:?}", command);
5685

5786
for _attempt in 0..attempts {
5887
match command.output() {
59-
Ok(output) => return String::from_utf8(output.stdout).expect("parse UTF8 string"),
88+
Ok(output) => {
89+
return Some(String::from_utf8(output.stdout).expect("parse UTF8 string"))
90+
}
6091
Err(err) => {
6192
eprintln!(
6293
"Godot command failed:\n command: {}\n error: {}",
@@ -66,5 +97,5 @@ fn exec(attempts: i32, command: &mut Command) -> String {
6697
}
6798
}
6899

69-
panic!("Could not execute Godot command (see above).")
100+
None
70101
}

gdnative-bindings/build.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ fn main() {
3333
format_file_if_needed(&generated_rs);
3434
format_file_if_needed(&icalls_rs);
3535

36-
// build.rs will automatically be recompiled and run if it's dependencies are updated.
37-
// Ignoring all but build.rs will keep from needless rebuilds.
38-
// Manually rebuilding the crate will ignore this.
39-
println!("cargo:rerun-if-changed=docs/");
36+
// build.rs will automatically be recompiled and run if its dependencies are updated.
37+
// Ignoring everything but build.rs will avoid needless rebuilds.
38+
// Manually rebuilding the crate does not affect this.
4039
println!("cargo:rerun-if-changed=build.rs");
4140

42-
// Avoid endless recompiling, if this script generates api.json
41+
// Avoid endless recompiling, if this script generates api.json and docs
4342
if !just_generated_api {
43+
println!("cargo:rerun-if-changed=docs/");
4444
println!("cargo:rerun-if-changed=api.json");
4545
}
4646
}

gdnative-bindings/docs/@GlobalScope.xml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2-
<class name="@GlobalScope" version="3.3">
2+
<class name="@GlobalScope" version="3.4">
33
<brief_description>
44
Global scope constants and variables.
55
</brief_description>
@@ -883,7 +883,7 @@
883883
<constant name="KEY_MASK_CTRL" value="268435456" enum="KeyModifierMask">
884884
Ctrl key mask.
885885
</constant>
886-
<constant name="KEY_MASK_CMD" value="268435456" enum="KeyModifierMask">
886+
<constant name="KEY_MASK_CMD" value="platform-dependent" enum="KeyModifierMask">
887887
Command key mask. On macOS, this is equivalent to [constant KEY_MASK_META]. On other platforms, this is equivalent to [constant KEY_MASK_CTRL]. This mask should be preferred to [constant KEY_MASK_META] or [constant KEY_MASK_CTRL] for system shortcuts as it handles all platforms correctly.
888888
</constant>
889889
<constant name="KEY_MASK_KPAD" value="536870912" enum="KeyModifierMask">
@@ -1003,7 +1003,10 @@
10031003
<constant name="JOY_BUTTON_21" value="21" enum="JoystickList">
10041004
Gamepad button 21.
10051005
</constant>
1006-
<constant name="JOY_BUTTON_MAX" value="22" enum="JoystickList">
1006+
<constant name="JOY_BUTTON_22" value="22" enum="JoystickList">
1007+
Gamepad button 22.
1008+
</constant>
1009+
<constant name="JOY_BUTTON_MAX" value="23" enum="JoystickList">
10071010
Represents the maximum number of joystick buttons supported.
10081011
</constant>
10091012
<constant name="JOY_SONY_CIRCLE" value="1" enum="JoystickList">
@@ -1081,22 +1084,25 @@
10811084
<constant name="JOY_DPAD_RIGHT" value="15" enum="JoystickList">
10821085
Gamepad DPad right.
10831086
</constant>
1084-
<constant name="JOY_MISC1" value="16" enum="JoystickList">
1087+
<constant name="JOY_GUIDE" value="16" enum="JoystickList">
1088+
Gamepad SDL guide button.
1089+
</constant>
1090+
<constant name="JOY_MISC1" value="17" enum="JoystickList">
10851091
Gamepad SDL miscellaneous button.
10861092
</constant>
1087-
<constant name="JOY_PADDLE1" value="17" enum="JoystickList">
1093+
<constant name="JOY_PADDLE1" value="18" enum="JoystickList">
10881094
Gamepad SDL paddle 1 button.
10891095
</constant>
1090-
<constant name="JOY_PADDLE2" value="18" enum="JoystickList">
1096+
<constant name="JOY_PADDLE2" value="19" enum="JoystickList">
10911097
Gamepad SDL paddle 2 button.
10921098
</constant>
1093-
<constant name="JOY_PADDLE3" value="19" enum="JoystickList">
1099+
<constant name="JOY_PADDLE3" value="20" enum="JoystickList">
10941100
Gamepad SDL paddle 3 button.
10951101
</constant>
1096-
<constant name="JOY_PADDLE4" value="20" enum="JoystickList">
1102+
<constant name="JOY_PADDLE4" value="21" enum="JoystickList">
10971103
Gamepad SDL paddle 4 button.
10981104
</constant>
1099-
<constant name="JOY_TOUCHPAD" value="21" enum="JoystickList">
1105+
<constant name="JOY_TOUCHPAD" value="22" enum="JoystickList">
11001106
Gamepad SDL touchpad button.
11011107
</constant>
11021108
<constant name="JOY_L" value="4" enum="JoystickList">
@@ -1364,7 +1370,7 @@
13641370
Hints that an integer or float property should be within a range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_lesser"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"-360,360,1,or_greater,or_lesser"[/code].
13651371
</constant>
13661372
<constant name="PROPERTY_HINT_EXP_RANGE" value="2" enum="PropertyHint">
1367-
Hints that an integer or float property should be within an exponential range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_lesser"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"0.01,100,0.01,or_greater"[/code].
1373+
Hints that a float property should be within an exponential range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_lesser"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"0.01,100,0.01,or_greater"[/code].
13681374
</constant>
13691375
<constant name="PROPERTY_HINT_ENUM" value="3" enum="PropertyHint">
13701376
Hints that an integer, float or string property is an enumerated value to pick in a list specified via a hint string such as [code]"Hello,Something,Else"[/code].

0 commit comments

Comments
 (0)