From 20f06e2eb9284c8ca77b789bb22d6e16e7efe318 Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Sun, 9 Mar 2025 09:47:26 +0000 Subject: [PATCH] (zilch planner step): track historical build plan steps --- planner/src/step.sld | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/planner/src/step.sld b/planner/src/step.sld index d53d6f4..6a95f23 100644 --- a/planner/src/step.sld +++ b/planner/src/step.sld @@ -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 - (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 (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