Skip to content

Commit ace81db

Browse files
committed
fixed cyclic build with cargo watch and rust-analyzer for header and json files
1 parent c9c2793 commit ace81db

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

godot-bindings/src/godot_exe.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ const JSON_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/src/gen/extension_
2323

2424
pub fn load_gdextension_json(watch: &mut StopWatch) -> String {
2525
let json_path = Path::new(JSON_PATH);
26-
rerun_on_changed(json_path);
26+
27+
// Listening to changes on files that are generated by this build step cause an infinite loop with cargo watch of
28+
// build -> detect change -> rebuild -> detect change -> ...
29+
// rerun_on_changed(json_path);
2730

2831
let godot_bin = locate_godot_binary();
2932
rerun_on_changed(&godot_bin);
@@ -72,7 +75,9 @@ pub fn write_gdextension_headers(
7275
// }
7376
};
7477

75-
rerun_on_changed(inout_h_path);
78+
// Listening to changes on files that are generated by this build step cause an infinite loop with cargo watch of
79+
// build -> detect change -> rebuild -> detect change -> ...
80+
// rerun_on_changed(inout_h_path);
7681
patch_c_header(inout_h_path, is_engine_4_0);
7782
watch.record("patch_header_h");
7883

godot-bindings/src/header_gen.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ use std::path::Path;
99

1010
pub(crate) fn generate_rust_binding(in_h_path: &Path, out_rs_path: &Path) {
1111
let c_header_path = in_h_path.display().to_string();
12-
println!("cargo:rerun-if-changed={}", c_header_path);
12+
13+
// Listening to changes on files that are generated by this build step cause an infinite loop with cargo watch of
14+
// build -> detect change -> rebuild -> detect change -> ...
15+
// println!("cargo:rerun-if-changed={}", c_header_path);
1316

1417
let builder = bindgen::Builder::default()
1518
.header(c_header_path)

0 commit comments

Comments
 (0)