You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2024/05/23 01:15:58 UTC
(solr) branch branch_9x updated: Build: gradlew avoid downloader (#2419)
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 5687b6cd30f Build: gradlew avoid downloader (#2419)
5687b6cd30f is described below
commit 5687b6cd30fc49245367253f4ca0626ed2470ab0
Author: David Smiley <ds...@salesforce.com>
AuthorDate: Wed May 22 21:13:02 2024 -0400
Build: gradlew avoid downloader (#2419)
* avoid WrapperDownloader if have the JAR
* don't specify --source
More specific than needed, and some JDK/configs may complain about an incompatibility with --release.
(cherry picked from commit fd3f7d2bacd558bd8bb6a9db9343d6445e368425)
---
gradlew | 18 ++++++++++--------
gradlew.bat | 10 ++++++----
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/gradlew b/gradlew
index 308a3239001..c0f76e91038 100755
--- a/gradlew
+++ b/gradlew
@@ -157,13 +157,15 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
fi
GRADLE_WRAPPER_JAR="$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
-"$JAVACMD" $JAVA_OPTS --source 11 "$APP_HOME/buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java" "$GRADLE_WRAPPER_JAR"
-WRAPPER_STATUS=$?
-if [ "$WRAPPER_STATUS" -eq 1 ]; then
- echo "ERROR: Something went wrong. Make sure you're using Java version between 11 and 21."
- exit $WRAPPER_STATUS
-elif [ "$WRAPPER_STATUS" -ne 0 ]; then
- exit $WRAPPER_STATUS
+if [ ! -e "$GRADLE_WRAPPER_JAR" ]; then
+ "$JAVACMD" $JAVA_OPTS "$APP_HOME/buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java" "$GRADLE_WRAPPER_JAR"
+ WRAPPER_STATUS=$?
+ if [ "$WRAPPER_STATUS" -eq 1 ]; then
+ echo "ERROR: Something went wrong. Make sure you're using Java version between 11 and 21."
+ exit $WRAPPER_STATUS
+ elif [ "$WRAPPER_STATUS" -ne 0 ]; then
+ exit $WRAPPER_STATUS
+ fi
fi
CLASSPATH=$GRADLE_WRAPPER_JAR
@@ -171,7 +173,7 @@ CLASSPATH=$GRADLE_WRAPPER_JAR
# START OF LUCENE CUSTOMIZATION
# Generate gradle.properties if they don't exist
if [ ! -e "$APP_HOME/gradle.properties" ]; then
- "$JAVACMD" $JAVA_OPTS --source 11 "$APP_HOME/buildSrc/src/main/java/org/apache/lucene/gradle/GradlePropertiesGenerator.java" "$APP_HOME/gradle/template.gradle.properties" "$APP_HOME/gradle.properties"
+ "$JAVACMD" $JAVA_OPTS "$APP_HOME/buildSrc/src/main/java/org/apache/lucene/gradle/GradlePropertiesGenerator.java" "$APP_HOME/gradle/template.gradle.properties" "$APP_HOME/gradle.properties"
GENERATOR_STATUS=$?
if [ "$GENERATOR_STATUS" -ne 0 ]; then
exit $GENERATOR_STATUS
diff --git a/gradlew.bat b/gradlew.bat
index cb69a0ab1a7..172618e3ea4 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -75,9 +75,11 @@ goto fail
@rem LUCENE-9266: verify and download the gradle wrapper jar if we don't have one.
set GRADLE_WRAPPER_JAR=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-"%JAVA_EXE%" %JAVA_OPTS% --source 11 "%APP_HOME%/buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java" "%GRADLE_WRAPPER_JAR%"
-IF %ERRORLEVEL% EQU 1 goto failWithJvmMessage
-IF %ERRORLEVEL% NEQ 0 goto fail
+IF NOT EXIST "%GRADLE_WRAPPER_JAR%" (
+ "%JAVA_EXE%" %JAVA_OPTS% "%APP_HOME%/buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java" "%GRADLE_WRAPPER_JAR%"
+ IF %ERRORLEVEL% EQU 1 goto failWithJvmMessage
+ IF %ERRORLEVEL% NEQ 0 goto fail
+)
@rem Setup the command line
set CLASSPATH=%GRADLE_WRAPPER_JAR%
@@ -87,7 +89,7 @@ set CLASSPATH=%GRADLE_WRAPPER_JAR%
IF NOT EXIST "%APP_HOME%\gradle.properties" (
@rem local expansion is needed to check ERRORLEVEL inside control blocks.
setlocal enableDelayedExpansion
- "%JAVA_EXE%" %JAVA_OPTS% --source 11 "%APP_HOME%/buildSrc/src/main/java/org/apache/lucene/gradle/GradlePropertiesGenerator.java" "%APP_HOME%\gradle\template.gradle.properties" "%APP_HOME%\gradle.properties"
+ "%JAVA_EXE%" %JAVA_OPTS% "%APP_HOME%/buildSrc/src/main/java/org/apache/lucene/gradle/GradlePropertiesGenerator.java" "%APP_HOME%\gradle\template.gradle.properties" "%APP_HOME%\gradle.properties"
IF %ERRORLEVEL% NEQ 0 goto fail
endlocal
)