pre-commit hook: Android tests through gradle-serial.sh with JDK 25 on PATH, JAVA_HOME untouched; installer replaces an older Kvitt hook

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
This commit is contained in:
2026-10-18 22:11:07 +02:00
parent 2fac1ecba0
commit 61f92c81c5
2 changed files with 18 additions and 11 deletions
+5 -7
View File
@@ -14,13 +14,11 @@ if [ -n "$bad" ]; then
exit 1
fi
# Android: the pure model tests, on the pinned JDK (android/gradle.properties); the shell's java may be a stub.
if [ -x "$top/android/gradlew" ] && [ -d "$top/android/core/model" ]; then
case "$("${JAVA_HOME:+$JAVA_HOME/bin/}java" -version 2>&1 | head -1)" in
*\"25*) ;;
*) [ -d /opt/homebrew/opt/openjdk@25 ] && export JAVA_HOME=/opt/homebrew/opt/openjdk@25/libexec/openjdk.jdk/Contents/Home ;;
esac
(cd "$top/android" && ./gradlew --quiet :core:model:test :domain:test) || {
# Android: the pure model tests, through the one-build-at-a-time lock, with JDK 25 first on PATH and JAVA_HOME
# untouched (CLAUDE.md › Build and verify); the shell's java may be a stub.
if [ -x "$top/android/gradlew" ] && [ -d "$top/android/core/model" ] && [ -x "$top/tools/gradle-serial.sh" ]; then
[ -d /opt/homebrew/opt/openjdk@25/bin ] && PATH="/opt/homebrew/opt/openjdk@25/bin:$PATH"
"$top/tools/gradle-serial.sh" --quiet :core:model:test :domain:test || {
echo "pre-commit: Android fast tests failed (see above). Run tools/gradle-serial.sh check for the full picture." >&2
exit 1
}