Skip to content

Commit

Permalink
choo: track build failures
Browse files Browse the repository at this point in the history
  • Loading branch information
ryjm committed Jan 13, 2025
1 parent 79ad394 commit 75515d7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 19 deletions.
Binary file modified apps/choo/bootstrap/choo.jam
Binary file not shown.
56 changes: 37 additions & 19 deletions apps/choo/bootstrap/kernel.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,17 @@
%- ~(create builder u.cached-hoon.k bc.k pc.k)
[entry dir]
:_ k(bc new-bc, pc new-pc)
:~ :* %file
%write
path=(crip "out.jam")
contents=(jam compiled)
==
[%exit 0]
==
=/ exit-code ?:(=(compiled *(trap vase)) 1 0)
=/ write-effect
:* %file
%write
path=(crip "out.jam")
contents=(jam compiled)
==
?: =(exit-code 0)
~[write-effect [%exit exit-code]]
~& >>> "build failed, skipping write"
~[[%exit exit-code]]
==
--
::
Expand Down Expand Up @@ -351,6 +355,8 @@
=/ [=build-cache =parse-cache] (tail compile)
:: +shot calls the kernel gate to tell it the hash of the dependency directory
:_ [build-cache parse-cache]
:: build failure, just return the bunted trap
?: =(ker-gen *(trap vase)) ker-gen
=> %+ shot ker-gen
=> d=!>(dir-hash)
|.(d)
Expand Down Expand Up @@ -475,7 +481,9 @@
:: .nodes: the nodes of the dependency graph
:: .bc: the build cache
::
:: returns a trap vase with the compiled hoon file and the updated build cache
:: returns a trap vase with the compiled hoon file and the updated build
:: cache. if a build failure is detected, a bunted (trap vase) is returned
:: instead.
++ compile-target
|= [pat=path =path-dag nodes=(map path node) bc=build-cache]
^- [(trap vase) build-cache]
Expand All @@ -490,13 +498,21 @@
=/ graph (build-graph-view nodes)
=/ next=(map path node) (update-next nodes graph)
=| vaz=(trap vase)
|-
=| had-error=_| :: track build failures
|- ^- [(trap vase) build-cache]
?: .=(~ next)
(compile-node n path-dag bc)
=/ [final-vaz=(trap vase) final-bc=build-cache]
(compile-node n path-dag bc)
?: |(had-error =(final-vaz *(trap vase)))
[*(trap vase) final-bc] :: propagate error state
[final-vaz final-bc]
=. bc
%+ roll ~(tap by next)
|= [[p=path n=node] bc=_bc]
+:(compile-node n path-dag bc)
=/ [node-vaz=(trap vase) new-bc=build-cache]
(compile-node n path-dag bc)
=. had-error |(had-error =(node-vaz *(trap vase)))
new-bc
=. graph
(roll ~(tap by next) |=([[p=path *] g=_graph] (update-graph-view g p)))
%= $
Expand Down Expand Up @@ -524,7 +540,10 @@
~& > build-cache-hit+path.n
[(~(got by bc) dep-hash) bc]
~& > build-cache-miss+path.n
=/ vaz=(trap vase) (build-node n path-dag bc)
?~ moled=(mole |.((build-node n path-dag bc)))
~& >> "build-node: failed to compile {<path.n>}"
[*(trap vase) bc]
=/ vaz=(trap vase) u.moled
[vaz (~(put by bc) dep-hash vaz)]
::
:: $build-node: build a single node and its dependencies
Expand All @@ -537,11 +556,10 @@
++ build-node
|= [n=node =path-dag bc=build-cache]
^- (trap vase)
~> %bout
=; dep-vaz=(trap vase)
~> %bout
(swet (slew honc dep-vaz) hoon.n)
%+ roll
deps.n
(swet (slat honc dep-vaz) hoon.n)
%+ roll deps.n
|= [raut vaz=(trap vase)]
~& > grabbing-dep+pax
=/ [dep-hash=@ dep-node=node]
Expand All @@ -550,7 +568,7 @@
=/ dep-vaz=(trap vase)
~| "couldn't find artifact for {<pax>} in build cache"
(~(got by bc) dep-hash)
(slew vaz (label-vase dep-vaz face))
(slat vaz (label-vase dep-vaz face))
::
:: $label-vase: label a (trap vase) with a face
::
Expand Down Expand Up @@ -695,13 +713,13 @@
%- silt
(turn deps.n |=(raut pax))
::
:: $slew: merge two (trap vase)s
:: $slat: merge two (trap vase)s
::
:: .hed: the first (trap vase)
:: .tal: the second (trap vase)
::
:: returns a merged (trap vase)
++ slew
++ slat
|= [hed=(trap vase) tal=(trap vase)]
^- (trap vase)
=> +<
Expand Down

0 comments on commit 75515d7

Please sign in to comment.