mirror of
https://github.com/ARMSX2/ARMSX3.git
synced 2026-08-24 16:58:52 -07:00
Build: reject a half-configured upload key, and find a JDK
Checking that keystore.properties exists was not enough. A template with the placeholders still in it passed the check and went on to build, failing much later inside signing with an error that says nothing about the cause. It now rejects the placeholders too, so the message arrives before the fifteen minutes rather than after them. Also locate a JDK. The script assumed the calling shell had one on PATH, and without it gradle fails with "Unable to locate a Java Runtime" several steps in, which points at Java rather than at the environment. Android Studio's bundled JDK is used when JAVA_HOME is unset, with /usr/libexec/java_home as a fallback and a clear failure if neither exists.
This commit is contained in:
@@ -26,11 +26,25 @@ UI="$HERE/armsx3-ui"
|
||||
|
||||
MIN_SDK="${PLAY_MIN_SDK:-30}"
|
||||
|
||||
# Gradle needs a JDK and the shell this is run from may not have one on PATH. Android Studio
|
||||
# ships one; fall back to it rather than failing several steps later with "Unable to locate a
|
||||
# Java Runtime", which does not point at the cause.
|
||||
if [ -z "${JAVA_HOME:-}" ]; then
|
||||
for candidate in \
|
||||
"/Applications/Android Studio.app/Contents/jbr/Contents/Home" \
|
||||
"$(/usr/libexec/java_home 2>/dev/null || true)"
|
||||
do
|
||||
[ -x "$candidate/bin/java" ] && { export JAVA_HOME="$candidate"; break; }
|
||||
done
|
||||
fi
|
||||
[ -n "${JAVA_HOME:-}" ] || { echo "FAIL: no JDK found; set JAVA_HOME" >&2; exit 1; }
|
||||
export PATH="$JAVA_HOME/bin:$PATH"
|
||||
|
||||
# Refuse to build at all without an upload key. A debug-signed bundle is rejected by Play, and
|
||||
# finding that out at upload time after a fifteen-minute build is a poor way to learn it.
|
||||
if [ ! -f "$UI/keystore.properties" ]; then
|
||||
if [ ! -f "$UI/keystore.properties" ] || grep -q "REPLACE_ME\|REPLACE_WITH_ABSOLUTE_PATH" "$UI/keystore.properties"; then
|
||||
cat >&2 <<'MSG'
|
||||
FAIL: no upload key configured.
|
||||
FAIL: upload key not configured (file missing, or placeholders not filled in).
|
||||
|
||||
Create android/armsx3-ui/keystore.properties with:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user