[Android] buildsystem: allow using the gradle from the PATH to download our gradle wrapper version
Steve Lhomme
git at videolan.org
Tue Jul 1 07:34:50 UTC 2025
vlc-android | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jun 24 08:23:41 2025 +0200| [71fc0a9e93d7f2994847ec5f94d128431cbcd741] | committer: Steve Lhomme
buildsystem: allow using the gradle from the PATH to download our gradle wrapper version
> https://code.videolan.org/videolan/vlc-android/commit/71fc0a9e93d7f2994847ec5f94d128431cbcd741
---
buildsystem/compile.sh | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/buildsystem/compile.sh b/buildsystem/compile.sh
index 460001320b..5a583e0c68 100755
--- a/buildsystem/compile.sh
+++ b/buildsystem/compile.sh
@@ -256,19 +256,24 @@ fi
# GRADLE #
##########
-if [ ! -d "gradle/wrapper" ]; then
- diagnostic "Downloading gradle"
+if [ ! -e "./gradlew" ] || [ ! -x "./gradlew" ]; then
+ diagnostic "gradlew not found"
# the SHA256 is found in https://gradle.org/release-checksums/
GRADLE_VERSION=8.13
GRADLE_SHA256=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78
GRADLE_URL=https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip
- wget ${GRADLE_URL} 2>/dev/null || curl -O ${GRADLE_URL} || fail "gradle: download failed"
- echo $GRADLE_SHA256 gradle-${GRADLE_VERSION}-bin.zip | sha256sum -c || fail "gradle: hash mismatch"
- unzip -o gradle-${GRADLE_VERSION}-bin.zip || fail "gradle: unzip failed"
- rm -rf gradle-${GRADLE_VERSION}-bin.zip
+ export PATH="$(pwd -P)/gradle-${GRADLE_VERSION}/bin:$PATH"
+ if [ ! $(command -v gradle) >/dev/null 2>&1 ]; then
+ diagnostic "gradle could not be found in PATH, downloading"
+ wget ${GRADLE_URL} 2>/dev/null || curl -O ${GRADLE_URL} || fail "gradle: download failed"
+ echo $GRADLE_SHA256 gradle-${GRADLE_VERSION}-bin.zip | sha256sum -c || fail "gradle: hash mismatch"
- ./gradle-${GRADLE_VERSION}/bin/gradle wrapper ${gradle_prop} || fail "gradle: wrapper failed"
+ unzip -o gradle-${GRADLE_VERSION}-bin.zip || fail "gradle: unzip failed"
+ rm -rf gradle-${GRADLE_VERSION}-bin.zip
+ fi
+
+ gradle wrapper --gradle-version ${GRADLE_VERSION} ${gradle_prop} || fail "gradle: wrapper failed"
chmod a+x gradlew
fi
More information about the Android
mailing list