chia7712 commented on code in PR #20658:
URL: https://github.com/apache/kafka/pull/20658#discussion_r2427103839


##########
gradlew:
##########
@@ -209,6 +210,25 @@ for attempt in 1 2 3; do
       sleep 5
       continue
     fi
+  else
+    # Verify checksum of existing wrapper JAR. 
+    # This prevents developers from running into incompatibility issues when 
using an outdated wrapper JAR after a Gradle upgrade.
+    # Use sha256sum or shasum, whichever is available.
+    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
+      # If no checksum tool is found, exit with an error.
+      die "ERROR: Cannot find sha256sum or shasum to verify wrapper JAR. 
Please install one of these tools."

Review Comment:
   Could we just skip the sha check if there is no available tool? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to