| 1 | #!/bin/sh |
| 2 | # Repeatable native engine, wire compatibility, and Apple adapter checks. |
| 3 | set -eu |
| 4 | cd "$(dirname "$0")/../.." |
| 5 | core_only=0 |
| 6 | mutations=0 |
| 7 | for argument in "$@"; do |
| 8 | case "$argument" in |
| 9 | --core-only) core_only=1 ;; |
| 10 | --mutations) mutations=1 ;; |
| 11 | *) echo "usage: $0 [--core-only] [--mutations]" >&2; exit 2 ;; |
| 12 | esac |
| 13 | done |
| 14 | if [ "$core_only" = 0 ] && [ "$(uname -s)" != Darwin ]; then |
| 15 | echo "Apple checks require macOS; use --core-only for native engine and wire checks." >&2 |
| 16 | exit 2 |
| 17 | fi |
| 18 | if [ -n "${DOCS_LLVM_LIBRARY_PATH:-}" ]; then export DYLD_LIBRARY_PATH="$DOCS_LLVM_LIBRARY_PATH"; fi |
| 19 | CARGO=${CARGO:-cargo} |
| 20 | "$CARGO" build --locked --manifest-path native/crdt/Cargo.toml --release --target wasm32-unknown-unknown --lib |
| 21 | "$CARGO" test --locked --manifest-path native/crdt/Cargo.toml |
| 22 | "$CARGO" test --locked --manifest-path native/host/Cargo.toml |
| 23 | |
| 24 | npm ci --prefix fixtures --ignore-scripts --no-audit --no-fund |
| 25 | native_check_dir=$(mktemp -d "${TMPDIR:-/tmp}/docs-native-check.XXXXXX") |
| 26 | trap 'rm -rf "$native_check_dir"' EXIT HUP INT TERM |
| 27 | "$CARGO" run --locked --quiet --manifest-path native/crdt/Cargo.toml --bin wire_fixture -- "$native_check_dir/native.bin" |
| 28 | node fixtures/native-wire.mjs "$native_check_dir/native.bin" "$native_check_dir/browser.bin" |
| 29 | "$CARGO" run --locked --quiet --manifest-path native/crdt/Cargo.toml --bin wire_fixture -- "$native_check_dir/native.bin" "$native_check_dir/browser.bin" |
| 30 | "$CARGO" run --locked --quiet --manifest-path native/crdt/Cargo.toml --bin rule_wire_probe -- "$native_check_dir/rule" |
| 31 | node native/scripts/check-rule-wire.mjs "$native_check_dir/rule" |
| 32 | if [ "$core_only" = 0 ]; then |
| 33 | native/scripts/build-crdt.sh |
| 34 | swift test --package-path native/apple |
| 35 | fi |
| 36 | if [ "$mutations" = 1 ]; then python3 native/scripts/check-mutations.py; fi |
| 37 | echo "Native checks passed (core-only=$core_only)." |
| 38 | |