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

KAFKA-10787: Update spotless version and remove support JDK8 #16176

Merged
merged 18 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ The checkstyle warnings will be found in `reports/checkstyle/reports/main.html`
subproject build directories. They are also printed to the console. The build will fail if Checkstyle fails.

#### Spotless ####
The import order is a part of static check. please call `spotlessApply` to optimize the imports of Java codes before filing pull request :
The import order is a part of static check. please call `spotlessApply` (require JDK 11+) to optimize the imports of Java codes before filing pull request :

./gradlew spotlessApply

Expand Down Expand Up @@ -311,3 +311,5 @@ Apache Kafka is interested in building the community; we would welcome any thoug

To contribute follow the instructions here:
* https://kafka.apache.org/contributing.html

Make sure you pass it before you submit. checkstyle and spotless (require JDK 11+)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we don't need this one. There are Checkstyle and Spotless sections.

7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ plugins {
// Updating the shadow plugin version to 8.1.1 causes issue with signing and publishing the shadowed
// artifacts - see https://github.com/johnrengelman/shadow/issues/901
id 'com.github.johnrengelman.shadow' version '8.1.0' apply false
// the minimum required JRE of 6.14.0+ is 11
chia7712 marked this conversation as resolved.
Show resolved Hide resolved
// the spotless before 6.14.0 support JDK8, after 6.23.3 support JDK21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spotless 6.13.0 has issue with Java 21 (see https://github.com/diffplug/spotless/pull/1920), and Spotless 6.14.0+ requires JRE 11

We are going to drop JDK8 support. Hence, the spotless is upgrade to newest version and be applied only if the build env is compatible with JDK 11.

WDYT?

// refer:https://github.com/diffplug/spotless/tree/main/plugin-gradle#requirements
id 'com.diffplug.spotless' version "6.13.0" apply false
// https://github.com/diffplug/spotless/pull/1920
id 'com.diffplug.spotless' version "6.25.0" apply false
}

ext {
Expand Down Expand Up @@ -799,7 +800,7 @@ subprojects {
skipConfigurations = [ "zinc" ]
}

if (project.name in spotlessApplyModules) {
if (JavaVersion.current().isJava11Compatible() && (project.name in spotlessApplyModules)) {
apply plugin: 'com.diffplug.spotless'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another idea: Could we revers the spotlessApplyModules to be the "exclude list"? For example:

def excludedSpotlessModules = ['core', 'client']

and then we remove module one by one if we apply the spotless rule. It is more clear then before, since we can "see" which module is not applied. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good idea.

spotless {
java {
Expand Down