#!/bin/sh # Repeatable native engine, wire compatibility, and Apple adapter checks. set -eu cd "$(dirname "$0")/../.." core_only=0 mutations=0 for argument in "$@"; do case "$argument" in --core-only) core_only=1 ;; --mutations) mutations=1 ;; *) echo "usage: $0 [--core-only] [--mutations]" >&2; exit 2 ;; esac done if [ "$core_only" = 0 ] && [ "$(uname -s)" != Darwin ]; then echo "Apple checks require macOS; use --core-only for native engine and wire checks." >&2 exit 2 fi if [ -n "${DOCS_LLVM_LIBRARY_PATH:-}" ]; then export DYLD_LIBRARY_PATH="$DOCS_LLVM_LIBRARY_PATH"; fi CARGO=${CARGO:-cargo} "$CARGO" build --locked --manifest-path native/crdt/Cargo.toml --release --target wasm32-unknown-unknown --lib "$CARGO" test --locked --manifest-path native/crdt/Cargo.toml "$CARGO" test --locked --manifest-path native/host/Cargo.toml npm ci --prefix fixtures --ignore-scripts --no-audit --no-fund native_check_dir=$(mktemp -d "${TMPDIR:-/tmp}/docs-native-check.XXXXXX") trap 'rm -rf "$native_check_dir"' EXIT HUP INT TERM "$CARGO" run --locked --quiet --manifest-path native/crdt/Cargo.toml --bin wire_fixture -- "$native_check_dir/native.bin" node fixtures/native-wire.mjs "$native_check_dir/native.bin" "$native_check_dir/browser.bin" "$CARGO" run --locked --quiet --manifest-path native/crdt/Cargo.toml --bin wire_fixture -- "$native_check_dir/native.bin" "$native_check_dir/browser.bin" "$CARGO" run --locked --quiet --manifest-path native/crdt/Cargo.toml --bin rule_wire_probe -- "$native_check_dir/rule" node native/scripts/check-rule-wire.mjs "$native_check_dir/rule" if [ "$core_only" = 0 ]; then native/scripts/build-crdt.sh swift test --package-path native/apple fi if [ "$mutations" = 1 ]; then python3 native/scripts/check-mutations.py; fi echo "Native checks passed (core-only=$core_only)."