fix(build): read the symbol graph from SwiftPM and say why a build fails
This commit is contained in:
parent
7992c104a5
commit
1572307de9
@ -13,17 +13,28 @@ set -euo pipefail
|
|||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
MANIFEST="scripts/validation-coverage.tsv"
|
MANIFEST="scripts/validation-coverage.tsv"
|
||||||
GRAPH_DIR=".build/symbolgraph"
|
GRAPH_DIR=".build/out/symbolgraph"
|
||||||
|
|
||||||
if [[ ! -f "$MANIFEST" ]]; then
|
if [[ ! -f "$MANIFEST" ]]; then
|
||||||
echo "check-validation-coverage: missing manifest $MANIFEST" >&2
|
echo "check-validation-coverage: missing manifest $MANIFEST" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$GRAPH_DIR"
|
# SwiftPM's own command writes the graph for every toolchain. Passing the compiler flags through
|
||||||
swift build --target PureYAML \
|
# -Xswiftc wrote nothing on Swift 6.4 and the gate then failed with no message. Its output is kept
|
||||||
-Xswiftc -emit-symbol-graph \
|
# so a failed build says why, and a missing graph is named.
|
||||||
-Xswiftc -emit-symbol-graph-dir -Xswiftc "$GRAPH_DIR" >/dev/null
|
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'
|
python3 - "$GRAPH_DIR/PureYAML.symbols.json" "$MANIFEST" <<'PY'
|
||||||
import json
|
import json
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user