(zilch lang ninja): process depfile, elide .h files where posssible

Incremental builds now take depfiles in account! Using a file that
contains a mapping of depfile to its cached contents, Zilch now
rebuilds less targets unnecessarily! If a build fails because an
include is added, it transparently rebuilds it with all possible header
dependencies, using the custom build scheduler built into Zilch. If an
include is removed, the target will be rebuilt with the new set of
headers the next time the CLI is invoked.

Change-Id: I6a6a6964c2fb191af4a474c45fd0f29623c588b0
This commit is contained in:
puck 2025-06-18 17:07:16 +00:00
parent 31bdc68f8c
commit 781e2b5534
5 changed files with 107 additions and 32 deletions

View file

@ -122,12 +122,12 @@
(read-ninja-file (read-file-at-path "build.ninja") read-file-at-path))
; Process the build.ninja file.
(define-values (edge-ref defaults) (process-ninja-file ninja-file conf "build"))
(define-values (edge-ref defaults export-depfile) (process-ninja-file ninja-file conf "build"))
(values initial-drv configured-drv placeholders edge-ref defaults))
(values initial-drv configured-drv placeholders edge-ref defaults export-depfile))
(define (build-nixpkgs-drv-reproducibly conf)
(define-values (initial-drv configured-drv placeholders edge-ref defaults) (setup-ninja-environment conf))
(define-values (initial-drv configured-drv placeholders edge-ref defaults export-depfile) (setup-ninja-environment conf))
; Build all store paths necessary for installing. This assumes Meson.
(define preinstall-state (force (built-edge-out-drv (cdr (edge-ref "all")))))
@ -200,8 +200,10 @@
"for curPhase in ${phases[*]}; do runPhase \"$curPhase\"; done\n"))
; Patch the original .drv to run the postbuild-builder command.
(patch-drv initial-drv
(append
`(("buildCommand" . ,postbuild-builder))
placeholders)
(map car placeholders)))))
(values
(patch-drv initial-drv
(append
`(("buildCommand" . ,postbuild-builder))
placeholders)
(map car placeholders))
export-depfile))))