open-standards/wai/wai-sink-android/scripts/env.sh
Transaction Science b72652887d wai-sink-android: the native sink's Kotlin library over the C interface
An AAR for phones, tablets and televisions whose applications are written in
Kotlin (extensions/native-sink.md): a JNI layer over wai_sink_* (every status
carried to Kotlin with libwai's message, strings passed as UTF-8 bytes, a NUL
inside one refused); libwai and that layer built by cargo and the pinned NDK
(29.0.14206865) for arm64-v8a, armeabi-v7a and x86_64, linked for 16 KiB pages
and checked for it and for every exported method; the wrapper, the loopback
relay (128-bit path token, 502 for anything refused, ranges from what verified,
content codings removed), the observation loop, the collector client; the player
session over the platform's media player library and the attention signals from
the activity's lifecycle, the window's and display's state, the view's place in
its window and the window's input.

The platform-free half also compiles for the host JVM, so its unit tests drive
the JNI layer over a host build of libwai: the corpus live-conformance/native-sink
(every case, every refused configuration, the page-parity bundle byte for byte),
the relay over the reference floor, and the loop's hidden and idle endings. The
instrumented tests run in a headless emulator: the corpus and the relay on the
device, the floor played through the sink to its end, a changed fragment refused
on every retry, a session nobody can see ended hidden, and the attention signals
from a real activity. Pinned: AGP 8.13.0, Gradle 8.13 (by SHA-256), Kotlin
2.3.21, JDK 17, compileSdk 36, minSdk 24, the media player library 1.11.1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 08:59:13 -04:00

36 lines
1.5 KiB
Shell

# Sourced by the scripts beside it: the pinned versions, and the JDK and Android SDK they use.
#
# The versions this package is built and tested with (README, *Build and test*):
WAI_SINK_GRADLE_VERSION=8.13
WAI_SINK_GRADLE_SHA256=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78
WAI_SINK_NDK_VERSION=${WAI_SINK_NDK_VERSION:-29.0.14206865}
WAI_SINK_MIN_API=${WAI_SINK_MIN_API:-24}
WAI_SINK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
WAI_RS_DIR="$WAI_SINK_DIR/../wai-rs"
die() { echo "wai-sink-android: $*" >&2; exit 1; }
sha256_of() {
if command -v sha256sum >/dev/null 2>&1; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi
}
# A JDK 17: JAVA_HOME if set, else the host's packaged one.
if [ -z "${JAVA_HOME:-}" ]; then
for j in /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home /usr/lib/jvm/java-17-openjdk-* /usr/lib/jvm/temurin-17-*; do
if [ -x "$j/bin/javac" ]; then JAVA_HOME="$j"; break; fi
done
fi
if [ -z "${JAVA_HOME:-}" ] && command -v javac >/dev/null 2>&1; then
JAVA_HOME="$(cd "$(dirname "$(readlink -f "$(command -v javac)")")/.." && pwd)"
fi
export JAVA_HOME
# The Android SDK, where one is installed (the AAR and the emulator tests need it; the JVM tests
# do not).
if [ -z "${ANDROID_HOME:-}" ]; then
for s in "${ANDROID_SDK_ROOT:-}" "$HOME/Library/Android/sdk" "$HOME/Android/Sdk"; do
if [ -n "$s" ] && [ -d "$s/platforms" ]; then ANDROID_HOME="$s"; break; fi
done
fi
if [ -n "${ANDROID_HOME:-}" ]; then export ANDROID_HOME; fi