diff --git a/common/build.rs b/common/build.rs index efedbfb..faf1706 100644 --- a/common/build.rs +++ b/common/build.rs @@ -217,5 +217,29 @@ fn main() -> Result<(), Box> { ], &["proto"], )?; + + // Scope build-script reruns to the actual inputs. Without this, the script + // emits no `rerun-if-changed` directives, so Cargo reruns it whenever any + // file in the package changes. Since codegen writes into `src/proto/`, that + // self-write retriggers the script on every build (an infinite loop under + // `cargo watch`). tonic_build 0.13 emitted these automatically; 0.14 + // (tonic_prost_build) no longer does. + println!("cargo:rerun-if-changed=build.rs"); + for proto in [ + "proto/common.proto", + "proto/adresar.proto", + "proto/auth.proto", + "proto/search.proto", + "proto/search2.proto", + "proto/table_definition.proto", + "proto/table_script.proto", + "proto/table_structure.proto", + "proto/table_validation.proto", + "proto/tables_data.proto", + "proto/uctovnictvo.proto", + ] { + println!("cargo:rerun-if-changed={proto}"); + } + Ok(()) }