mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-03 16:41:26 +01:00
improved android client, feature parity with desktop
This commit is contained in:
1 parent
352fdf1933
commit
f1b3ad9637
56 files changed
+9727
-1799
No files matched your search
@@ -7,11 +7,14 @@ android_dir="$repo_root/android"
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 {debug|check|release|signed|all}"
|
||||
echo
|
||||
echo " check ktlint, Android lint and host unit tests — no device needed."
|
||||
echo " On-device coverage is scripts/android-acceptance.sh."
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
debug) tasks=(assembleDebug) ;;
|
||||
check) tasks=(lintDebug testDebugUnitTest) ;;
|
||||
check) tasks=(ktlintCheck lintDebug testDebugUnitTest) ;;
|
||||
release) tasks=(assembleRelease bundleRelease) ;;
|
||||
signed)
|
||||
required=(
|
||||
@@ -28,10 +31,42 @@ case "${1:-}" in
|
||||
done
|
||||
tasks=(assembleRelease bundleRelease)
|
||||
;;
|
||||
all) tasks=(lintDebug testDebugUnitTest assembleDebug assembleRelease bundleRelease) ;;
|
||||
all) tasks=(ktlintCheck lintDebug testDebugUnitTest assembleDebug assembleRelease bundleRelease) ;;
|
||||
*) usage >&2; exit 2 ;;
|
||||
esac
|
||||
|
||||
# The Android toolchain needs JDK 17. A newer JVM does not fail with a version
|
||||
# message — the Kotlin compiler throws `IllegalArgumentException: 26.0.2` out of
|
||||
# an IntelliJ version parser, which reads as a broken build rather than a wrong
|
||||
# JDK. Find 17 before that can happen.
|
||||
java_major() {
|
||||
local java_bin="$1"
|
||||
[[ -x "$java_bin" ]] || return 1
|
||||
"$java_bin" -version 2>&1 | sed -n '1s/.*version "\([0-9]*\).*/\1/p'
|
||||
}
|
||||
|
||||
if [[ "$(java_major "${JAVA_HOME:-}/bin/java" || true)" != "17" ]]; then
|
||||
found=""
|
||||
for candidate in \
|
||||
/usr/lib/jvm/java-17-openjdk \
|
||||
/usr/lib/jvm/java-17-openjdk-amd64 \
|
||||
/usr/lib/jvm/temurin-17-jdk \
|
||||
/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home; do
|
||||
if [[ "$(java_major "$candidate/bin/java" || true)" == "17" ]]; then
|
||||
found="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ -z "$found" ]] && [[ "$(java_major "$(command -v java || echo /nonexistent)" || true)" == "17" ]]; then
|
||||
found="$(dirname "$(dirname "$(readlink -f "$(command -v java)")")")"
|
||||
fi
|
||||
if [[ -z "$found" ]]; then
|
||||
echo "error: JDK 17 is required (see docs/ANDROID.md); set JAVA_HOME to it" >&2
|
||||
exit 1
|
||||
fi
|
||||
export JAVA_HOME="$found"
|
||||
fi
|
||||
|
||||
if [[ -x "$android_dir/gradlew" ]]; then
|
||||
gradle=("$android_dir/gradlew")
|
||||
elif command -v gradle >/dev/null 2>&1; then
|
||||
|
||||
Reference in new issue
Block a user