open-standards/wai/wai-sink-android/scripts/gradle.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

29 lines
1.5 KiB
Shell
Executable file

#!/usr/bin/env bash
# Run the pinned Gradle on this project: fetched once into a cache directory and checked against
# its published SHA-256 before it is unpacked, so no wrapper binary lives in the repository.
#
# scripts/gradle.sh :core:test the JVM tests (build the host library first)
# scripts/gradle.sh :sink:assembleRelease the AAR (build the Android libraries first)
# scripts/gradle.sh -Pwai.sink.jvmOnly=true :core:test on a host with no Android SDK
#
# WAI_SINK_GRADLE_DISTS: where the distribution is kept (default <gradle user home>/wai-sink-dists).
# The daemon is off unless WAI_SINK_GRADLE_DAEMON=1: the hosts these run on are shared.
set -euo pipefail
. "$(dirname "${BASH_SOURCE[0]}")/env.sh"
[ -n "${JAVA_HOME:-}" ] || die "no JDK 17 found: set JAVA_HOME"
V=$WAI_SINK_GRADLE_VERSION
D="${WAI_SINK_GRADLE_DISTS:-${GRADLE_USER_HOME:-$HOME/.gradle}/wai-sink-dists}"
G="$D/gradle-$V/bin/gradle"
if [ ! -x "$G" ]; then
mkdir -p "$D"
T="$(mktemp -d "$D/fetch.XXXXXX")"
trap 'rm -rf "$T"' EXIT
curl -fsSL --retry 3 -o "$T/g.zip" "https://services.gradle.org/distributions/gradle-$V-bin.zip"
got="$(sha256_of "$T/g.zip")"
[ "$got" = "$WAI_SINK_GRADLE_SHA256" ] || die "gradle-$V-bin.zip has SHA-256 $got, not the pinned $WAI_SINK_GRADLE_SHA256"
(cd "$T" && unzip -q g.zip)
[ -x "$G" ] || mv "$T/gradle-$V" "$D/gradle-$V"
fi
daemon=--no-daemon
[ "${WAI_SINK_GRADLE_DAEMON:-0}" = 1 ] && daemon=--daemon
exec "$G" -p "$WAI_SINK_DIR" $daemon --console=plain "$@"