mirror of https://github.com/apache/kafka.git
KAFKA-19174 Gradle version upgrade 8 -->> 9 (#19513)
List of changes: - prerequisite Jira ticket: - [KAFKA-19591](https://issues.apache.org/jira/browse/KAFKA-19591) - mandatory version upgrades: - Gradle version: 8.14.3 -->> 9.1.0 - Gradle Shadow plugin: 8.3.6 -->> 8.3.9 - Gradle dependencycheck plugin: 8.2.1 -->> 12.1.3 - Gradle spotbugs plugin: 6.2.3 -->> 6.2.5 - Gradle spotless plugin: 6.25.0 -->> 7.2.1 - build logic will be refactored to accommodate Gradle 9 breaking changes - (optional): a dozen of Gradle plugins versions will also be upgraded - other JIRA tickets that had to be solved all along: - [KAFKA-16801](https://issues.apache.org/jira/browse/KAFKA-16801) - [KAFKA-19654](https://issues.apache.org/jira/browse/KAFKA-19654) **Related links:** - https://gradle.org/whats-new/gradle-9 - https://github.com/gradle/gradle/releases/tag/v9.0.0 - https://docs.gradle.org/9.0.0/release-notes.html - https://docs.gradle.org/9.0.0/userguide/upgrading_major_version_9.html - https://docs.gradle.org/9.1.0/release-notes.html Notes: - new Gradle version brings up some breaking changes, as always 😃 - Kafka build with Gradle 9 has same issues as other projects: - https://github.com/redhat-developer/vscode-java/issues/4018 - https://github.com/gradle/gradle/pull/32597 Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
parent
f5a87b3703
commit
c6bbbbe24d
|
@ -42,7 +42,7 @@ runs:
|
|||
distribution: temurin
|
||||
java-version: ${{ inputs.java-version }}
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0
|
||||
uses: gradle/actions/setup-gradle@748248ddd2a24f49513d8f472f81c3a07d4d50e1 # v4.4.4
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
with:
|
||||
|
|
23
build.gradle
23
build.gradle
|
@ -29,22 +29,21 @@ buildscript {
|
|||
}
|
||||
|
||||
plugins {
|
||||
id 'com.github.ben-manes.versions' version '0.48.0'
|
||||
id 'com.github.ben-manes.versions' version '0.52.0'
|
||||
id 'idea'
|
||||
id 'jacoco'
|
||||
id 'java-library'
|
||||
id 'org.owasp.dependencycheck' version '8.2.1'
|
||||
id 'org.owasp.dependencycheck' version '12.1.3'
|
||||
id 'org.nosphere.apache.rat' version "0.8.1"
|
||||
id "io.swagger.core.v3.swagger-gradle-plugin" version "${swaggerVersion}"
|
||||
|
||||
id "com.github.spotbugs" version '6.2.3' apply false
|
||||
id "com.github.spotbugs" version '6.2.5' apply false
|
||||
id 'org.scoverage' version '8.0.3' apply false
|
||||
id 'com.gradleup.shadow' version '8.3.6' apply false
|
||||
id 'com.diffplug.spotless' version "6.25.0"
|
||||
id 'com.gradleup.shadow' version '8.3.9' apply false
|
||||
id 'com.diffplug.spotless' version "7.2.1"
|
||||
}
|
||||
|
||||
ext {
|
||||
gradleVersion = versions.gradle
|
||||
minClientJavaVersion = 11
|
||||
minNonClientJavaVersion = 17
|
||||
modulesNeedingJava11 = [":clients", ":generator", ":streams", ":streams:test-utils", ":streams:examples", ":streams-scala", ":test-common:test-common-util"]
|
||||
|
@ -297,7 +296,7 @@ if (repo != null) {
|
|||
} else {
|
||||
rat.enabled = false
|
||||
}
|
||||
println("Starting build with version $version (commit id ${commitId == null ? "null" : commitId.take(8)}) using Gradle $gradleVersion, Java ${JavaVersion.current()} and Scala ${versions.scala}")
|
||||
println("Starting build with version $version (commit id ${commitId == null ? "null" : commitId.take(8)}) using Gradle $versions.gradle, Java ${JavaVersion.current()} and Scala ${versions.scala}")
|
||||
println("Build properties: ignoreFailures=$userIgnoreFailures, maxParallelForks=$maxTestForks, maxScalacThreads=$maxScalacThreads, maxTestRetries=$userMaxTestRetries")
|
||||
|
||||
subprojects {
|
||||
|
@ -328,6 +327,16 @@ subprojects {
|
|||
tasks.register('uploadArchives').configure { dependsOn(publish) }
|
||||
}
|
||||
|
||||
tasks.withType(AbstractArchiveTask).configureEach {
|
||||
reproducibleFileOrder = false
|
||||
preserveFileTimestamps = true
|
||||
useFileSystemPermissions()
|
||||
}
|
||||
|
||||
tasks.withType(AbstractTestTask).configureEach {
|
||||
failOnNoDiscoveredTests = false
|
||||
}
|
||||
|
||||
// apply the eclipse plugin only to subprojects that hold code. 'connect' is just a folder.
|
||||
if (!project.name.equals('connect')) {
|
||||
apply plugin: 'eclipse'
|
||||
|
|
|
@ -60,7 +60,7 @@ versions += [
|
|||
commonsLang: "3.18.0",
|
||||
commonsValidator: "1.10.0",
|
||||
classgraph: "4.8.179",
|
||||
gradle: "8.14.3",
|
||||
gradle: "9.1.0",
|
||||
grgit: "4.1.1",
|
||||
httpclient: "4.5.14",
|
||||
jackson: "2.19.0",
|
||||
|
@ -125,7 +125,7 @@ versions += [
|
|||
snappy: "1.1.10.7",
|
||||
spotbugs: "4.9.4",
|
||||
mockOAuth2Server: "2.2.1",
|
||||
zinc: "1.9.2",
|
||||
zinc: "1.10.8",
|
||||
// When updating the zstd version, please do as well in docker/native/native-image-configs/resource-config.json
|
||||
// Also make sure the compression levels in org.apache.kafka.common.record.CompressionType are still valid
|
||||
zstd: "1.5.6-10",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
distributionSha256Sum=a17ddd85a26b6a7f5ddb71ff8b05fc5104c0202c6e64782429790c933686c806
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -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,7 @@ 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\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
@ -113,20 +115,6 @@ case "$( uname )" in #(
|
|||
esac
|
||||
|
||||
|
||||
# Loop in case we encounter an error.
|
||||
for attempt in 1 2 3; do
|
||||
if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
|
||||
if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v8.14.3/gradle/wrapper/gradle-wrapper.jar"; then
|
||||
rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
|
||||
# Pause for a bit before looping in case the server throttled us.
|
||||
sleep 5
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
|
@ -183,7 +171,6 @@ fi
|
|||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
|
@ -212,19 +199,31 @@ if "$cygwin" || "$msys" ; then
|
|||
fi
|
||||
|
||||
|
||||
|
||||
# Loop in case we encounter an error.
|
||||
for attempt in 1 2 3; do
|
||||
if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
|
||||
if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v9.1.0/gradle/wrapper/gradle-wrapper.jar"; then
|
||||
rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
|
||||
# Pause for a bit before looping in case the server throttled us.
|
||||
sleep 5
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
// and not the version installed on the machine running the task.
|
||||
// Read more about the wrapper here: https://docs.gradle.org/current/userguide/gradle_wrapper.html
|
||||
wrapper {
|
||||
gradleVersion = project.gradleVersion
|
||||
gradleVersion = versions.gradle
|
||||
}
|
||||
|
||||
// Custom task to inject support for downloading the gradle wrapper jar if it doesn't exist.
|
||||
|
@ -35,14 +35,12 @@ task bootstrapWrapper() {
|
|||
def wrapperBasePath = "\$APP_HOME/gradle/wrapper"
|
||||
def wrapperJarPath = wrapperBasePath + "/gradle-wrapper.jar"
|
||||
|
||||
// Add a trailing zero to the version if needed.
|
||||
def fullVersion = project.gradleVersion.count(".") == 1 ? "${project.gradleVersion}.0" : versions.gradle
|
||||
// Leverages the wrapper jar checked into the gradle project on github because the jar isn't
|
||||
// available elsewhere. Using raw.githubusercontent.com instead of github.com because
|
||||
// github.com servers deprecated TLSv1/TLSv1.1 support some time ago, so older versions
|
||||
// of curl (built against OpenSSL library that doesn't support TLSv1.2) would fail to
|
||||
// fetch the jar.
|
||||
def wrapperBaseUrl = "https://raw.githubusercontent.com/gradle/gradle/v$fullVersion/gradle/wrapper"
|
||||
def wrapperBaseUrl = "https://raw.githubusercontent.com/gradle/gradle/v$versions.gradle/gradle/wrapper"
|
||||
def wrapperJarUrl = wrapperBaseUrl + "/gradle-wrapper.jar"
|
||||
|
||||
def bootstrapString = """
|
||||
|
@ -59,13 +57,15 @@ task bootstrapWrapper() {
|
|||
done
|
||||
""".stripIndent()
|
||||
|
||||
String putBootstrapStringAbove = "# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script."
|
||||
|
||||
def wrapperScript = wrapper.scriptFile
|
||||
def wrapperLines = wrapperScript.readLines()
|
||||
wrapperScript.withPrintWriter { out ->
|
||||
def bootstrapWritten = false
|
||||
wrapperLines.each { line ->
|
||||
// Print the wrapper bootstrap before the first usage of the wrapper jar.
|
||||
if (!bootstrapWritten && line.contains("gradle-wrapper.jar")) {
|
||||
if (!bootstrapWritten && line.contains(putBootstrapStringAbove)) {
|
||||
out.println(bootstrapString)
|
||||
bootstrapWritten = true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue