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
@@ -70,6 +70,16 @@ ghostty-bench (benchmarks), ghostty-build-data (completions, man pages, syntax).
|
||||
Non-code: `resources/` (shell-integration, themes, terminfo), `dist/` (desktop
|
||||
integration), `po/` (translations), crate-local `res/`/`shaders/`/`resources/`.
|
||||
|
||||
Build inputs: `ghostty-build-info/build.rs` derives version metadata from the
|
||||
workspace manifest and Git HEAD/refs, watching `packed-refs` only when it exists
|
||||
(packing loose refs also changes the watched `refs` directory). The GTK build
|
||||
script compiles `resources/` in checkouts and watches the optional
|
||||
`dist/ghostty.gresource` bundle only when consuming it from a source tarball.
|
||||
Missing optional files must not be emitted as Cargo `rerun-if-changed` inputs:
|
||||
they invalidate every subsequent build and rebuild downstream crates.
|
||||
GTK invokes `glib-compile-resources` directly so generated XML/UI files in
|
||||
`OUT_DIR` are not watched as inputs; the `resources/` watch covers their sources.
|
||||
|
||||
## Key design decisions
|
||||
|
||||
1. **Safe Rust by default.** Workspace lint `unsafe_code = "forbid"`. Crates
|
||||
|
||||
Reference in new issue
Block a user