-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify.sh
More file actions
executable file
·37 lines (31 loc) · 1.26 KB
/
Copy pathverify.sh
File metadata and controls
executable file
·37 lines (31 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
set -e
# Prefer an existing JAVA_HOME. Otherwise try Android Studio's bundled JBR.
if [ -z "${JAVA_HOME:-}" ] || [ ! -x "${JAVA_HOME}/bin/java" ]; then
for candidate in \
"$HOME/android-studio/jbr" \
"$HOME/Android/android-studio/jbr" \
"/opt/android-studio/jbr" \
"/usr/local/android-studio/jbr" \
"$HOME/.jdks/ms-21.0.7" \
"$HOME/.jdks/jbr-21"
do
if [ -x "$candidate/bin/java" ]; then
export JAVA_HOME="$candidate"
break
fi
done
fi
if [ -z "${JAVA_HOME:-}" ] || [ ! -x "${JAVA_HOME}/bin/java" ]; then
echo "Error: set JAVA_HOME to a JDK 21 install (Android Studio Embedded JDK / jbr-21 works)."
exit 1
fi
echo "Verifying with JAVA_HOME=$JAVA_HOME ..."
# assembleDebug catches: type errors, missing methods, unresolved resources,
# bad manifests - everything the compiler and resource processor validate.
./gradlew assembleDebug
# Run the full unit test suite. testDebugUnitTest compiles every test source
# under app/src/test and executes them. Gradle exits non-zero when any test
# fails; combined with `set -e` above, a failing test fails this whole step.
./gradlew testDebugUnitTest
echo "Verification complete: build assembled, all unit tests passed."