From 1572307de9b568acf523222d898260a707035664 Mon Sep 17 00:00:00 2001 From: Mihaela M Date: Tue, 3 Nov 2026 12:38:42 +0100 Subject: [PATCH] fix(build): read the symbol graph from SwiftPM and say why a build fails --- scripts/check-validation-coverage.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/check-validation-coverage.sh b/scripts/check-validation-coverage.sh index eeae5cf..7a78435 100755 --- a/scripts/check-validation-coverage.sh +++ b/scripts/check-validation-coverage.sh @@ -13,17 +13,28 @@ set -euo pipefail cd "$(dirname "$0")/.." MANIFEST="scripts/validation-coverage.tsv" -GRAPH_DIR=".build/symbolgraph" +GRAPH_DIR=".build/out/symbolgraph" if [[ ! -f "$MANIFEST" ]]; then echo "check-validation-coverage: missing manifest $MANIFEST" >&2 exit 1 fi -mkdir -p "$GRAPH_DIR" -swift build --target PureYAML \ - -Xswiftc -emit-symbol-graph \ - -Xswiftc -emit-symbol-graph-dir -Xswiftc "$GRAPH_DIR" >/dev/null +# SwiftPM's own command writes the graph for every toolchain. Passing the compiler flags through +# -Xswiftc wrote nothing on Swift 6.4 and the gate then failed with no message. Its output is kept +# so a failed build says why, and a missing graph is named. +log=$(mktemp) +trap 'rm -f "$log"' EXIT +if ! swift package dump-symbol-graph >"$log" 2>&1; then + cat "$log" >&2 + echo "check-validation-coverage: swift package dump-symbol-graph failed" >&2 + exit 1 +fi +if [[ ! -f "$GRAPH_DIR/PureYAML.symbols.json" ]]; then + cat "$log" >&2 + echo "check-validation-coverage: no symbol graph at $GRAPH_DIR/PureYAML.symbols.json" >&2 + exit 1 +fi python3 - "$GRAPH_DIR/PureYAML.symbols.json" "$MANIFEST" <<'PY' import json