open-standards/wai/examples/android-app/test/android-app.test.sh
Transaction Science 632f8cf394 wai: the developer's path, hello, create, dev and verify, a floor build with no system library, and nine examples
wai-rs gains the feature floor (the mandatory floor of SPEC 5: PNG, FLAC and
zstd, decoded with no system codec library) and quickstart (the floor, and the
receipt checks hello and verify run). The wai command line gains four verbs,
one module each, named in one table (dx::VERBS):

- hello: name, dispatch, rebuild and receipt on a picture made here, the
  receipt laid out as http-delivery 8 lays receipts beside an object;
- create: a new project from one of the examples, whose files the binary
  holds; tests/cli_dx.rs holds them to wai/examples/ byte for byte;
- dev: the relay, the room service and the room page on one loopback origin,
  as a production front serves them; --check checks each piece through it;
- verify: the receipt indexes under a directory, checked offline.

The project file a template writes, wai.json, is read in one place
(dx/project.rs). wai/examples/ holds video-room, watch-together, messaging,
encoder-ingest, package-and-deliver, verify-receipts, apple-app, android-app
and remote-desktop, each with a README and a test that runs it through
wai create and wai dev. wai/quickstart/ builds the room client and the
archive that holds wai, the relay, the room service, the remote host and the
packager.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 22:58:39 -04:00

26 lines
1.5 KiB
Shell
Executable file

#!/usr/bin/env bash
# The android-app example on a JDK 17 host: `wai create` makes the project, the SDK's host
# library is built if it is not, and the replay must put the recorded session through the
# sink's Kotlin API and verify its bundle.
#
# bash wai/examples/android-app/test/android-app.test.sh
# Needs wai on PATH, a JDK 17, Rust, and network access for Gradle and its plugins the first time.
set -uo pipefail
REPO=$(cd "$(dirname "$0")/../../../.." && pwd)
SDK="$REPO/wai/wai-sink-android"
T=$(mktemp -d)
wai create "$T/app" --template android-app > /dev/null || { echo "FAIL wai create"; exit 1; }
. "$SDK/scripts/env.sh"
[ -n "${JAVA_HOME:-}" ] || { echo "FAIL no JDK 17"; exit 1; }
if ! ls "$SDK"/core/build/native/libwai_sink_jni.* > /dev/null 2>&1; then
bash "$SDK/scripts/build-native.sh" host > "$T/native.log" 2>&1 || { tail -30 "$T/native.log"; echo "FAIL the SDK's host library builds"; exit 1; }
fi
# The Gradle the SDK pins, fetched and checked by its own script.
bash "$SDK/scripts/gradle.sh" -Pwai.sink.jvmOnly=true --version > /dev/null || { echo "FAIL the pinned Gradle"; exit 1; }
G="${WAI_SINK_GRADLE_DISTS:-${GRADLE_USER_HOME:-$HOME/.gradle}/wai-sink-dists}/gradle-$WAI_SINK_GRADLE_VERSION/bin/gradle"
cd "$T/app"
s=0
WAI_SINK_ANDROID="$SDK" "$G" --no-daemon --console=plain -q :replay:run > run.log 2>&1 || s=$?
tail -3 run.log
if [ $s = 0 ] && grep -q 'the bundle verifies' run.log; then echo "ok the recorded session goes through the sink's Kotlin API, and its bundle verifies"; else echo "FAIL the replay (exit $s)"; s=1; fi
exit $s