mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 06:53:19 -10:00
This repository was an export of a private one; from this commit on it is where raea is developed. Contributions: CONTRIBUTING.md.
18 lines
1.2 KiB
Bash
Executable File
18 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# The TypeScript table of native calls (sdk/raea/src/native-calls.ts) against the registry it's generated from:
|
|
# exits 1 when `raea types` (every host's registered calls, from the raea binary) prints something else, so a call
|
|
# added or changed in Rust can't go untyped in TS. It reads the built binary, so it belongs after a build of main
|
|
# (L2), not in L0. `tools/native-types.sh --write` regenerates the file.
|
|
set -u
|
|
ROOT=$(cd "$(dirname "$0")/.." && pwd)
|
|
F=$ROOT/sdk/raea/src/native-calls.ts
|
|
RAEA=${RAEA_BIN:-$ROOT/target/release/raea}
|
|
[ -x "$RAEA" ] || { echo "native-types: no raea binary at $RAEA (build -p raea-cli, or set RAEA_BIN)"; exit 2; }
|
|
out=$("$RAEA" types 2>/dev/null) && [ -n "$out" ] || { echo "native-types: raea types printed nothing"; exit 2; }
|
|
if [ "${1:-}" = --write ]; then printf '%s\n' "$out" > "$F"; echo "native-types: wrote $F"; exit 0; fi
|
|
if d=$(diff -B <(printf '%s\n' "$out") "$F"); then echo "native-types: ok"; else
|
|
echo "native-types: sdk/raea/src/native-calls.ts is out of date with the registry (tools/native-types.sh --write):"
|
|
echo "$d" | grep -E '^[<>] +"' | sed 's/^< / missing in TS: /; s/^> / only in TS: /' | cut -c1-120
|
|
exit 1
|
|
fi
|