From 71fc0a9e93d7f2994847ec5f94d128431cbcd741 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Tue, 24 Jun 2025 08:23:41 +0200 Subject: [PATCH] buildsystem: allow using the gradle from the PATH to download our gradle wrapper version --- buildsystem/compile.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/buildsystem/compile.sh b/buildsystem/compile.sh index 460001320..5a583e0c6 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