From 53ea7019fa271444205fd69df7428086908e4f5a Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Wed, 2 Jul 2025 12:15:12 +0200 Subject: [PATCH] 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. --- buildsystem/compile.sh | 3 ++- buildsystem/gradle_version/build.gradle | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 buildsystem/gradle_version/build.gradle diff --git a/buildsystem/compile.sh b/buildsystem/compile.sh index 5113eed0b..ae46e17f0 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 000000000..8207510d6 --- /dev/null +++ b/buildsystem/gradle_version/build.gradle @@ -0,0 +1 @@ +println 'gradle_version=' + gradle.getGradleVersion()