Skip to content

Commit 3c5d4e9

Browse files
committed
fix: preserve optional docs dependency graphs
1 parent 4f6c0ea commit 3c5d4e9

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

scripts/build_docs_site.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,22 @@ cargo doc --workspace --no-deps
8888
echo "[2/5] Copying rustdoc output"
8989
cp -a "$DOC_ROOT/." "$API_DIR/"
9090

91-
echo "[3/5] Rendering API landing page"
91+
echo "[3/5] Generating optional dependency graph"
92+
if [[ -x "$ROOT_DIR/scripts/gen_dep_graph.py" || -f "$ROOT_DIR/scripts/gen_dep_graph.py" ]]; then
93+
if command -v dot >/dev/null 2>&1; then
94+
python3 "$ROOT_DIR/scripts/gen_dep_graph.py" --root-dir "$ROOT_DIR" | dot -Tsvg > "$API_DIR/dep_graph.svg"
95+
else
96+
echo " Warning: graphviz (dot) not found; dependency graph skipped."
97+
if [[ "${CI:-}" == "true" ]]; then
98+
echo " graphviz is required in CI to render the dependency graph."
99+
exit 1
100+
fi
101+
fi
102+
else
103+
echo " No scripts/gen_dep_graph.py found; skipping dependency graph."
104+
fi
105+
106+
echo "[4/5] Rendering API landing page"
92107
OVERVIEW_HTML="$(render_overview_html)"
93108
CRATE_INVENTORY_HTML="$(render_crate_inventory_html)"
94109
{
@@ -124,7 +139,7 @@ FOOTER
124139

125140
python3 "$ROOT_DIR/scripts/check-docs-site.py" --root-dir "$ROOT_DIR" --site-index "$API_DIR/index.html"
126141

127-
echo "[4/5] Rendering design docs if configured"
142+
echo "[5/5] Rendering design docs if configured"
128143
if [[ -f "$ROOT_DIR/docs/_quarto.yml" ]]; then
129144
if command -v quarto >/dev/null 2>&1; then
130145
quarto render "$ROOT_DIR/docs"
@@ -139,7 +154,7 @@ else
139154
echo " No docs/_quarto.yml found; skipping design docs render."
140155
fi
141156

142-
echo "[5/5] Generating site top page"
157+
echo "[6/6] Generating site top page"
143158
REPO_TITLE="$(basename "$ROOT_DIR")"
144159
if [[ -d "$DESIGN_DIR" ]]; then
145160
DESIGN_CARD='

0 commit comments

Comments
 (0)