fix(build): avoid perpetually invalidating build script inputs
Repeated production builds recompiled build-info, GTK and their dependents because build scripts watched missing optional files and generated outputs. Watch packed-refs only when present and the prebuilt GTK bundle only when consumed. Loose refs remain watched so packing them refreshes Git inputs. Invoke glib-compile-resources directly instead of using a helper that also watches generated XML and UI files. The existing resources directory watch covers their source inputs. Remove the unused helper dependency and document the build input rules. Test Plan: - Run cargo build --profile production three times; repeats compile nothing. - Run cargo clippy, cargo clippy --benches and cargo clippy --tests. - Run cargo +nightly fmt and repeat all three Clippy checks. Documentation: docs/rewrite/ARCHITECTURE.md
This commit is contained in:
1 parent
7cec74e18b
commit
92f4f521ab
5 files changed
+39
-19
No files matched your search
@@ -61,10 +61,13 @@ fn detect_version(manifest_dir: &Path) -> (String, Option<String>) {
|
||||
let git_dir = PathBuf::from(git_dir);
|
||||
println!("cargo:rerun-if-changed={}", git_dir.join("HEAD").display());
|
||||
println!("cargo:rerun-if-changed={}", git_dir.join("refs").display());
|
||||
println!(
|
||||
"cargo:rerun-if-changed={}",
|
||||
git_dir.join("packed-refs").display()
|
||||
);
|
||||
// Missing watched paths make Cargo rerun this script on every build.
|
||||
// Packing loose refs also changes `refs`, so it will register this
|
||||
// optional file once Git creates it.
|
||||
let packed_refs = git_dir.join("packed-refs");
|
||||
if packed_refs.is_file() {
|
||||
println!("cargo:rerun-if-changed={}", packed_refs.display());
|
||||
}
|
||||
}
|
||||
let hash = run(
|
||||
"git",
|
||||
|
||||
Reference in new issue
Block a user