From a5906daf909108733f28f312f7405b30fde0eef6 Mon Sep 17 00:00:00 2001 From: Houston Putman Date: Tue, 5 Nov 2024 12:30:10 -0600 Subject: [PATCH 1/3] Upgrade to gradle 8.10 --- gradle/documentation/render-javadoc.gradle | 2 +- gradle/globals.gradle | 2 +- gradle/node.gradle | 2 +- gradle/solr/packaging.gradle | 2 +- gradle/testing/alternative-jdk-support.gradle | 2 +- gradle/testing/beasting.gradle | 2 +- gradle/testing/profiling.gradle | 2 +- gradle/testing/randomization.gradle | 8 +++---- gradle/testing/slowest-tests-at-end.gradle | 2 +- gradle/validation/check-environment.gradle | 2 +- gradle/validation/jar-checks.gradle | 22 ++++++++++++++----- gradle/validation/spotless.gradle | 2 +- gradle/wrapper/gradle-wrapper.jar.sha256 | 2 +- gradle/wrapper/gradle-wrapper.jar.version | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 2 +- 16 files changed, 34 insertions(+), 24 deletions(-) diff --git a/gradle/documentation/render-javadoc.gradle b/gradle/documentation/render-javadoc.gradle index bd90ad35426..6c637e540df 100644 --- a/gradle/documentation/render-javadoc.gradle +++ b/gradle/documentation/render-javadoc.gradle @@ -32,7 +32,7 @@ allprojects { missingdoclet "org.apache.solr.tools:missing-doclet" } - ext { + project.ext { relativeDocPath = project.path.replaceFirst(/:\w+:/, "").replace(':', '/') } diff --git a/gradle/globals.gradle b/gradle/globals.gradle index 4f782ae38c5..d8a99de69c2 100644 --- a/gradle/globals.gradle +++ b/gradle/globals.gradle @@ -37,7 +37,7 @@ allprojects { // so :solr:core will have solr-core.jar, etc. project.archivesBaseName = project.path.replaceAll("^:", "").replace(':', '-') - ext { + project.ext { // Utility method to support passing overrides via -P or -D. propertyOrDefault = { propName, defValue -> def result diff --git a/gradle/node.gradle b/gradle/node.gradle index 3da3a51d40e..ff8404c2db2 100644 --- a/gradle/node.gradle +++ b/gradle/node.gradle @@ -34,7 +34,7 @@ configure([project(":solr:packaging"), project(":solr:solr-ref-guide"), project( } } - ext { + project.ext { rootNodeDir = "$rootDir/.gradle/node" nodeProjectDir = file("$rootNodeDir/$project.name") } diff --git a/gradle/solr/packaging.gradle b/gradle/solr/packaging.gradle index 11ffb560688..1b5325f908b 100644 --- a/gradle/solr/packaging.gradle +++ b/gradle/solr/packaging.gradle @@ -38,7 +38,7 @@ configure(allprojects.findAll {project -> project.path.startsWith(":solr:modules:") || project.path == ":solr:prometheus-exporter" || project.path == ":solr:cross-dc-manager" }) { plugins.withType(JavaPlugin) { - ext { + project.ext { packagingDir = file("${buildDir}/packaging") if (project.path.startsWith(":solr:prometheus-exporter") || project.path.startsWith(":solr:cross-dc-manager")) { deps = packagingDir diff --git a/gradle/testing/alternative-jdk-support.gradle b/gradle/testing/alternative-jdk-support.gradle index 72cdabdab4b..a1ff1b4b014 100644 --- a/gradle/testing/alternative-jdk-support.gradle +++ b/gradle/testing/alternative-jdk-support.gradle @@ -87,6 +87,6 @@ if (jvmGradle != jvmCurrent) { // Set up root project's properties. rootProject.ext.runtimeJavaHome = jvmCurrent.javaHome -rootProject.ext.runtimeJavaVersion = jvmDetector.getMetadata(new InstallationLocation(jvmCurrent.javaHome, "specific path")).getLanguageVersion() +rootProject.ext.runtimeJavaVersion = jvmDetector.getMetadata(InstallationLocation.userDefined(jvmCurrent.javaHome, "specific path")).getLanguageVersion() rootProject.ext.usesAltJvm = (jvmGradle != jvmCurrent); diff --git a/gradle/testing/beasting.gradle b/gradle/testing/beasting.gradle index 8934100ec10..67c20140ba8 100644 --- a/gradle/testing/beasting.gradle +++ b/gradle/testing/beasting.gradle @@ -27,7 +27,7 @@ def beastingMode = gradle.startParameter.taskNames.any{ name -> name == 'beast' allprojects { plugins.withType(JavaPlugin) { - ext { + project.ext { testOptions += [ [propName: 'tests.dups', value: 0, description: "Reiterate runs of entire test suites ('beast' task)."] ] diff --git a/gradle/testing/profiling.gradle b/gradle/testing/profiling.gradle index ce9e7d43e03..8b1e5147efc 100644 --- a/gradle/testing/profiling.gradle +++ b/gradle/testing/profiling.gradle @@ -19,7 +19,7 @@ def recordings = files() allprojects { plugins.withType(JavaPlugin) { - ext { + project.ext { testOptions += [ [propName: 'tests.profile', value: false, description: "Enable java flight recorder profiling."] ] diff --git a/gradle/testing/randomization.gradle b/gradle/testing/randomization.gradle index 2b617b99aa8..183943a39e7 100644 --- a/gradle/testing/randomization.gradle +++ b/gradle/testing/randomization.gradle @@ -79,7 +79,7 @@ allprojects { // Configure test property defaults and their descriptions. allprojects { plugins.withType(JavaPlugin) { - ext { + project.ext { testOptions += [ // seed, repetition and amplification. [propName: 'tests.seed', value: { -> rootSeed }, description: "Sets the master randomization seed."], @@ -124,7 +124,7 @@ allprojects { // Add Solr-specific test configs settings. configure(allprojects.findAll {project -> project.path.startsWith(":solr") }) { plugins.withType(JavaPlugin) { - ext { + project.ext { testOptions += [ [propName: 'tests.src.home', value: null, description: "See SOLR-14023."], [propName: 'solr.tests.use.numeric.points', value: null, description: "Point implementation to use (true=numerics, false=trie)."], @@ -137,14 +137,14 @@ configure(allprojects.findAll {project -> project.path.startsWith(":solr") }) { allprojects { plugins.withType(JavaPlugin) { afterEvaluate { - ext.testOptionsResolved = testOptions.findAll { opt -> + project.ext.testOptionsResolved = testOptions.findAll { opt -> propertyOrDefault(opt.propName, opt.value) != null }.collectEntries { opt -> [(opt.propName): Objects.toString(resolvedTestOption(opt.propName))] } // Compute the "reproduce with" string. - ext.testOptionsForReproduceLine = testOptions.findAll { opt -> + project.ext.testOptionsForReproduceLine = testOptions.findAll { opt -> if (opt["includeInReproLine"] == false) { return false } diff --git a/gradle/testing/slowest-tests-at-end.gradle b/gradle/testing/slowest-tests-at-end.gradle index eaf9cd1a2f1..d24e523394d 100644 --- a/gradle/testing/slowest-tests-at-end.gradle +++ b/gradle/testing/slowest-tests-at-end.gradle @@ -22,7 +22,7 @@ def allSuites = [] allprojects { plugins.withType(JavaPlugin) { - ext { + project.ext { testOptions += [ [propName: 'tests.slowestTests', value: true, description: "Print the summary of the slowest tests."], [propName: 'tests.slowestSuites', value: true, description: "Print the summary of the slowest suites."] diff --git a/gradle/validation/check-environment.gradle b/gradle/validation/check-environment.gradle index 6fcaf761a19..6e5c01ef19c 100644 --- a/gradle/validation/check-environment.gradle +++ b/gradle/validation/check-environment.gradle @@ -22,7 +22,7 @@ import org.gradle.util.GradleVersion configure(rootProject) { ext { - expectedGradleVersion = '8.4' + expectedGradleVersion = '8.10' } wrapper { diff --git a/gradle/validation/jar-checks.gradle b/gradle/validation/jar-checks.gradle index 6c87c50f023..7547214299d 100644 --- a/gradle/validation/jar-checks.gradle +++ b/gradle/validation/jar-checks.gradle @@ -1,3 +1,5 @@ +import java.util.stream.Collectors + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -74,14 +76,14 @@ subprojects { // Configure jarValidation configuration for all projects. Any dependency // declared on this configuration (or any configuration it extends from) will // be verified. - configurations { + project.configurations { jarValidation } // For Java projects, add all dependencies from the following configurations // to jar validation plugins.withType(JavaPlugin) { - configurations { + project.configurations { jarValidation { extendsFrom runtimeClasspath extendsFrom compileClasspath @@ -107,16 +109,24 @@ subprojects { } def excludeRules = configurations.jarValidation.excludeRules + List> excludeRuleMaps; + if (excludeRules && excludeRules.size() > 0) { + excludeRuleMaps = excludeRules.stream().map {rule -> + if (rule.module != null) { + Map.of("group", rule.group, "module", rule.module) + } else { + Map.of("group", rule.group) + } + }.collect(Collectors.toList()) + } ArrayDeque queue = new ArrayDeque<>() configurations.jarValidation.extendsFrom.each { conf -> - if (excludeRules) { + if (excludeRules && excludeRules.size() > 0) { conf = conf.copyRecursive() conf.canBeResolved = true conf.canBeConsumed = true - def newConfExcludeRules = new HashSet<>(conf.excludeRules) - newConfExcludeRules.addAll(excludeRules) - conf.excludeRules = newConfExcludeRules + excludeRuleMaps.forEach {conf.exclude(it)} } if (conf.canBeResolved) { queue.addAll(conf.resolvedConfiguration.firstLevelModuleDependencies) diff --git a/gradle/validation/spotless.gradle b/gradle/validation/spotless.gradle index 76fecdfad98..d4444a87671 100644 --- a/gradle/validation/spotless.gradle +++ b/gradle/validation/spotless.gradle @@ -24,7 +24,7 @@ configure(allprojects) { prj -> plugins.withType(JavaPlugin) { prj.apply plugin: 'com.diffplug.spotless' - ext { + project.ext { spotlessJavaSetup = (Action){ it.toggleOffOn() // obviously, only to be used sparingly. // TODO: Work out how to support multiple different header files (we have diff --git a/gradle/wrapper/gradle-wrapper.jar.sha256 b/gradle/wrapper/gradle-wrapper.jar.sha256 index f78f56fee75..67dead8f441 100644 --- a/gradle/wrapper/gradle-wrapper.jar.sha256 +++ b/gradle/wrapper/gradle-wrapper.jar.sha256 @@ -1 +1 @@ -0336f591bc0ec9aa0c9988929b93ecc916b3c1d52aed202c7381db144aa0ef15 +2db75c40782f5e8ba1fc278a5574bab070adccb2d21ca5a6e5ed840888448046 diff --git a/gradle/wrapper/gradle-wrapper.jar.version b/gradle/wrapper/gradle-wrapper.jar.version index a2f28f43be3..e1f080d7106 100644 --- a/gradle/wrapper/gradle-wrapper.jar.version +++ b/gradle/wrapper/gradle-wrapper.jar.version @@ -1 +1 @@ -8.4.0 +8.10.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 744c64d1277..707e499ac56 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index a9dd4a99ba1..7035b75bfdf 100644 --- a/settings.gradle +++ b/settings.gradle @@ -25,7 +25,7 @@ pluginManagement { } plugins { - id 'com.gradle.develocity' version '3.17.6' + id 'com.gradle.develocity' version '3.18.1' id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.0.2' } From 745ac9213187531a8433bfa9f0ab4d8c749a55cf Mon Sep 17 00:00:00 2001 From: Houston Putman Date: Tue, 5 Nov 2024 12:58:18 -0600 Subject: [PATCH 2/3] Upgrade the wrapper itself, keeping all the custom stuff --- gradle/wrapper/gradle-wrapper.jar.version | 2 +- gradle/wrapper/gradle-wrapper.properties | 1 + gradlew | 9 ++++++--- gradlew.bat | 24 ++++++++++++----------- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.jar.version b/gradle/wrapper/gradle-wrapper.jar.version index e1f080d7106..dd78a707858 100644 --- a/gradle/wrapper/gradle-wrapper.jar.version +++ b/gradle/wrapper/gradle-wrapper.jar.version @@ -1 +1 @@ -8.10.0 \ No newline at end of file +8.10.2 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 707e499ac56..9355b415575 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,5 +2,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 0aa671a76c2..c8ad2977471 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -161,7 +164,7 @@ if [ ! -e "$GRADLE_WRAPPER_JAR" ]; then "$JAVACMD" $JAVA_OPTS "$APP_HOME/build-tools/build-infra/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." + echo "ERROR: Something went wrong. Make sure you're using Java version between 21 and 23." exit $WRAPPER_STATUS elif [ "$WRAPPER_STATUS" -ne 0 ]; then exit $WRAPPER_STATUS diff --git a/gradlew.bat b/gradlew.bat index 938e3ce94ee..ff65d8f6012 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -48,11 +50,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -62,11 +64,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -108,7 +110,7 @@ goto fail :failWithJvmMessage @rem https://github.com/apache/lucene/pull/819 -echo Error: Something went wrong. Make sure you're using Java version between 11 and 21. +echo Error: Something went wrong. Make sure you're using Java version between 21 and 23. :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of From 13238ec24528a752267081ba25ee177cc263252f Mon Sep 17 00:00:00 2001 From: Houston Putman Date: Tue, 5 Nov 2024 13:43:22 -0600 Subject: [PATCH 3/3] Fix wrapper downloader --- .../main/java/org/apache/lucene/gradle/WrapperDownloader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java index f7e07eb164a..88d91028552 100644 --- a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java +++ b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java @@ -55,9 +55,9 @@ public static void main(String[] args) { public static void checkVersion() { int major = Runtime.getRuntime().version().feature(); - if (major < 11 || major > 21) { + if (major < 21 || major > 23) { throw new IllegalStateException( - "java version must be between 11 and 21, your version: " + major); + "java version must be between 21 and 23, your version: " + major); } }