Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-17545: Upgrade to Gradle 8.10 #2848

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/documentation/render-javadoc.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ allprojects {
missingdoclet "org.apache.solr.tools:missing-doclet"
}

ext {
project.ext {
relativeDocPath = project.path.replaceFirst(/:\w+:/, "").replace(':', '/')
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/globals.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle/node.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/solr/packaging.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle/testing/alternative-jdk-support.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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);

2 changes: 1 addition & 1 deletion gradle/testing/beasting.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)."]
]
Expand Down
2 changes: 1 addition & 1 deletion gradle/testing/profiling.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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."]
]
Expand Down
8 changes: 4 additions & 4 deletions gradle/testing/randomization.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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."],
Expand Down Expand Up @@ -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)."],
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/testing/slowest-tests-at-end.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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."]
Expand Down
2 changes: 1 addition & 1 deletion gradle/validation/check-environment.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.gradle.util.GradleVersion

configure(rootProject) {
ext {
expectedGradleVersion = '8.4'
expectedGradleVersion = '8.10'
}

wrapper {
Expand Down
22 changes: 16 additions & 6 deletions gradle/validation/jar-checks.gradle
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -107,16 +109,24 @@ subprojects {
}

def excludeRules = configurations.jarValidation.excludeRules
List<Map<String, String>> 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<ResolvedDependency> 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)
Expand Down
2 changes: 1 addition & 1 deletion gradle/validation/spotless.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.jar.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0336f591bc0ec9aa0c9988929b93ecc916b3c1d52aed202c7381db144aa0ef15
2db75c40782f5e8ba1fc278a5574bab070adccb2d21ca5a6e5ed840888448046
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.jar.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.4.0
8.10.2
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
9 changes: 6 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -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/.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
24 changes: 13 additions & 11 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##########################################################################
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down
Loading