Update sublibrary graph generation script & cabal description (#1849)

As a follow-up to #1834:

- Update the sublibrary graph generation script so it works with the no-longer-linear graph
- Regenerate the actual image
- Update the `.cabal` description to match
This commit is contained in:
Brent Yorgey 2024-05-13 12:25:00 -05:00 committed by GitHub
parent c993d9dfdd
commit 79bf8ebcf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 106 additions and 68 deletions

View File

@ -4,88 +4,106 @@
<!-- Generated by graphviz version 2.43.0 (0)
-->
<!-- Title: plan Pages: 1 -->
<svg width="266pt" height="308pt"
viewBox="0.00 0.00 266.00 308.03" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 304.03)">
<svg width="210pt" height="476pt"
viewBox="0.00 0.00 209.50 476.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 472)">
<title>plan</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-304.03 262,-304.03 262,4 -4,4"/>
<!-- swarm&#45;0.5.0.0:exe:swarm -->
<polygon fill="white" stroke="transparent" points="-4,4 -4,-472 205.5,-472 205.5,4 -4,4"/>
<!-- swarm -->
<g id="node1" class="node">
<title>swarm&#45;0.5.0.0:exe:swarm</title>
<path fill="none" stroke="brown" stroke-width="2" d="M217,-36C217,-36 41,-36 41,-36 35,-36 29,-30 29,-24 29,-24 29,-12 29,-12 29,-6 35,0 41,0 41,0 217,0 217,0 223,0 229,-6 229,-12 229,-12 229,-24 229,-24 229,-30 223,-36 217,-36"/>
<text text-anchor="middle" x="129" y="-14.3" font-family="Times,serif" font-size="14.00">swarm&#45;0.5.0.0:exe:swarm</text>
<title>swarm</title>
<path fill="none" stroke="brown" stroke-width="2" d="M122.5,-36C122.5,-36 81.5,-36 81.5,-36 75.5,-36 69.5,-30 69.5,-24 69.5,-24 69.5,-12 69.5,-12 69.5,-6 75.5,0 81.5,0 81.5,0 122.5,0 122.5,0 128.5,0 134.5,-6 134.5,-12 134.5,-12 134.5,-24 134.5,-24 134.5,-30 128.5,-36 122.5,-36"/>
<text text-anchor="middle" x="102" y="-14.3" font-family="Times,serif" font-size="14.00">swarm</text>
</g>
<!-- swarm&#45;0.5.0.0:lib:swarm&#45;web -->
<!-- swarm&#45;web -->
<g id="node2" class="node">
<title>swarm&#45;0.5.0.0:lib:swarm&#45;web</title>
<path fill="none" stroke="gray" stroke-width="2" d="M230.5,-80C230.5,-80 27.5,-80 27.5,-80 21.5,-80 15.5,-74 15.5,-68 15.5,-68 15.5,-56 15.5,-56 15.5,-50 21.5,-44 27.5,-44 27.5,-44 230.5,-44 230.5,-44 236.5,-44 242.5,-50 242.5,-56 242.5,-56 242.5,-68 242.5,-68 242.5,-74 236.5,-80 230.5,-80"/>
<text text-anchor="middle" x="129" y="-58.3" font-family="Times,serif" font-size="14.00">swarm&#45;0.5.0.0:lib:swarm&#45;web</text>
<title>swarm&#45;web</title>
<path fill="none" stroke="gray" stroke-width="2" d="M139,-108C139,-108 65,-108 65,-108 59,-108 53,-102 53,-96 53,-96 53,-84 53,-84 53,-78 59,-72 65,-72 65,-72 139,-72 139,-72 145,-72 151,-78 151,-84 151,-84 151,-96 151,-96 151,-102 145,-108 139,-108"/>
<text text-anchor="middle" x="102" y="-86.3" font-family="Times,serif" font-size="14.00">swarm&#45;web</text>
</g>
<!-- swarm&#45;0.5.0.0:exe:swarm&#45;&gt;swarm&#45;0.5.0.0:lib:swarm&#45;web -->
<!-- swarm&#45;&gt;swarm&#45;web -->
<g id="edge1" class="edge">
<title>swarm&#45;0.5.0.0:exe:swarm&#45;&gt;swarm&#45;0.5.0.0:lib:swarm&#45;web</title>
<path fill="none" stroke="brown" d="M129,-36.15C129,-36.31 129,-36.47 129,-36.63"/>
<polygon fill="brown" stroke="brown" points="125.5,-33.89 129,-43.89 132.5,-33.89 125.5,-33.89"/>
<title>swarm&#45;&gt;swarm&#45;web</title>
<path fill="none" stroke="brown" d="M102,-36.3C102,-44.02 102,-53.29 102,-61.89"/>
<polygon fill="brown" stroke="brown" points="98.5,-61.9 102,-71.9 105.5,-61.9 98.5,-61.9"/>
</g>
<!-- swarm&#45;0.5.0.0 -->
<!-- swarm&#45;doc -->
<g id="node3" class="node">
<title>swarm&#45;0.5.0.0</title>
<path fill="none" stroke="blue" stroke-width="2" d="M176.5,-124.01C176.5,-124.01 81.5,-124.01 81.5,-124.01 75.5,-124.01 69.5,-118.01 69.5,-112.01 69.5,-112.01 69.5,-100.01 69.5,-100.01 69.5,-94.01 75.5,-88.01 81.5,-88.01 81.5,-88.01 176.5,-88.01 176.5,-88.01 182.5,-88.01 188.5,-94.01 188.5,-100.01 188.5,-100.01 188.5,-112.01 188.5,-112.01 188.5,-118.01 182.5,-124.01 176.5,-124.01"/>
<text text-anchor="middle" x="129" y="-102.31" font-family="Times,serif" font-size="14.00">swarm&#45;0.5.0.0</text>
<title>swarm&#45;doc</title>
<path fill="none" stroke="gray" stroke-width="2" d="M82,-180C82,-180 12,-180 12,-180 6,-180 0,-174 0,-168 0,-168 0,-156 0,-156 0,-150 6,-144 12,-144 12,-144 82,-144 82,-144 88,-144 94,-150 94,-156 94,-156 94,-168 94,-168 94,-174 88,-180 82,-180"/>
<text text-anchor="middle" x="47" y="-158.3" font-family="Times,serif" font-size="14.00">swarm&#45;doc</text>
</g>
<!-- swarm&#45;0.5.0.0:lib:swarm&#45;web&#45;&gt;swarm&#45;0.5.0.0 -->
<!-- swarm&#45;web&#45;&gt;swarm&#45;doc -->
<g id="edge2" class="edge">
<title>swarm&#45;0.5.0.0:lib:swarm&#45;web&#45;&gt;swarm&#45;0.5.0.0</title>
<path fill="none" stroke="gray" d="M129,-80.16C129,-80.32 129,-80.48 129,-80.64"/>
<polygon fill="gray" stroke="gray" points="125.5,-77.9 129,-87.9 132.5,-77.9 125.5,-77.9"/>
<title>swarm&#45;web&#45;&gt;swarm&#45;doc</title>
<path fill="none" stroke="gray" d="M88.4,-108.3C81.88,-116.61 73.93,-126.72 66.75,-135.86"/>
<polygon fill="gray" stroke="gray" points="63.87,-133.87 60.44,-143.9 69.37,-138.19 63.87,-133.87"/>
</g>
<!-- swarm&#45;0.5.0.0:lib:swarm&#45;engine -->
<!-- swarm&#45;tui -->
<g id="node4" class="node">
<title>swarm&#45;0.5.0.0:lib:swarm&#45;engine</title>
<path fill="none" stroke="gray" stroke-width="2" d="M240,-168.01C240,-168.01 18,-168.01 18,-168.01 12,-168.01 6,-162.01 6,-156.01 6,-156.01 6,-144.01 6,-144.01 6,-138.01 12,-132.01 18,-132.01 18,-132.01 240,-132.01 240,-132.01 246,-132.01 252,-138.01 252,-144.01 252,-144.01 252,-156.01 252,-156.01 252,-162.01 246,-168.01 240,-168.01"/>
<text text-anchor="middle" x="129" y="-146.31" font-family="Times,serif" font-size="14.00">swarm&#45;0.5.0.0:lib:swarm&#45;engine</text>
<title>swarm&#45;tui</title>
<path fill="none" stroke="gray" stroke-width="2" d="M189.5,-180C189.5,-180 124.5,-180 124.5,-180 118.5,-180 112.5,-174 112.5,-168 112.5,-168 112.5,-156 112.5,-156 112.5,-150 118.5,-144 124.5,-144 124.5,-144 189.5,-144 189.5,-144 195.5,-144 201.5,-150 201.5,-156 201.5,-156 201.5,-168 201.5,-168 201.5,-174 195.5,-180 189.5,-180"/>
<text text-anchor="middle" x="157" y="-158.3" font-family="Times,serif" font-size="14.00">swarm&#45;tui</text>
</g>
<!-- swarm&#45;0.5.0.0&#45;&gt;swarm&#45;0.5.0.0:lib:swarm&#45;engine -->
<!-- swarm&#45;web&#45;&gt;swarm&#45;tui -->
<g id="edge3" class="edge">
<title>swarm&#45;0.5.0.0&#45;&gt;swarm&#45;0.5.0.0:lib:swarm&#45;engine</title>
<path fill="none" stroke="blue" d="M129,-124.16C129,-124.32 129,-124.48 129,-124.64"/>
<polygon fill="blue" stroke="blue" points="125.5,-121.9 129,-131.9 132.5,-121.9 125.5,-121.9"/>
<title>swarm&#45;web&#45;&gt;swarm&#45;tui</title>
<path fill="none" stroke="gray" d="M115.6,-108.3C122.12,-116.61 130.07,-126.72 137.25,-135.86"/>
<polygon fill="gray" stroke="gray" points="134.63,-138.19 143.56,-143.9 140.13,-133.87 134.63,-138.19"/>
</g>
<!-- swarm&#45;0.5.0.0:lib:swarm&#45;scenario -->
<!-- swarm&#45;engine -->
<g id="node5" class="node">
<title>swarm&#45;0.5.0.0:lib:swarm&#45;scenario</title>
<path fill="none" stroke="gray" stroke-width="2" d="M246,-212.02C246,-212.02 12,-212.02 12,-212.02 6,-212.02 0,-206.02 0,-200.02 0,-200.02 0,-188.02 0,-188.02 0,-182.02 6,-176.02 12,-176.02 12,-176.02 246,-176.02 246,-176.02 252,-176.02 258,-182.02 258,-188.02 258,-188.02 258,-200.02 258,-200.02 258,-206.02 252,-212.02 246,-212.02"/>
<text text-anchor="middle" x="129" y="-190.32" font-family="Times,serif" font-size="14.00">swarm&#45;0.5.0.0:lib:swarm&#45;scenario</text>
<title>swarm&#45;engine</title>
<path fill="none" stroke="gray" stroke-width="2" d="M148.5,-252C148.5,-252 55.5,-252 55.5,-252 49.5,-252 43.5,-246 43.5,-240 43.5,-240 43.5,-228 43.5,-228 43.5,-222 49.5,-216 55.5,-216 55.5,-216 148.5,-216 148.5,-216 154.5,-216 160.5,-222 160.5,-228 160.5,-228 160.5,-240 160.5,-240 160.5,-246 154.5,-252 148.5,-252"/>
<text text-anchor="middle" x="102" y="-230.3" font-family="Times,serif" font-size="14.00">swarm&#45;engine</text>
</g>
<!-- swarm&#45;0.5.0.0:lib:swarm&#45;engine&#45;&gt;swarm&#45;0.5.0.0:lib:swarm&#45;scenario -->
<!-- swarm&#45;doc&#45;&gt;swarm&#45;engine -->
<g id="edge4" class="edge">
<title>swarm&#45;0.5.0.0:lib:swarm&#45;engine&#45;&gt;swarm&#45;0.5.0.0:lib:swarm&#45;scenario</title>
<path fill="none" stroke="gray" d="M129,-168.17C129,-168.33 129,-168.49 129,-168.65"/>
<polygon fill="gray" stroke="gray" points="125.5,-165.91 129,-175.91 132.5,-165.91 125.5,-165.91"/>
<title>swarm&#45;doc&#45;&gt;swarm&#45;engine</title>
<path fill="none" stroke="gray" d="M60.6,-180.3C67.12,-188.61 75.07,-198.72 82.25,-207.86"/>
<polygon fill="gray" stroke="gray" points="79.63,-210.19 88.56,-215.9 85.13,-205.87 79.63,-210.19"/>
</g>
<!-- swarm&#45;0.5.0.0:lib:swarm&#45;lang -->
<g id="node6" class="node">
<title>swarm&#45;0.5.0.0:lib:swarm&#45;lang</title>
<path fill="none" stroke="gray" stroke-width="2" d="M231.5,-256.02C231.5,-256.02 26.5,-256.02 26.5,-256.02 20.5,-256.02 14.5,-250.02 14.5,-244.02 14.5,-244.02 14.5,-232.02 14.5,-232.02 14.5,-226.02 20.5,-220.02 26.5,-220.02 26.5,-220.02 231.5,-220.02 231.5,-220.02 237.5,-220.02 243.5,-226.02 243.5,-232.02 243.5,-232.02 243.5,-244.02 243.5,-244.02 243.5,-250.02 237.5,-256.02 231.5,-256.02"/>
<text text-anchor="middle" x="129" y="-234.32" font-family="Times,serif" font-size="14.00">swarm&#45;0.5.0.0:lib:swarm&#45;lang</text>
</g>
<!-- swarm&#45;0.5.0.0:lib:swarm&#45;scenario&#45;&gt;swarm&#45;0.5.0.0:lib:swarm&#45;lang -->
<!-- swarm&#45;tui&#45;&gt;swarm&#45;engine -->
<g id="edge5" class="edge">
<title>swarm&#45;0.5.0.0:lib:swarm&#45;scenario&#45;&gt;swarm&#45;0.5.0.0:lib:swarm&#45;lang</title>
<path fill="none" stroke="gray" d="M129,-212.17C129,-212.33 129,-212.49 129,-212.65"/>
<polygon fill="gray" stroke="gray" points="125.5,-209.91 129,-219.91 132.5,-209.91 125.5,-209.91"/>
<title>swarm&#45;tui&#45;&gt;swarm&#45;engine</title>
<path fill="none" stroke="gray" d="M143.4,-180.3C136.88,-188.61 128.93,-198.72 121.75,-207.86"/>
<polygon fill="gray" stroke="gray" points="118.87,-205.87 115.44,-215.9 124.37,-210.19 118.87,-205.87"/>
</g>
<!-- swarm&#45;0.5.0.0:lib:swarm&#45;util -->
<g id="node7" class="node">
<title>swarm&#45;0.5.0.0:lib:swarm&#45;util</title>
<path fill="none" stroke="gray" stroke-width="2" d="M228,-300.03C228,-300.03 30,-300.03 30,-300.03 24,-300.03 18,-294.03 18,-288.03 18,-288.03 18,-276.03 18,-276.03 18,-270.03 24,-264.03 30,-264.03 30,-264.03 228,-264.03 228,-264.03 234,-264.03 240,-270.03 240,-276.03 240,-276.03 240,-288.03 240,-288.03 240,-294.03 234,-300.03 228,-300.03"/>
<text text-anchor="middle" x="129" y="-278.33" font-family="Times,serif" font-size="14.00">swarm&#45;0.5.0.0:lib:swarm&#45;util</text>
<!-- swarm&#45;scenario -->
<g id="node6" class="node">
<title>swarm&#45;scenario</title>
<path fill="none" stroke="gray" stroke-width="2" d="M154.5,-324C154.5,-324 49.5,-324 49.5,-324 43.5,-324 37.5,-318 37.5,-312 37.5,-312 37.5,-300 37.5,-300 37.5,-294 43.5,-288 49.5,-288 49.5,-288 154.5,-288 154.5,-288 160.5,-288 166.5,-294 166.5,-300 166.5,-300 166.5,-312 166.5,-312 166.5,-318 160.5,-324 154.5,-324"/>
<text text-anchor="middle" x="102" y="-302.3" font-family="Times,serif" font-size="14.00">swarm&#45;scenario</text>
</g>
<!-- swarm&#45;0.5.0.0:lib:swarm&#45;lang&#45;&gt;swarm&#45;0.5.0.0:lib:swarm&#45;util -->
<!-- swarm&#45;engine&#45;&gt;swarm&#45;scenario -->
<g id="edge6" class="edge">
<title>swarm&#45;0.5.0.0:lib:swarm&#45;lang&#45;&gt;swarm&#45;0.5.0.0:lib:swarm&#45;util</title>
<path fill="none" stroke="gray" d="M129,-256.17C129,-256.33 129,-256.49 129,-256.65"/>
<polygon fill="gray" stroke="gray" points="125.5,-253.92 129,-263.92 132.5,-253.92 125.5,-253.92"/>
<title>swarm&#45;engine&#45;&gt;swarm&#45;scenario</title>
<path fill="none" stroke="gray" d="M102,-252.3C102,-260.02 102,-269.29 102,-277.89"/>
<polygon fill="gray" stroke="gray" points="98.5,-277.9 102,-287.9 105.5,-277.9 98.5,-277.9"/>
</g>
<!-- swarm&#45;lang -->
<g id="node7" class="node">
<title>swarm&#45;lang</title>
<path fill="none" stroke="gray" stroke-width="2" d="M140,-396C140,-396 64,-396 64,-396 58,-396 52,-390 52,-384 52,-384 52,-372 52,-372 52,-366 58,-360 64,-360 64,-360 140,-360 140,-360 146,-360 152,-366 152,-372 152,-372 152,-384 152,-384 152,-390 146,-396 140,-396"/>
<text text-anchor="middle" x="102" y="-374.3" font-family="Times,serif" font-size="14.00">swarm&#45;lang</text>
</g>
<!-- swarm&#45;scenario&#45;&gt;swarm&#45;lang -->
<g id="edge7" class="edge">
<title>swarm&#45;scenario&#45;&gt;swarm&#45;lang</title>
<path fill="none" stroke="gray" d="M102,-324.3C102,-332.02 102,-341.29 102,-349.89"/>
<polygon fill="gray" stroke="gray" points="98.5,-349.9 102,-359.9 105.5,-349.9 98.5,-349.9"/>
</g>
<!-- swarm&#45;util -->
<g id="node8" class="node">
<title>swarm&#45;util</title>
<path fill="none" stroke="gray" stroke-width="2" d="M136.5,-468C136.5,-468 67.5,-468 67.5,-468 61.5,-468 55.5,-462 55.5,-456 55.5,-456 55.5,-444 55.5,-444 55.5,-438 61.5,-432 67.5,-432 67.5,-432 136.5,-432 136.5,-432 142.5,-432 148.5,-438 148.5,-444 148.5,-444 148.5,-456 148.5,-456 148.5,-462 142.5,-468 136.5,-468"/>
<text text-anchor="middle" x="102" y="-446.3" font-family="Times,serif" font-size="14.00">swarm&#45;util</text>
</g>
<!-- swarm&#45;lang&#45;&gt;swarm&#45;util -->
<g id="edge8" class="edge">
<title>swarm&#45;lang&#45;&gt;swarm&#45;util</title>
<path fill="none" stroke="gray" d="M102,-396.3C102,-404.02 102,-413.29 102,-421.89"/>
<polygon fill="gray" stroke="gray" points="98.5,-421.9 102,-431.9 105.5,-421.9 98.5,-421.9"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -7,7 +7,6 @@ cd $SCRIPT_DIR/../..
#
# cabal install cabal-plan
# If the swarm.cabal file has changed, you may need to remove
# the 'plan.json' file from the cache and regenerate.
#
@ -16,4 +15,20 @@ cd $SCRIPT_DIR/../..
rm -r dist-newstyle/cache
cabal build --dry-run
cabal-plan --hide-global --hide-builtin dot --tred --root swarm | twopi -Tsvg -o docs/image/sublibrary-graph.svg
# Use cabal-plan to generate a graph of sublibrary dependencies.
# The --tred flag indicates to use transitive reduction, i.e.
# remove edges A -> C when there are edges A -> B -> C
cabal-plan --hide-global --hide-builtin dot --tred --root swarm |
# The vertices generated by cabal-plan have names like
# 'swarm-0.5.0.0:lib:swarm-tui'; this sed command strips off
# the first two parts from each name leaving only e.g. 'swarm-tui'
sed 's/"swarm-[^:]*:\(lib\|exe\):/"/g' |
# The graph output by cabal-plan has "rankdir=LR" which lays
# out the layers from left to right; we prefer them to be laid out
# bottom to top.
sed 's/LR/BT/' |
# Finally, use dot to render the generated graph to an SVG.
dot -Tsvg -o docs/image/sublibrary-graph.svg

View File

@ -14,17 +14,22 @@ description:
== Module organization
For developers getting oriented, Swarm's modules are organized into
sublibraries, from inner to outer:
sublibraries. Roughly in order from inner to outer, they are:
* utilities
* swarm language
* swarm scenario
* swarm game engine
* swarm TUI
* swarm app
* swarm-util: miscellaneous utilities
* swarm-lang: parsing, typechecking, etc. for the Swarm language
* swarm-scenario: scenario descriptions, parsing, & processing
* swarm-engine: game simulation
* swarm-doc: generating documentation
* swarm-tui: textual user interface
* swarm-web: web interface
* swarm: the swarm executable
<<docs/image/sublibrary-graph.svg>>
See the [Swarm module guide](https://github.com/swarm-game/swarm/wiki/Module-guide)
for a more in-depth guide to the codebase.
license: BSD-3-Clause
license-file: LICENSE
author: Brent Yorgey