[Android] buildsystem: fix gradle download

Khalid Masum git at videolan.org
Mon Jul 21 14:57:28 UTC 2025


vlc-android | branch: master | Khalid Masum <khalid.masum.92 at gmail.com> | Fri Jul 18 17:34:38 2025 +0600| [24591f070ed7afc0ea3697b6cfea87fe7b14bfdc] | committer: Khalid Masum

buildsystem: fix gradle download

Current gradle download mechanism has two issues. Assuming, the gradle
download url is:
https://services.gradle.org/distributions/gradle-8.13-bin.zip

1. Compilation script will break if we stop the script amidst the
   download the first time. As next time wget will save the file as:
   gradle-8.13-bin.zip.1, gradle-8.13-bin.zip.2 ... because
   a broken gradle-8.13-bin.zip already exists.

2. For curl to download successfuly from the url, redirection flag
   must be turned on, as it redirects to a different url.

This patch fixes these issues by (1) providing wget the output filename
and (2) turning on redirection for curl using the -L flag.

> https://code.videolan.org/videolan/vlc-android/commit/24591f070ed7afc0ea3697b6cfea87fe7b14bfdc
---

 buildsystem/compile.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildsystem/compile.sh b/buildsystem/compile.sh
index a8c30a90c2..9206dad045 100755
--- a/buildsystem/compile.sh
+++ b/buildsystem/compile.sh
@@ -267,7 +267,7 @@ if [ ! -e "./gradlew" ] || [ ! -x "./gradlew" ]; 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"
+        wget ${GRADLE_URL} -O gradle-${GRADLE_VERSION}-bin.zip 2>/dev/null || curl -LO ${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"



More information about the Android mailing list