[Android] buildsystem: check the gradle version in the PATH matches the one we want

Steve Lhomme git at videolan.org
Thu Jul 3 10:48:39 UTC 2025


vlc-android | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jul  2 12:15:12 2025 +0200| [53ea7019fa271444205fd69df7428086908e4f5a] | committer: Steve Lhomme

buildsystem: check the gradle version in the PATH matches the one we want

Older gradle versions may give an error in the simplistic build.gradle.
It's fine, we won't have a matching version.

> https://code.videolan.org/videolan/vlc-android/commit/53ea7019fa271444205fd69df7428086908e4f5a
---

 buildsystem/compile.sh                  | 3 ++-
 buildsystem/gradle_version/build.gradle | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/buildsystem/compile.sh b/buildsystem/compile.sh
index 5113eed0bc..ae46e17f06 100755
--- a/buildsystem/compile.sh
+++ b/buildsystem/compile.sh
@@ -264,7 +264,8 @@ if [ ! -e "./gradlew" ] || [ ! -x "./gradlew" ]; then
     GRADLE_URL=https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip
 
     export PATH="$(pwd -P)/gradle-${GRADLE_VERSION}/bin:$PATH"
-    if [ ! $(command -v gradle) >/dev/null 2>&1 ]; then
+    GRADLE_PATH_VERSION=$(cd buildsystem/gradle_version; gradle -q 2>/dev/null | grep gradle_version= | cut -b 16-)
+    if [ "$GRADLE_PATH_VERSION" != "$GRADLE_VERSION" ]; 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"
diff --git a/buildsystem/gradle_version/build.gradle b/buildsystem/gradle_version/build.gradle
new file mode 100644
index 0000000000..8207510d6f
--- /dev/null
+++ b/buildsystem/gradle_version/build.gradle
@@ -0,0 +1 @@
+println 'gradle_version=' + gradle.getGradleVersion()



More information about the Android mailing list