You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by ma...@apache.org on 2026/10/15 17:46:07 UTC

(iggy) branch improve-gradle-jar-fetch updated (5e2d16f4a -> de46818e0)

This is an automated email from the ASF dual-hosted git repository.

mmodzelewski pushed a change to branch improve-gradle-jar-fetch
in repository https://gitbox.apache.org/repos/asf/iggy.git


 discard 5e2d16f4a fix(java): decouple wrapper JAR fetch from the Gradle version
     add ec985b7e0 perf(ci): avoid redundant Rust coverage builds (#4546)
     add 5992f416a chore(deps): Bump the java group across 3 directories with 10 updates (#4548)
     add 12cc1f3cf feat(java): parse iggy:// connection strings in TcpClientBuilder (#4504)
     new de46818e0 fix(java): decouple wrapper JAR fetch from the Gradle version

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (5e2d16f4a)
            \
             N -- N -- N   refs/heads/improve-gradle-jar-fetch (de46818e0)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .config/nextest.toml                               |   3 +-
 .github/actions/cpp-bazel/pre-merge/action.yml     |   8 +-
 .github/actions/csharp-dotnet/pre-merge/action.yml |   6 +-
 .github/actions/go/pre-merge/action.yml            |   6 +-
 .github/actions/java-gradle/post-merge/action.yml  |   4 +-
 .github/actions/java-gradle/pre-merge/action.yml   |   8 +-
 .github/actions/node-npm/pre-merge/action.yml      |   7 +-
 .github/actions/php/pre-merge/action.yml           |   4 +-
 .../actions/python-maturin/pre-merge/action.yml    |  50 ++--
 .github/actions/rust/post-merge/action.yml         |   4 +-
 .github/actions/rust/pre-merge/action.yml          | 258 ++++++++++----------
 .github/actions/swift/pre-merge/action.yml         |   2 +-
 .github/actions/utils/server-start/action.yml      |  13 +-
 .../{setup-cpp-with-cache => setup-cpp}/action.yml |   9 +-
 .../{setup-go-with-cache => setup-go}/action.yml   |   4 +-
 .../action.yml                                     |   2 +-
 .../action.yml                                     |  29 +--
 .../action.yml                                     |  86 ++++---
 .../utils/validate-third-party-licenses/action.yml |   5 +-
 .github/config/components.yml                      |   6 +-
 .github/workflows/_build_python_wheels.yml         |  12 +-
 .github/workflows/_build_rust_artifacts.yml        |   9 +-
 .github/workflows/_common.yml                      |   1 +
 .github/workflows/_detect.yml                      |  19 +-
 .github/workflows/_publish_rust_crates.yml         |   4 +-
 .github/workflows/_rust.yml                        | 196 +++++++++++++++
 .github/workflows/_test.yml                        |  76 +-----
 .github/workflows/_test_bdd.yml                    |  43 +++-
 .github/workflows/_test_examples.yml               |  63 +++--
 .github/workflows/coverage-baseline.yml            | 191 ++++++---------
 .github/workflows/pr-skill-review-run.yml          |   2 +
 .github/workflows/pre-merge.yml                    |  32 +--
 .github/workflows/publish.yml                      |   2 +-
 bdd/docker-compose.cluster.yml                     |   3 +
 bdd/docker-compose.coverage.yml                    |  21 +-
 bdd/docker-compose.server.yml                      |   2 +
 bdd/docker-compose.yml                             |   2 +
 bdd/java/build.gradle.kts                          |   4 +-
 bdd/java/gradle/wrapper/gradle-wrapper.properties  |   2 +-
 bdd/rust/Dockerfile                                |  40 +++-
 codecov.yml                                        |   3 +
 .../java/gradle/wrapper/gradle-wrapper.properties  |   2 +-
 foreign/java/README.md                             |  23 ++
 foreign/java/gradle/libs.versions.toml             |   6 +-
 .../java/gradle/wrapper/gradle-wrapper.properties  |   2 +-
 .../org/apache/iggy/builder/TcpClientBuilder.java  |  20 ++
 .../async/tcp/AsyncIggyTcpClientBuilder.java       |  32 +++
 .../client/blocking/tcp/IggyTcpClientBuilder.java  |  22 ++
 .../apache/iggy/config/TcpConnectionString.java    | 263 +++++++++++++++++++++
 .../src/test/java/org/apache/iggy/IggyTest.java    |   4 +
 ...ncIggyTcpClientBuilderConnectionStringTest.java |  65 +++++
 .../async/tcp/AsyncIggyTcpClientBuilderTest.java   |  12 +
 .../blocking/tcp/IggyTcpClientBuilderTest.java     |  13 +
 .../iggy/config/TcpConnectionStringTest.java       | 210 ++++++++++++++++
 scripts/ci/coverage-baseline-affected.sh           |   2 +-
 scripts/ci/storage-compat.sh                       |   4 +
 scripts/run-bdd-tests.sh                           |   3 +-
 57 files changed, 1373 insertions(+), 551 deletions(-)
 rename .github/actions/utils/{setup-cpp-with-cache => setup-cpp}/action.yml (82%)
 rename .github/actions/utils/{setup-go-with-cache => setup-go}/action.yml (98%)
 rename .github/actions/utils/{setup-java-with-cache => setup-java}/action.yml (98%)
 rename .github/actions/utils/{setup-node-with-cache => setup-node}/action.yml (68%)
 rename .github/actions/utils/{setup-rust-with-cache => setup-rust}/action.yml (74%)
 create mode 100644 .github/workflows/_rust.yml
 create mode 100644 foreign/java/java-sdk/src/main/java/org/apache/iggy/config/TcpConnectionString.java
 create mode 100644 foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/tcp/AsyncIggyTcpClientBuilderConnectionStringTest.java
 create mode 100644 foreign/java/java-sdk/src/test/java/org/apache/iggy/config/TcpConnectionStringTest.java


(iggy) 01/01: fix(java): decouple wrapper JAR fetch from the Gradle version

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mmodzelewski pushed a commit to branch improve-gradle-jar-fetch
in repository https://gitbox.apache.org/repos/asf/iggy.git

commit de46818e0cf263d40ad63da85d0cb2fdce525dca
Author: Maciej Modzelewski <ma...@modzelewski.dev>
AuthorDate: Thu Oct 15 13:28:28 2026 +0200

    fix(java): decouple wrapper JAR fetch from the Gradle version
    
    The gradlew scripts built the wrapper JAR URL from the Gradle
    version. At each release tag, the Gradle source tree holds the
    JAR that built that release, and that JAR can be older. Tag
    v9.8.1 holds the 9.8.0 JAR, so a bump to 9.8.1 with the 9.8.1
    checksum can never match. The download also ran curl without -f,
    so an HTTP error page was saved as the JAR. Both cases ended
    after three retries with a message that blamed the network.
    
    The scripts now pin a source tag and the SHA-256 of the file at
    that tag, apart from the Gradle version. The wrapper JAR only
    starts the distribution set in gradle-wrapper.properties, so the
    two do not need to match. curl now fails on HTTP errors, and a
    checksum mismatch stops with the expected and actual values.
---
 bdd/java/gradlew      | 87 ++++++++++++++++++++++++++++++++-------------------
 examples/java/gradlew | 87 ++++++++++++++++++++++++++++++++-------------------
 foreign/java/gradlew  | 87 ++++++++++++++++++++++++++++++++-------------------
 3 files changed, 165 insertions(+), 96 deletions(-)

diff --git a/bdd/java/gradlew b/bdd/java/gradlew
index a286c099e..338c2b698 100755
--- a/bdd/java/gradlew
+++ b/bdd/java/gradlew
@@ -106,49 +106,72 @@ die () {
 #
 #   Gradle Wrapper JAR Auto-Fetch
 #
-#   Since the Apache Software Foundation prohibits binary files in source
-#   repositories, we download the gradle-wrapper.jar from the official
-#   Gradle repository if it's missing.
+#   The Apache Software Foundation prohibits binary files in source
+#   repositories, so gradle-wrapper.jar is downloaded when it is missing.
+#
+#   Gradle publishes the checksum of each wrapper JAR, but ships the JAR only
+#   inside the distribution. The JAR therefore comes from the Gradle source
+#   tree at a release tag. That copy is the wrapper that Gradle used to build
+#   the release, and it can be the JAR of an older release. For example, tag
+#   v9.8.1 holds the 9.8.0 JAR. The wrapper JAR only starts the distribution
+#   set in gradle-wrapper.properties, so the tag does not need to follow the
+#   Gradle version. If you change the tag, pin the SHA-256 of the file at that
+#   tag and make sure that it is listed at https://gradle.org/release-checksums/.
+#
+#   Dependabot removes this block when it updates the wrapper. Restore it as
+#   it is.
 #
 ##############################################################################
 
-GRADLE_WRAPPER_VERSION=9.8.1
-REQUIRED_WRAPPER_JAR_CHECKSUM="238e777fcddd7e34f9708186085def2abd6e08e658505b38718d79d74c21abd5" # checksum of v9.8.0
+GRADLE_WRAPPER_JAR_TAG=v9.8.0
+GRADLE_WRAPPER_JAR_SHA256=238e777fcddd7e34f9708186085def2abd6e08e658505b38718d79d74c21abd5
+GRADLE_WRAPPER_JAR_URL=https://raw.githubusercontent.com/gradle/gradle/$GRADLE_WRAPPER_JAR_TAG/gradle/wrapper/gradle-wrapper.jar
+WRAPPER_JAR=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
 
-for _ in 1 2 3; do
-    if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
-        if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v$GRADLE_WRAPPER_VERSION/gradle/wrapper/gradle-wrapper.jar"; then
-            rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
-            sleep 5
-            continue
-        fi
+wrapper_jar_sha256 () {
+    if command -v sha256sum >/dev/null 2>&1; then
+        sha256sum "$WRAPPER_JAR" | awk '{print $1}'
+    elif command -v shasum >/dev/null 2>&1; then
+        shasum -a 256 "$WRAPPER_JAR" | awk '{print $1}'
+    else
+        warn "Cannot find sha256sum or shasum to verify wrapper JAR."
+        echo "$GRADLE_WRAPPER_JAR_SHA256"
     fi
+}
 
-    if [ -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
-        if command -v sha256sum >/dev/null 2>&1; then
-            LOCAL_WRAPPER_JAR_CHECKSUM=$(sha256sum "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" | awk '{print $1}')
-        elif command -v shasum >/dev/null 2>&1; then
-            LOCAL_WRAPPER_JAR_CHECKSUM=$(shasum -a 256 "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" | awk '{print $1}')
-        else
-            warn "Cannot find sha256sum or shasum to verify wrapper JAR."
-            break
-        fi
+# A JAR left by an older pin no longer matches, so it is downloaded again.
+if [ -e "$WRAPPER_JAR" ] && [ "$( wrapper_jar_sha256 )" != "$GRADLE_WRAPPER_JAR_SHA256" ]; then
+    rm -f "$WRAPPER_JAR"
+fi
 
-        if [ "$LOCAL_WRAPPER_JAR_CHECKSUM" != "$REQUIRED_WRAPPER_JAR_CHECKSUM" ]; then
-            rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
-        else
-            break
-        fi
-    fi
-done
+if [ ! -e "$WRAPPER_JAR" ]; then
+    for _ in 1 2 3; do
+        curl -f -s -S --retry 3 -L -o "$WRAPPER_JAR" "$GRADLE_WRAPPER_JAR_URL" && break
+        rm -f "$WRAPPER_JAR"
+        sleep 5
+    done
 
-if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
-    die "ERROR: Failed to download gradle-wrapper.jar after multiple attempts.
+    if [ ! -e "$WRAPPER_JAR" ]; then
+        die "ERROR: Failed to download gradle-wrapper.jar after multiple attempts.
 
 Please check your network connection or manually download the file from:
-https://raw.githubusercontent.com/gradle/gradle/v$GRADLE_WRAPPER_VERSION/gradle/wrapper/gradle-wrapper.jar
+$GRADLE_WRAPPER_JAR_URL
+
+and place it in $WRAPPER_JAR"
+    fi
 
-and place it in $APP_HOME/gradle/wrapper/gradle-wrapper.jar"
+    DOWNLOADED_WRAPPER_JAR_SHA256=$( wrapper_jar_sha256 )
+    if [ "$DOWNLOADED_WRAPPER_JAR_SHA256" != "$GRADLE_WRAPPER_JAR_SHA256" ]; then
+        rm -f "$WRAPPER_JAR"
+        die "ERROR: The downloaded gradle-wrapper.jar does not have the pinned SHA-256 checksum.
+
+URL:      $GRADLE_WRAPPER_JAR_URL
+Expected: $GRADLE_WRAPPER_JAR_SHA256
+Actual:   $DOWNLOADED_WRAPPER_JAR_SHA256
+
+Make sure that GRADLE_WRAPPER_JAR_SHA256 in $0 is the checksum of the file at
+tag $GRADLE_WRAPPER_JAR_TAG."
+    fi
 fi
 
 # OS specific support (must be 'true' or 'false').
diff --git a/examples/java/gradlew b/examples/java/gradlew
index a286c099e..338c2b698 100755
--- a/examples/java/gradlew
+++ b/examples/java/gradlew
@@ -106,49 +106,72 @@ die () {
 #
 #   Gradle Wrapper JAR Auto-Fetch
 #
-#   Since the Apache Software Foundation prohibits binary files in source
-#   repositories, we download the gradle-wrapper.jar from the official
-#   Gradle repository if it's missing.
+#   The Apache Software Foundation prohibits binary files in source
+#   repositories, so gradle-wrapper.jar is downloaded when it is missing.
+#
+#   Gradle publishes the checksum of each wrapper JAR, but ships the JAR only
+#   inside the distribution. The JAR therefore comes from the Gradle source
+#   tree at a release tag. That copy is the wrapper that Gradle used to build
+#   the release, and it can be the JAR of an older release. For example, tag
+#   v9.8.1 holds the 9.8.0 JAR. The wrapper JAR only starts the distribution
+#   set in gradle-wrapper.properties, so the tag does not need to follow the
+#   Gradle version. If you change the tag, pin the SHA-256 of the file at that
+#   tag and make sure that it is listed at https://gradle.org/release-checksums/.
+#
+#   Dependabot removes this block when it updates the wrapper. Restore it as
+#   it is.
 #
 ##############################################################################
 
-GRADLE_WRAPPER_VERSION=9.8.1
-REQUIRED_WRAPPER_JAR_CHECKSUM="238e777fcddd7e34f9708186085def2abd6e08e658505b38718d79d74c21abd5" # checksum of v9.8.0
+GRADLE_WRAPPER_JAR_TAG=v9.8.0
+GRADLE_WRAPPER_JAR_SHA256=238e777fcddd7e34f9708186085def2abd6e08e658505b38718d79d74c21abd5
+GRADLE_WRAPPER_JAR_URL=https://raw.githubusercontent.com/gradle/gradle/$GRADLE_WRAPPER_JAR_TAG/gradle/wrapper/gradle-wrapper.jar
+WRAPPER_JAR=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
 
-for _ in 1 2 3; do
-    if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
-        if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v$GRADLE_WRAPPER_VERSION/gradle/wrapper/gradle-wrapper.jar"; then
-            rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
-            sleep 5
-            continue
-        fi
+wrapper_jar_sha256 () {
+    if command -v sha256sum >/dev/null 2>&1; then
+        sha256sum "$WRAPPER_JAR" | awk '{print $1}'
+    elif command -v shasum >/dev/null 2>&1; then
+        shasum -a 256 "$WRAPPER_JAR" | awk '{print $1}'
+    else
+        warn "Cannot find sha256sum or shasum to verify wrapper JAR."
+        echo "$GRADLE_WRAPPER_JAR_SHA256"
     fi
+}
 
-    if [ -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
-        if command -v sha256sum >/dev/null 2>&1; then
-            LOCAL_WRAPPER_JAR_CHECKSUM=$(sha256sum "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" | awk '{print $1}')
-        elif command -v shasum >/dev/null 2>&1; then
-            LOCAL_WRAPPER_JAR_CHECKSUM=$(shasum -a 256 "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" | awk '{print $1}')
-        else
-            warn "Cannot find sha256sum or shasum to verify wrapper JAR."
-            break
-        fi
+# A JAR left by an older pin no longer matches, so it is downloaded again.
+if [ -e "$WRAPPER_JAR" ] && [ "$( wrapper_jar_sha256 )" != "$GRADLE_WRAPPER_JAR_SHA256" ]; then
+    rm -f "$WRAPPER_JAR"
+fi
 
-        if [ "$LOCAL_WRAPPER_JAR_CHECKSUM" != "$REQUIRED_WRAPPER_JAR_CHECKSUM" ]; then
-            rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
-        else
-            break
-        fi
-    fi
-done
+if [ ! -e "$WRAPPER_JAR" ]; then
+    for _ in 1 2 3; do
+        curl -f -s -S --retry 3 -L -o "$WRAPPER_JAR" "$GRADLE_WRAPPER_JAR_URL" && break
+        rm -f "$WRAPPER_JAR"
+        sleep 5
+    done
 
-if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
-    die "ERROR: Failed to download gradle-wrapper.jar after multiple attempts.
+    if [ ! -e "$WRAPPER_JAR" ]; then
+        die "ERROR: Failed to download gradle-wrapper.jar after multiple attempts.
 
 Please check your network connection or manually download the file from:
-https://raw.githubusercontent.com/gradle/gradle/v$GRADLE_WRAPPER_VERSION/gradle/wrapper/gradle-wrapper.jar
+$GRADLE_WRAPPER_JAR_URL
+
+and place it in $WRAPPER_JAR"
+    fi
 
-and place it in $APP_HOME/gradle/wrapper/gradle-wrapper.jar"
+    DOWNLOADED_WRAPPER_JAR_SHA256=$( wrapper_jar_sha256 )
+    if [ "$DOWNLOADED_WRAPPER_JAR_SHA256" != "$GRADLE_WRAPPER_JAR_SHA256" ]; then
+        rm -f "$WRAPPER_JAR"
+        die "ERROR: The downloaded gradle-wrapper.jar does not have the pinned SHA-256 checksum.
+
+URL:      $GRADLE_WRAPPER_JAR_URL
+Expected: $GRADLE_WRAPPER_JAR_SHA256
+Actual:   $DOWNLOADED_WRAPPER_JAR_SHA256
+
+Make sure that GRADLE_WRAPPER_JAR_SHA256 in $0 is the checksum of the file at
+tag $GRADLE_WRAPPER_JAR_TAG."
+    fi
 fi
 
 # OS specific support (must be 'true' or 'false').
diff --git a/foreign/java/gradlew b/foreign/java/gradlew
index a286c099e..338c2b698 100755
--- a/foreign/java/gradlew
+++ b/foreign/java/gradlew
@@ -106,49 +106,72 @@ die () {
 #
 #   Gradle Wrapper JAR Auto-Fetch
 #
-#   Since the Apache Software Foundation prohibits binary files in source
-#   repositories, we download the gradle-wrapper.jar from the official
-#   Gradle repository if it's missing.
+#   The Apache Software Foundation prohibits binary files in source
+#   repositories, so gradle-wrapper.jar is downloaded when it is missing.
+#
+#   Gradle publishes the checksum of each wrapper JAR, but ships the JAR only
+#   inside the distribution. The JAR therefore comes from the Gradle source
+#   tree at a release tag. That copy is the wrapper that Gradle used to build
+#   the release, and it can be the JAR of an older release. For example, tag
+#   v9.8.1 holds the 9.8.0 JAR. The wrapper JAR only starts the distribution
+#   set in gradle-wrapper.properties, so the tag does not need to follow the
+#   Gradle version. If you change the tag, pin the SHA-256 of the file at that
+#   tag and make sure that it is listed at https://gradle.org/release-checksums/.
+#
+#   Dependabot removes this block when it updates the wrapper. Restore it as
+#   it is.
 #
 ##############################################################################
 
-GRADLE_WRAPPER_VERSION=9.8.1
-REQUIRED_WRAPPER_JAR_CHECKSUM="238e777fcddd7e34f9708186085def2abd6e08e658505b38718d79d74c21abd5" # checksum of v9.8.0
+GRADLE_WRAPPER_JAR_TAG=v9.8.0
+GRADLE_WRAPPER_JAR_SHA256=238e777fcddd7e34f9708186085def2abd6e08e658505b38718d79d74c21abd5
+GRADLE_WRAPPER_JAR_URL=https://raw.githubusercontent.com/gradle/gradle/$GRADLE_WRAPPER_JAR_TAG/gradle/wrapper/gradle-wrapper.jar
+WRAPPER_JAR=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
 
-for _ in 1 2 3; do
-    if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
-        if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v$GRADLE_WRAPPER_VERSION/gradle/wrapper/gradle-wrapper.jar"; then
-            rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
-            sleep 5
-            continue
-        fi
+wrapper_jar_sha256 () {
+    if command -v sha256sum >/dev/null 2>&1; then
+        sha256sum "$WRAPPER_JAR" | awk '{print $1}'
+    elif command -v shasum >/dev/null 2>&1; then
+        shasum -a 256 "$WRAPPER_JAR" | awk '{print $1}'
+    else
+        warn "Cannot find sha256sum or shasum to verify wrapper JAR."
+        echo "$GRADLE_WRAPPER_JAR_SHA256"
     fi
+}
 
-    if [ -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
-        if command -v sha256sum >/dev/null 2>&1; then
-            LOCAL_WRAPPER_JAR_CHECKSUM=$(sha256sum "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" | awk '{print $1}')
-        elif command -v shasum >/dev/null 2>&1; then
-            LOCAL_WRAPPER_JAR_CHECKSUM=$(shasum -a 256 "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" | awk '{print $1}')
-        else
-            warn "Cannot find sha256sum or shasum to verify wrapper JAR."
-            break
-        fi
+# A JAR left by an older pin no longer matches, so it is downloaded again.
+if [ -e "$WRAPPER_JAR" ] && [ "$( wrapper_jar_sha256 )" != "$GRADLE_WRAPPER_JAR_SHA256" ]; then
+    rm -f "$WRAPPER_JAR"
+fi
 
-        if [ "$LOCAL_WRAPPER_JAR_CHECKSUM" != "$REQUIRED_WRAPPER_JAR_CHECKSUM" ]; then
-            rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
-        else
-            break
-        fi
-    fi
-done
+if [ ! -e "$WRAPPER_JAR" ]; then
+    for _ in 1 2 3; do
+        curl -f -s -S --retry 3 -L -o "$WRAPPER_JAR" "$GRADLE_WRAPPER_JAR_URL" && break
+        rm -f "$WRAPPER_JAR"
+        sleep 5
+    done
 
-if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
-    die "ERROR: Failed to download gradle-wrapper.jar after multiple attempts.
+    if [ ! -e "$WRAPPER_JAR" ]; then
+        die "ERROR: Failed to download gradle-wrapper.jar after multiple attempts.
 
 Please check your network connection or manually download the file from:
-https://raw.githubusercontent.com/gradle/gradle/v$GRADLE_WRAPPER_VERSION/gradle/wrapper/gradle-wrapper.jar
+$GRADLE_WRAPPER_JAR_URL
+
+and place it in $WRAPPER_JAR"
+    fi
 
-and place it in $APP_HOME/gradle/wrapper/gradle-wrapper.jar"
+    DOWNLOADED_WRAPPER_JAR_SHA256=$( wrapper_jar_sha256 )
+    if [ "$DOWNLOADED_WRAPPER_JAR_SHA256" != "$GRADLE_WRAPPER_JAR_SHA256" ]; then
+        rm -f "$WRAPPER_JAR"
+        die "ERROR: The downloaded gradle-wrapper.jar does not have the pinned SHA-256 checksum.
+
+URL:      $GRADLE_WRAPPER_JAR_URL
+Expected: $GRADLE_WRAPPER_JAR_SHA256
+Actual:   $DOWNLOADED_WRAPPER_JAR_SHA256
+
+Make sure that GRADLE_WRAPPER_JAR_SHA256 in $0 is the checksum of the file at
+tag $GRADLE_WRAPPER_JAR_TAG."
+    fi
 fi
 
 # OS specific support (must be 'true' or 'false').