blob: 007c5148e4a69eab2adc601276490dd0f3155910 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/usr/bin/env bash
#
# Use nightly rustdoc to make sure that the expected list of APIs is exported
# from the `arti` crate when built with --features=full.
#
# Requires jq and diff.
set -eou pipefail
EXPECTED_PUBLIC_MEMBERS=$(cat <<EOF
arti
arti.main
EOF
)
JSONFILE=target/doc/arti.json
export RUSTDOCFLAGS='-Z unstable-options --output-format json'
: "${CARGO:=cargo +nightly}"
${CARGO} doc --no-deps -p arti --features=full
if ! test -e "$JSONFILE"; then
echo "Problem: $JSONFILE was not created by $CARGO doc"
exit 1
fi
TEMPDIR=$(mktemp -d)
trap 'rm -rf "$TEMPDIR"' 0
jq -r '.paths[] | select(.crate_id == 0) | .path | join(".") ' <"$JSONFILE" |sort >"$TEMPDIR/public_paths"
echo "$EXPECTED_PUBLIC_MEMBERS" >"$TEMPDIR/expected_public_paths"
if diff -u "$TEMPDIR/expected_public_paths" "$TEMPDIR/public_paths"; then
echo "No changes; all public APIs in arti are as expected"
exit 0
else
echo "List of public APIs in arti crate are not as expected!" >&2
echo "(See above for diff from expected)" >&2
exit 1
fi
|