| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
set -eu |
| 15 |
cd "$(dirname "$0")/.." |
| 16 |
target=$(mktemp -d) |
| 17 |
trap 'rm -rf "$target"' EXIT |
| 18 |
|
| 19 |
|
| 20 |
src="$(rustc --print sysroot)/lib/rustlib/src/rust" |
| 21 |
commit=$(rustc -vV | sed -n 's/^commit-hash: //p') |
| 22 |
RUSTFLAGS="--remap-path-prefix=$(pwd)=/src --remap-path-prefix=$src=/rustc/$commit" \ |
| 23 |
CARGO_PROFILE_RELEASE_DEBUG=0 CARGO_PROFILE_RELEASE_STRIP=true CARGO_INCREMENTAL=0 \ |
| 24 |
cargo build -q --release --locked --target wasm32-wasip1 -p flow-checks --target-dir "$target" |
| 25 |
built="$target/wasm32-wasip1/release/flow-checks.wasm" |
| 26 |
if [ "${1:-}" = --check ]; then |
| 27 |
if cmp -s "$built" .flow/checks.wasm; then |
| 28 |
echo ".flow/checks.wasm is what crates/flow-checks builds ($(rustc --version))" |
| 29 |
else |
| 30 |
echo ".flow/checks.wasm differs from what crates/flow-checks builds: run scripts/checks-wasm.sh and commit it" >&2 |
| 31 |
exit 1 |
| 32 |
fi |
| 33 |
else |
| 34 |
cp "$built" .flow/checks.wasm |
| 35 |
echo "built .flow/checks.wasm ($(wc -c < .flow/checks.wasm) bytes, $(rustc --version))" |
| 36 |
fi |