build.sh: find d8, apktool and apksigner in ~/android-toolchain/calendar-tools, and a JDK, by default

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
XoséandClaude Opus 5.5 committed 2026-10-22 08:42:21 +02:00
1 parent 775aa04cdf
commit 836a16c911
2 files changed
+13

No files matched your search

+10
View File
@@ -11,7 +11,17 @@
set -eu
cd "$(dirname "$0")"
OUT=build
# defaults: the copies in ~/android-toolchain/calendar-tools (build-tools 34's d8.jar and apksigner.jar, apktool 2.9.3)
CT=${CALENDAR_TOOLS:-$HOME/android-toolchain/calendar-tools}
if [ -z "${D8:-}" ] && [ -f "$CT/d8.jar" ]; then D8="java -cp $CT/d8.jar com.android.tools.r8.D8"; fi
D8=${D8:-d8}
if [ -z "${APKTOOL:-}" ] && [ -f "$CT/apktool_2.9.3.jar" ]; then APKTOOL=$CT/apktool_2.9.3.jar; fi
if [ -z "${APKSIGNER:-}" ] && [ -f "$CT/apksigner.jar" ]; then APKSIGNER=$CT/apksigner.jar; fi
if ! command -v javac >/dev/null 2>&1; then
for j in "${JAVA_HOME:-}" /opt/homebrew/opt/openjdk@17 /opt/homebrew/opt/openjdk; do
if [ -n "$j" ] && [ -x "$j/bin/javac" ]; then JAVA_HOME=$j; PATH=$j/bin:$PATH; export JAVA_HOME PATH; break; fi
done
fi
APKTOOL=${APKTOOL:?set APKTOOL=/path/to/apktool.jar}
APKSIGNER=${APKSIGNER:?set APKSIGNER=/path/to/apksigner.jar}
KS=${KEYSTORE:-gingercal.keystore}