Skip to content

Commit 36a359b

Browse files
committed
Further updates to version-sync
1 parent b81103c commit 36a359b

File tree

9 files changed

+105
-66
lines changed

9 files changed

+105
-66
lines changed

.github/composite/godot-itest/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ runs:
104104
echo "Default prebuilt version: $defaultVersion"
105105
fi
106106
107-
# Apply [patch] for godot4-prebuilt crate if needed.
107+
# Specify `api-*` feature for godot crate if needed.
108108
if [[ "$PATCHED_VERSION" != $defaultVersion ]]; then
109109
.github/other/patch-prebuilt.sh "$PATCHED_VERSION"
110110
fi

godot-bindings/Cargo.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ categories = ["game-engines", "graphics"]
1313
# The artifact generator explicitly excludes that though (to avoid a quasi-circular dependency back to its repo).
1414
[features]
1515
# [version-sync] [[
16-
# [repeat] past
17-
# [fmt] api-$kebabVersion = ["dep:prebuilt-$kebabVersion"]
16+
# [line] api-$kebabVersion = ["dep:prebuilt-$kebabVersion"]
1817
api-4-0 = ["dep:prebuilt-4-0"]
1918
api-4-0-1 = ["dep:prebuilt-4-0-1"]
2019
api-4-0-2 = ["dep:prebuilt-4-0-2"]
@@ -25,11 +24,14 @@ api-4-1-1 = ["dep:prebuilt-4-1-1"]
2524
api-4-1-2 = ["dep:prebuilt-4-1-2"]
2625
api-4-1-3 = ["dep:prebuilt-4-1-3"]
2726
api-4-1-4 = ["dep:prebuilt-4-1-4"]
27+
api-4-2 = ["dep:prebuilt-4-2"]
28+
api-4-2-1 = ["dep:prebuilt-4-2-1"]
29+
api-4-2-2 = ["dep:prebuilt-4-2-2"]
2830
# ]]
2931

3032
# [version-sync] [[
31-
# [repeat] current.minor
32-
# [fmt] default = ["dep:prebuilt-$kebabVersion"]
33+
# [include] current.minor
34+
# [line] default = ["dep:prebuilt-$kebabVersion"]
3335
default = ["dep:prebuilt-4-2"]
3436
# ]]
3537

@@ -38,8 +40,7 @@ api-custom-extheader = []
3840

3941
[dependencies]
4042
# [version-sync] [[
41-
# [repeat] past+current
42-
# [fmt] prebuilt-$kebabVersion = { optional = true, package = "godot4-prebuilt", git = "https://github.com/godot-rust/godot4-prebuilt", branch = "$dotVersion" }
43+
# [line] prebuilt-$kebabVersion = { optional = true, package = "godot4-prebuilt", git = "https://github.com/godot-rust/godot4-prebuilt", branch = "$dotVersion" }
4344
prebuilt-4-0 = { optional = true, package = "godot4-prebuilt", git = "https://github.com/godot-rust/godot4-prebuilt", branch = "4.0" }
4445
prebuilt-4-0-1 = { optional = true, package = "godot4-prebuilt", git = "https://github.com/godot-rust/godot4-prebuilt", branch = "4.0.1" }
4546
prebuilt-4-0-2 = { optional = true, package = "godot4-prebuilt", git = "https://github.com/godot-rust/godot4-prebuilt", branch = "4.0.2" }

godot-bindings/src/import.rs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
/// All stable Godot releases _and_ upcoming next minor release.
1414
pub const ALL_VERSIONS: &[(u8, u8, u8)] = &[
1515
// [version-sync] [[
16-
// [repeat] past+current+future
17-
// [fmt] \t$triple,
16+
// [include] past+current+future
17+
// [line] \t$triple,
1818
(4, 0, 0),
1919
(4, 0, 1),
2020
(4, 0, 2),
@@ -33,54 +33,52 @@ pub const ALL_VERSIONS: &[(u8, u8, u8)] = &[
3333
];
3434

3535
// [version-sync] [[
36-
// [repeat] past+current
37-
// [fmt] #[cfg(feature = "api-$kebabVersion")]\npub use prebuilt_$snakeVersion as godot4_prebuilt;\n
36+
// [line] #[cfg(feature = "api-$kebabVersion")]\npub use prebuilt_$snakeVersion as prebuilt;\n
3837
#[cfg(feature = "api-4-0")]
39-
pub use prebuilt_4_0 as godot4_prebuilt;
38+
pub use prebuilt_4_0 as prebuilt;
4039

4140
#[cfg(feature = "api-4-0-1")]
42-
pub use prebuilt_4_0_1 as godot4_prebuilt;
41+
pub use prebuilt_4_0_1 as prebuilt;
4342

4443
#[cfg(feature = "api-4-0-2")]
45-
pub use prebuilt_4_0_2 as godot4_prebuilt;
44+
pub use prebuilt_4_0_2 as prebuilt;
4645

4746
#[cfg(feature = "api-4-0-3")]
48-
pub use prebuilt_4_0_3 as godot4_prebuilt;
47+
pub use prebuilt_4_0_3 as prebuilt;
4948

5049
#[cfg(feature = "api-4-0-4")]
51-
pub use prebuilt_4_0_4 as godot4_prebuilt;
50+
pub use prebuilt_4_0_4 as prebuilt;
5251

5352
#[cfg(feature = "api-4-1")]
54-
pub use prebuilt_4_1 as godot4_prebuilt;
53+
pub use prebuilt_4_1 as prebuilt;
5554

5655
#[cfg(feature = "api-4-1-1")]
57-
pub use prebuilt_4_1_1 as godot4_prebuilt;
56+
pub use prebuilt_4_1_1 as prebuilt;
5857

5958
#[cfg(feature = "api-4-1-2")]
60-
pub use prebuilt_4_1_2 as godot4_prebuilt;
59+
pub use prebuilt_4_1_2 as prebuilt;
6160

6261
#[cfg(feature = "api-4-1-3")]
63-
pub use prebuilt_4_1_3 as godot4_prebuilt;
62+
pub use prebuilt_4_1_3 as prebuilt;
6463

6564
#[cfg(feature = "api-4-1-4")]
66-
pub use prebuilt_4_1_4 as godot4_prebuilt;
65+
pub use prebuilt_4_1_4 as prebuilt;
6766

6867
#[cfg(feature = "api-4-2")]
69-
pub use prebuilt_4_2 as godot4_prebuilt;
68+
pub use prebuilt_4_2 as prebuilt;
7069

7170
#[cfg(feature = "api-4-2-1")]
72-
pub use prebuilt_4_2_1 as godot4_prebuilt;
71+
pub use prebuilt_4_2_1 as prebuilt;
7372

7473
#[cfg(feature = "api-4-2-2")]
75-
pub use prebuilt_4_2_2 as godot4_prebuilt;
74+
pub use prebuilt_4_2_2 as prebuilt;
7675

7776
// ]]
7877

7978
// If none of the api-* features are provided, use default prebuilt version (typically latest Godot stable release).
8079

8180
// [version-sync] [[
82-
// [repeat] past+current+future
83-
// [fmt] \tfeature = "api-$kebabVersion",
81+
// [line] \tfeature = "api-$kebabVersion",
8482
// [pre] #[cfg(not(any(
8583
// [post] \tfeature = "api-custom",\n)))]
8684
#[cfg(not(any(
@@ -97,13 +95,12 @@ pub use prebuilt_4_2_2 as godot4_prebuilt;
9795
feature = "api-4-2",
9896
feature = "api-4-2-1",
9997
feature = "api-4-2-2",
100-
feature = "api-4-3",
10198
feature = "api-custom",
10299
)))]
103100
// ]]
104101

105102
// [version-sync] [[
106-
// [repeat] current.minor
107-
// [fmt] pub use prebuilt_$snakeVersion as godot4_prebuilt;
108-
pub use prebuilt_4_2 as godot4_prebuilt;
103+
// [include] current.minor
104+
// [line] pub use prebuilt_$snakeVersion as prebuilt;
105+
pub use prebuilt_4_2 as prebuilt;
109106
// ]]

godot-bindings/src/lib.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ mod godot_version;
4242

4343
#[cfg(feature = "api-custom")]
4444
#[path = ""]
45-
mod custom {
45+
mod depend_on_custom {
4646
use super::*;
4747

4848
pub(crate) mod godot_exe;
@@ -68,40 +68,38 @@ mod custom {
6868
}
6969

7070
#[cfg(feature = "api-custom")]
71-
pub use custom::*;
71+
pub use depend_on_custom::*;
7272

7373
// ----------------------------------------------------------------------------------------------------------------------------------------------
7474
// Prebuilt mode: Reuse existing files
7575

7676
#[cfg(not(feature = "api-custom"))]
7777
#[path = ""]
78-
mod prebuilt {
78+
mod depend_on_prebuilt {
7979
use super::*;
80-
use crate::import::godot4_prebuilt;
80+
use crate::import::prebuilt;
8181

8282
pub fn load_gdextension_json(_watch: &mut StopWatch) -> &'static str {
83-
godot4_prebuilt::load_gdextension_json()
83+
prebuilt::load_gdextension_json()
8484
}
8585

8686
pub fn write_gdextension_headers(h_path: &Path, rs_path: &Path, watch: &mut StopWatch) {
8787
// Note: prebuilt artifacts just return a static str.
88-
let h_contents = godot4_prebuilt::load_gdextension_header_h();
88+
let h_contents = prebuilt::load_gdextension_header_h();
8989
std::fs::write(h_path, h_contents)
9090
.unwrap_or_else(|e| panic!("failed to write gdextension_interface.h: {e}"));
9191
watch.record("write_header_h");
9292

93-
let rs_contents = godot4_prebuilt::load_gdextension_header_rs();
93+
let rs_contents = prebuilt::load_gdextension_header_rs();
9494
std::fs::write(rs_path, rs_contents)
9595
.unwrap_or_else(|e| panic!("failed to write gdextension_interface.rs: {e}"));
9696
watch.record("write_header_rs");
9797
}
9898

9999
pub(crate) fn get_godot_version() -> GodotVersion {
100-
let version: Vec<&str> = godot4_prebuilt::GODOT_VERSION
101-
.split('.')
102-
.collect::<Vec<_>>();
100+
let version: Vec<&str> = prebuilt::GODOT_VERSION.split('.').collect::<Vec<_>>();
103101
GodotVersion {
104-
full_string: godot4_prebuilt::GODOT_VERSION.into(),
102+
full_string: prebuilt::GODOT_VERSION.into(),
105103
major: version[0].parse().unwrap(),
106104
minor: version[1].parse().unwrap(),
107105
patch: version
@@ -115,7 +113,7 @@ mod prebuilt {
115113
}
116114

117115
#[cfg(not(feature = "api-custom"))]
118-
pub use prebuilt::*;
116+
pub use depend_on_prebuilt::*;
119117

120118
// ----------------------------------------------------------------------------------------------------------------------------------------------
121119
// Common
@@ -134,7 +132,7 @@ pub fn emit_godot_version_cfg() {
134132
let all_versions = import::ALL_VERSIONS;
135133

136134
// Make `published_docs` #[cfg] known. This could be moved to Cargo.toml of all crates in the future.
137-
println!(r#"cargo:rustc-check-cfg=published_docs"#);
135+
println!(r#"cargo:rustc-check-cfg=cfg(published_docs, values(none()))"#);
138136

139137
// Emit `rustc-check-cfg` for all minor versions (patch .0), so Cargo doesn't complain when we use the #[cfg]s.
140138
for (_, minor, patch) in all_versions.iter().copied() {

godot-core/Cargo.toml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,29 @@ codegen-lazy-fptrs = [
1515
"godot-ffi/codegen-lazy-fptrs",
1616
"godot-codegen/codegen-lazy-fptrs",
1717
]
18-
api-custom = ["godot-ffi/api-custom", "godot-codegen/api-custom"]
1918
double-precision = ["godot-codegen/double-precision"]
2019
experimental-godot-api = ["godot-codegen/experimental-godot-api"]
2120
experimental-threads = ["godot-ffi/experimental-threads"]
2221
debug-log = ["godot-ffi/debug-log"]
2322
trace = []
23+
24+
api-custom = ["godot-ffi/api-custom", "godot-codegen/api-custom"]
25+
# [version-sync] [[
26+
# [line] api-$kebabVersion = ["godot-ffi/api-$kebabVersion"]
2427
api-4-0 = ["godot-ffi/api-4-0"]
28+
api-4-0-1 = ["godot-ffi/api-4-0-1"]
29+
api-4-0-2 = ["godot-ffi/api-4-0-2"]
30+
api-4-0-3 = ["godot-ffi/api-4-0-3"]
31+
api-4-0-4 = ["godot-ffi/api-4-0-4"]
2532
api-4-1 = ["godot-ffi/api-4-1"]
33+
api-4-1-1 = ["godot-ffi/api-4-1-1"]
34+
api-4-1-2 = ["godot-ffi/api-4-1-2"]
35+
api-4-1-3 = ["godot-ffi/api-4-1-3"]
36+
api-4-1-4 = ["godot-ffi/api-4-1-4"]
37+
api-4-2 = ["godot-ffi/api-4-2"]
38+
api-4-2-1 = ["godot-ffi/api-4-2-1"]
39+
api-4-2-2 = ["godot-ffi/api-4-2-2"]
40+
# ]]
2641

2742
[dependencies]
2843
godot-ffi = { path = "../godot-ffi" }

godot-ffi/Cargo.toml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,29 @@ keywords = ["gamedev", "godot", "engine", "ffi"]
88
categories = ["game-engines", "graphics"]
99

1010
[features]
11-
api-custom = ["godot-bindings/api-custom"]
1211
codegen-fmt = ["godot-codegen/codegen-fmt"]
1312
codegen-lazy-fptrs = ["godot-codegen/codegen-lazy-fptrs"]
1413
experimental-godot-api = ["godot-codegen/experimental-godot-api"]
1514
experimental-threads = []
1615
debug-log = []
16+
17+
api-custom = ["godot-bindings/api-custom"]
18+
# [version-sync] [[
19+
# [line] api-$kebabVersion = ["godot-bindings/api-$kebabVersion"]
1720
api-4-0 = ["godot-bindings/api-4-0"]
21+
api-4-0-1 = ["godot-bindings/api-4-0-1"]
22+
api-4-0-2 = ["godot-bindings/api-4-0-2"]
23+
api-4-0-3 = ["godot-bindings/api-4-0-3"]
24+
api-4-0-4 = ["godot-bindings/api-4-0-4"]
1825
api-4-1 = ["godot-bindings/api-4-1"]
26+
api-4-1-1 = ["godot-bindings/api-4-1-1"]
27+
api-4-1-2 = ["godot-bindings/api-4-1-2"]
28+
api-4-1-3 = ["godot-bindings/api-4-1-3"]
29+
api-4-1-4 = ["godot-bindings/api-4-1-4"]
30+
api-4-2 = ["godot-bindings/api-4-2"]
31+
api-4-2-1 = ["godot-bindings/api-4-2-1"]
32+
api-4-2-2 = ["godot-bindings/api-4-2-2"]
33+
# ]]
1934

2035
# TODO: get rid of paste and gensym, they are trivially implementable with proc-macros. Update cargo-deny.
2136
# Especially gensym which pulls in entire syn for 10 LoC. See https://github.com/regiontog/gensym/blob/master/src/lib.rs.

godot/Cargo.toml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ categories = ["game-engines", "graphics"]
99

1010
[features]
1111
default = ["codegen-full"]
12-
api-4-0 = ["godot-core/api-4-0"]
13-
api-4-1 = ["godot-core/api-4-1"]
14-
api-custom = ["godot-core/api-custom"]
1512
custom-godot = ["api-custom"]
1613
double-precision = ["godot-core/double-precision"]
1714
experimental-godot-api = ["godot-core/experimental-godot-api"]
@@ -21,6 +18,25 @@ formatted = ["godot-core/codegen-fmt"]
2118
lazy-function-tables = ["godot-core/codegen-lazy-fptrs"]
2219
serde = ["godot-core/serde"]
2320

21+
api-custom = ["godot-core/api-custom"]
22+
# [version-sync] [[
23+
# [line] api-$kebabVersion = ["godot-core/api-$kebabVersion"]
24+
api-4-0 = ["godot-core/api-4-0"]
25+
api-4-0-1 = ["godot-core/api-4-0-1"]
26+
api-4-0-2 = ["godot-core/api-4-0-2"]
27+
api-4-0-3 = ["godot-core/api-4-0-3"]
28+
api-4-0-4 = ["godot-core/api-4-0-4"]
29+
api-4-1 = ["godot-core/api-4-1"]
30+
api-4-1-1 = ["godot-core/api-4-1-1"]
31+
api-4-1-2 = ["godot-core/api-4-1-2"]
32+
api-4-1-3 = ["godot-core/api-4-1-3"]
33+
api-4-1-4 = ["godot-core/api-4-1-4"]
34+
api-4-2 = ["godot-core/api-4-2"]
35+
api-4-2-1 = ["godot-core/api-4-2-1"]
36+
api-4-2-2 = ["godot-core/api-4-2-2"]
37+
# ]]
38+
39+
2440
# Private features, they are under no stability guarantee
2541
codegen-full = ["godot-core/codegen-full"]
2642
debug-log = ["godot-core/debug-log"]

itest/repo-tweak/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,12 @@ pub fn find_repeated_ranges(
5656
let after_end = end + end_pat.len();
5757

5858
let within = &entire[start..end];
59-
println!("Within: <<{within}>>");
59+
// println!("Within: <<{within}>>");
6060

6161
let mut after_keys = start;
6262
for key in keys {
6363
let key_fmt = format!("[{key}] ");
64-
65-
println!(" Find '{key_fmt}' -> {:?}", within.find(&key_fmt));
64+
// println!(" Find '{key_fmt}' -> {:?}", within.find(&key_fmt));
6665

6766
let Some(pos) = within.find(&key_fmt) else {
6867
continue;
@@ -73,15 +72,14 @@ pub fn find_repeated_ranges(
7372
// Read until end of line -> that's the value.
7473
let eol = within[pos..]
7574
.find(['\n', '\r'])
76-
.expect("unterminated line for key");
75+
.unwrap_or_else(|| panic!("unterminated line for key '{key}'"));
7776

7877
let value = &within[pos..pos + eol];
7978
key_values.insert(key.to_string(), value.to_string());
8079

8180
after_keys = after_keys.max(start + pos + eol);
8281
}
8382

84-
println!("Found {start}..{end}");
8583
found.push(Match {
8684
before_start,
8785
start: after_keys,

0 commit comments

Comments
 (0)