set -euo pipefail
topdir=$(dirname "$0")
cd "$topdir"
function banner {
echo "====== $* ======"
}
banner "Rust formatting"
if type rustfmt > /dev/null; then
if ! "$topdir/format-all.sh" --check ; then
echo "Formatting diffs detected! Run \"cargo fmt --all\" to correct."
exit 1
fi
else
echo "rustfmt not available; formatting not checked!"
echo
echo "If you are using rustup, rustfmt can be installed via"
echo "\"rustup component add --toolchain=stable rustfmt-preview\", or see"
echo "https://github.com/rust-lang-nursery/rustfmt for more information."
fi
banner "Rust release build"
cargo build --release
banner "Rust debug build"
cargo build
banner "Rust unit tests"
cargo test --all
banner "Rust documentation: $topdir/target/doc/wasmparser/index.html"
cargo doc
banner "OK"