(zilch planner step): track historical build plan steps

This commit is contained in:
puck 2025-03-09 09:47:26 +00:00
parent 43322a8f05
commit 20f06e2eb9

View file

@ -23,13 +23,17 @@
(finalized build-plan-finalized set-build-plan-finalized!)
(last-id build-plan-last-id set-build-plan-last-id!))
;; Represents a single step in the build.
;; id is a monotonically increasing identifier.
;; dependencies is an alist of identifiers for other build steps to when they were added.
(define-record-type <build-step>
(make-build-step id dependencies type arguments)
(make-build-step id dependencies type arguments called-from)
build-step?
(id build-step-id)
(dependencies build-step-dependencies set-build-step-dependencies!)
(type build-step-type)
(arguments build-step-arguments set-build-step-arguments!))
(arguments build-step-arguments set-build-step-arguments!)
(called-from build-step-called-from))
(define-record-type <build-step-type>
(make-build-step-type proc name batch)
@ -51,7 +55,7 @@
;; Appends a new step to the build plan, returning its ID.
(define (build-plan-append plan type args dependencies)
(define id (build-plan-next-id plan))
(define new-step (make-build-step id dependencies type args))
(define new-step (make-build-step id dependencies type args #f))
(set-build-plan-steps! plan (mapping-set! (build-plan-steps plan) id new-step))
id)
@ -154,10 +158,17 @@
(make-build-step (build-step-id step)
(list-ref result 3)
(list-ref result 1)
(list-ref result 2)))))
(list-ref result 2)
(cons (build-plan-next-id plan) step)))))
((append)
(set-build-step-dependencies! step (append (build-step-dependencies step) (list-ref result 1)))
(unless (eq? (list-ref result 2) #f) (set-build-step-arguments! step (list-ref result 2))))))
(set-build-plan-steps! plan
(mapping-set! (build-plan-steps plan)
(build-step-id step)
(make-build-step (build-step-id step)
(append (build-step-dependencies step) (list-ref result 1))
(build-step-type step)
(or (list-ref result 2) (build-step-arguments step))
(cons (build-plan-next-id plan) step)))))))
;; Run all build steps that are ready to run.
(mapping-for-each