Upgrade gradle to 7.6 (backport) (#11994)

This commit is contained in:
Dawid Weiss 2022-12-02 09:18:46 +01:00 committed by GitHub
parent 4eddd29bd9
commit 0fc1d9df63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 12 deletions

View File

@ -54,7 +54,14 @@ public class WrapperDownloader {
new WrapperDownloader().run(Paths.get(args[0]));
} catch (Exception e) {
System.err.println("ERROR: " + e.getMessage());
System.exit(1);
System.exit(3);
}
}
public static void checkVersion() {
int major = Runtime.getRuntime().version().feature();
if (major < 11 || major > 19) {
throw new IllegalStateException("java version must be between 11 and 19, your version: " + major);
}
}

View File

@ -3,6 +3,7 @@ import org.gradle.internal.jvm.JavaInfo
import org.gradle.internal.jvm.Jvm
import org.gradle.internal.jvm.inspection.JvmInstallationMetadata
import org.gradle.internal.jvm.inspection.JvmMetadataDetector
import org.gradle.jvm.toolchain.internal.InstallationLocation
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -49,7 +50,7 @@ if (jvmGradle != jvmCurrent) {
doFirst {
def jvmInfo = { JavaInfo javaInfo ->
JvmInstallationMetadata jvmMetadata = jvmDetector.getMetadata(javaInfo.javaHome)
JvmInstallationMetadata jvmMetadata = jvmDetector.getMetadata(new InstallationLocation(javaInfo.javaHome, "specific path"))
return "${jvmMetadata.languageVersion} (${jvmMetadata.displayName} ${jvmMetadata.runtimeVersion}, home at: ${jvmMetadata.javaHome})"
}
@ -87,6 +88,6 @@ if (jvmGradle != jvmCurrent) {
// Set up root project's properties.
rootProject.ext.runtimeJavaExecutable = jvmCurrent.javaExecutable
rootProject.ext.runtimeJavaHome = jvmCurrent.javaHome
rootProject.ext.runtimeJavaVersion = jvmDetector.getMetadata(jvmCurrent.javaHome).languageVersion
rootProject.ext.runtimeJavaVersion = jvmDetector.getMetadata(new InstallationLocation(jvmCurrent.javaHome, "specific path")).getLanguageVersion()
rootProject.ext.usesAltJvm = (jvmGradle != jvmCurrent);

View File

@ -22,7 +22,7 @@ import org.gradle.util.GradleVersion
configure(rootProject) {
ext {
expectedGradleVersion = '7.5.1'
expectedGradleVersion = '7.6'
}
wrapper {

View File

@ -1 +1 @@
91a239400bb638f36a1795d8fdf7939d532cdc7d794d1119b7261aac158b1e60
c5a643cf80162e665cc228f7b16f343fef868e47d3a4836f62e18b7e17ac018a

View File

@ -1 +1 @@
7.5.1
7.6.0

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

10
gradlew vendored
View File

@ -121,9 +121,13 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
fi
GRADLE_WRAPPER_JAR="$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
if ! "$JAVACMD" $JAVA_OPTS --source 11 "$APP_HOME/buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java" "$GRADLE_WRAPPER_JAR" ; then
echo "\nSomething went wrong. Make sure you're using Java 11 or later."
exit $?
"$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 11 or later."
exit $WRAPPER_STATUS
elif [ "$WRAPPER_STATUS" -ne 0 ]; then
exit $WRAPPER_STATUS
fi
CLASSPATH=$GRADLE_WRAPPER_JAR

10
gradlew.bat vendored
View File

@ -77,6 +77,7 @@ 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
@rem Setup the command line
@ -94,12 +95,17 @@ SET GIT_CONFIG_NOSYSTEM=1
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% EQU 0 goto mainEnd
goto fail
:failWithJvmMessage
@rem https://github.com/apache/lucene/pull/819
echo Error: Something went wrong. Make sure you're using Java 11 or later.
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd