Skip to content
Open
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 @@ -54,9 +54,9 @@ public static void main(String[] args) {

public static void checkVersion() {
int major = Runtime.version().feature();
if (major < 21 || major > 23) {
if (major < 21 || major > 25) {
throw new IllegalStateException(
"java version must be between 21 and 23, your version: " + major);
"java version must be between 21 and 25, your version: " + major);
}
}

Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ plugins {
id 'solr.build-infra'

alias(libs.plugins.owasp.dependencycheck)
alias(libs.plugins.cutterslade.analyze)
alias(libs.plugins.benmanes.versions)
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.littlerobots.versioncatalogupdate) apply false
Expand Down Expand Up @@ -173,7 +172,6 @@ apply from: file('gradle/validation/git-status.gradle')
apply from: file('gradle/validation/validate-source-patterns.gradle')
apply from: file('gradle/validation/rat-sources.gradle')
apply from: file('gradle/validation/owasp-dependency-check.gradle')
apply from: file('gradle/validation/dependency-analyze.gradle')
apply from: file('gradle/validation/ecj-lint.gradle')
apply from: file('gradle/validation/gradlew-scripts-tweaked.gradle')
apply from: file('gradle/validation/validate-log-calls.gradle')
Expand Down
8 changes: 8 additions & 0 deletions changelog/unreleased/SOLR-18289-gradle-9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
title: The build now uses Gradle 9.6.0 (upgraded from 8.10).
type: other
authors:
- name: Serhiy Bzhezytskyy
links:
- name: SOLR-18289
url: https://issues.apache.org/jira/browse/SOLR-18289
1 change: 1 addition & 0 deletions gradle.lockfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
# To regenerate this file, run: ./gradlew :dependencies --write-locks
commons-cli:commons-cli:1.5.0=ratDeps
commons-io:commons-io:2.11.0=ratDeps
junit:junit:3.8.1=javacc
Expand Down
10 changes: 8 additions & 2 deletions gradle/documentation/changes-to-html.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
* limitations under the License.
*/

import org.gradle.process.ExecOperations
import javax.inject.Inject

def resources = scriptResources(buildscript)

configure(project(':solr:documentation')) {
Expand All @@ -37,7 +40,10 @@ configure(project(':solr:documentation')) {
}

// compile CHANGELOG.md into an html file
class ChangesToHtmlTask extends DefaultTask {
abstract class ChangesToHtmlTask extends DefaultTask {

@Inject
abstract ExecOperations getExecOperations()

@Internal
Project productProject = project.parent
Expand Down Expand Up @@ -67,7 +73,7 @@ class ChangesToHtmlTask extends DefaultTask {
return
}

def result = project.exec {
def result = execOperations.exec {
executable "python3"
standardOutput project.file("${targetDir.get().getAsFile()}/Changes.html").newOutputStream()
errorOutput = output
Expand Down
4 changes: 2 additions & 2 deletions gradle/documentation/render-javadoc.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ configure(subprojects) {
task
.project
.configurations.implementation.allDependencies.withType(ProjectDependency).collect {dep ->
def otherProject = dep.dependencyProject
def otherProject = task.project.project(dep.path)
return otherProject.tasks.findByName(task.name)
}.findAll {
// Do not depend on disabled tasks or tasks that do not exist
Expand Down Expand Up @@ -294,7 +294,7 @@ class RenderJavadocTask extends DefaultTask {
File taskResources

/** Utility method to recursively collect all tasks with same name like this one that we depend on */
private Set findRenderTasksInDependencies() {
Set findRenderTasksInDependencies() {
Set found = []
def collectDeps
collectDeps = {task ->
Expand Down
9 changes: 7 additions & 2 deletions gradle/generation/javacc.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import java.nio.charset.Charset
import org.gradle.process.ExecOperations
import javax.inject.Inject

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
Expand Down Expand Up @@ -116,7 +118,10 @@ configure(project(":solr:core")) {
}

// We always regenerate, no need to declare outputs.
class JavaCCTask extends DefaultTask {
abstract class JavaCCTask extends DefaultTask {
@Inject
abstract ExecOperations getExecOperations()

@InputFile
File javaccFile

Expand Down Expand Up @@ -164,7 +169,7 @@ class JavaCCTask extends DefaultTask {
logger.lifecycle("Recompiling JavaCC: ${project.rootDir.relativePath(javaccFile)}")

def output = new ByteArrayOutputStream()
def result = project.javaexec {
def result = execOperations.javaexec {
classpath {
project.rootProject.configurations.javacc
}
Expand Down
21 changes: 16 additions & 5 deletions gradle/globals.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
* limitations under the License.
*/

import javax.inject.Inject
import org.gradle.process.ExecOperations

interface ExecOperationsHolder {
@Inject
ExecOperations getExecOperations()
}

allprojects {
apply plugin: 'base'

Expand All @@ -35,10 +43,12 @@ allprojects {

// Artifacts will have names after full gradle project path
// so :solr:core will have solr-core.jar, etc.
project.archivesBaseName = project.path
.replaceAll("^:", "")
.replace(':', '-')
.replace("-modules-", "-")
project.base {
archivesName = project.path
.replaceAll("^:", "")
.replace(':', '-')
.replace("-modules-", "-")
}

project.ext {
// Utility method to support passing overrides via -P or -D.
Expand Down Expand Up @@ -110,7 +120,8 @@ allprojects {
}
}

result = project.exec {ExecSpec execSpec ->
def execOps = project.objects.newInstance(ExecOperationsHolder).execOperations
result = execOps.exec {ExecSpec execSpec ->
project.configure(execSpec, closure)

saveIgnoreExitValue = execSpec.ignoreExitValue
Expand Down
4 changes: 2 additions & 2 deletions gradle/hacks/gradle-archives.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ allprojects {
tasks.withType(AbstractArchiveTask).configureEach {task ->
duplicatesStrategy = DuplicatesStrategy.FAIL
reproducibleFileOrder = true
dirMode = 0755
fileMode = 0644
dirPermissions { unix("0755") }
filePermissions { unix("0644") }
}
}
4 changes: 2 additions & 2 deletions gradle/java/jar-manifest.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ subprojects {
"Specification-Title": title,

// Evaluate these properties lazily so that the defaults are applied properly.
"X-Compile-Source-JDK": "${-> project.sourceCompatibility}",
"X-Compile-Target-JDK": "${-> project.targetCompatibility}",
"X-Compile-Source-JDK": "${-> project.java.sourceCompatibility}",
"X-Compile-Target-JDK": "${-> project.java.targetCompatibility}",

"X-Build-JDK": "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
"X-Build-OS": "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
Expand Down
6 changes: 4 additions & 2 deletions gradle/java/javac.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

allprojects {
plugins.withType(JavaPlugin) {
sourceCompatibility = project.minJavaVersion
targetCompatibility = project.minJavaVersion
java {
sourceCompatibility = project.minJavaVersion
targetCompatibility = project.minJavaVersion
}
// Use 'release' flag instead of 'source' and 'target'
tasks.withType(JavaCompile) {
compileTestJava {
Expand Down
6 changes: 2 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ commons-cli = "1.11.0"
commons-codec = "1.21.0"
commons-io = "2.21.0"
compose = "1.10.3"
cutterslade-analyze = "1.10.0"
cuvs-java = "25.10.0"
cuvs-lucene = "25.10.0"
decompose = "3.4.0"
Expand Down Expand Up @@ -108,7 +107,7 @@ google-javaformat = "1.18.1"
# @keep for version alignment
google-protobuf = "3.25.8"
# @keep Gradle version to run the build
gradle = "8.10"
gradle = "9.6.0"
grpc = "1.80.0"
# @keep Gulp version used in ref-guide
gulp-cli = "3.1.0"
Expand Down Expand Up @@ -165,7 +164,7 @@ mvikotlin = "4.3.0"
navsecurity = "0.5.10"
netty = "4.2.15.Final"
# @keep for version alignment
netty-tcnative = "2.0.75.Final"
netty-tcnative = "2.0.77.Final"
nimbusds-josejwt = "10.5"
nlopez-compose = "0.5.7"
nodegradle-node = "7.1.0"
Expand Down Expand Up @@ -204,7 +203,6 @@ xerial-snappy = "1.1.10.8"
[plugins]
benmanes-versions = { id = "com.github.ben-manes.versions", version.ref = "benmanes-versions" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
cutterslade-analyze = { id = "ca.cutterslade.analyze", version.ref = "cutterslade-analyze" }
diffplug-spotless = { id = "com.diffplug.spotless", version.ref = "diffplug-spotless" }
jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "compose" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/maven/defaults-maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ configure(subprojects.findAll {it.path in rootProject.published}) {prj ->
jars(MavenPublication) {
from components.java
groupId = project.group
artifactId = project.archivesBaseName
artifactId = project.base.archivesName.get()

artifact sourcesJar
artifact javadocJar
Expand Down
2 changes: 1 addition & 1 deletion gradle/solr/packaging.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ configure(allprojects
from({
def externalLibs = configurations.runtimeLibs.copyRecursive {dep ->
if (dep instanceof org.gradle.api.artifacts.ProjectDependency) {
return !dep.dependencyProject.path.startsWith(":solr")
return !dep.path.startsWith(":solr")
} else {
return true
}
Expand Down
10 changes: 8 additions & 2 deletions gradle/validation/check-broken-links.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
* limitations under the License.
*/

import org.gradle.process.ExecOperations
import javax.inject.Inject

configure(rootProject) {
task checkBrokenLinks {
group 'Verification'
Expand All @@ -30,7 +33,10 @@ configure(project(':solr:documentation')) {
}

@CacheableTask
class CheckBrokenLinksTask extends DefaultTask {
abstract class CheckBrokenLinksTask extends DefaultTask {

@Inject
abstract ExecOperations getExecOperations()

// wraps input directory location in DirectoryProperty so as to lazily evaluate 'docroot' property
// (see gradle/documentation/documentation.gradle)
Expand All @@ -51,7 +57,7 @@ class CheckBrokenLinksTask extends DefaultTask {
def check() {
def result
outputFile.get().asFile.withOutputStream {output ->
result = project.exec {
result = execOperations.exec {
executable project.externalTool("python3")
ignoreExitValue = true
standardOutput = output
Expand Down
37 changes: 0 additions & 37 deletions gradle/validation/dependency-analyze.gradle

This file was deleted.

1 change: 0 additions & 1 deletion gradle/validation/jar-checks.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ subprojects {
if (excludeRules && excludeRules.size() > 0) {
conf = conf.copyRecursive()
conf.canBeResolved = true
conf.canBeConsumed = true
excludeRuleMaps.forEach {conf.exclude(it)}
}
if (conf.canBeResolved) {
Expand Down
2 changes: 1 addition & 1 deletion gradle/validation/owasp-dependency-check.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ configure(rootProject) {
failBuildOnCVSS = propertyOrDefault("validation.owasp.threshold", 7) as Integer
formats = ['ALL']
skipProjects = [':solr:solr-ref-guide', ':missing-doclet']
skipConfigurations = ['unifiedClasspath', 'permitUnusedDeclared']
skipConfigurations = ['unifiedClasspath']
suppressionFile = file("${resources}/exclusions.xml")
analyzers {
assemblyEnabled = false
Expand Down
8 changes: 6 additions & 2 deletions gradle/validation/rat-sources.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ allprojects {
group = 'Verification'
description = 'Runs Apache Rat checks.'

ratClasspath.from(rootProject.configurations.ratDeps)

def defaultScanFileTree = project.fileTree(projectDir, {
// Only check files tracked by git — skip untracked/gitignored files
// (IDE artifacts, AI assistant configs, etc.)
Expand Down Expand Up @@ -260,10 +262,12 @@ class RatTask extends DefaultTask {
final RegularFileProperty xmlReport = project.objects.fileProperty().convention(
project.layout.buildDirectory.file("rat/rat-report.xml"))

@InputFiles
final ConfigurableFileCollection ratClasspath = project.objects.fileCollection()

def generateReport(File reportFile) {
// Set up ant rat task.
def ratClasspath = project.rootProject.configurations.ratDeps.asPath
ant.taskdef(resource: 'org/apache/rat/anttasks/antlib.xml', classpath: ratClasspath)
ant.taskdef(resource: 'org/apache/rat/anttasks/antlib.xml', classpath: ratClasspath.asPath)

// Collect all output files for debugging.
String inputFileList = inputFileTrees.get().collectMany {fileTree ->
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
1 change: 1 addition & 0 deletions platform/gradle.lockfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
# To regenerate this file, run: ./gradlew :platform:dependencies --write-locks
empty=classpath,jarValidation
1 change: 1 addition & 0 deletions settings-gradle.lockfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
# To regenerate this file, run: ./gradlew dependencies --write-locks
empty=incomingCatalogForLibs0
Loading