-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Changes from 13 commits
1edc40e
ce9cbec
911fa3f
fa9f002
9453039
efe7050
ca30c32
a39d07b
854aa32
95d58e4
abc921e
a015ce6
5524a5e
4c95e24
b5de922
16249c1
75ede30
0f108eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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
|
||||||
// refer:https://github.com/diffplug/spotless/tree/main/plugin-gradle#requirements | ||||||
id 'com.diffplug.spotless' version "6.13.0" apply false | ||||||
// 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. | ||||||
// spotless 6.25.0 has issue in runtime with JDK8 even through we define it with `apply:false`. see https://github.com/diffplug/spotless/issues/2156 for more details | ||||||
id 'com.diffplug.spotless' version "6.14.0" apply false | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you give a try for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if 6.14.0 is the latest version which can work with JDK8 (as you described in the comment), please change the "spotless 6.25.0" to "spotless 6.15+" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can always use the latest Spotless and bump your JRE to match it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Goooler thanks for your comment. Kafka still support JDK 8, so we make CI run checks/tests with JDK8. However, as @gongxuanzhang described, spotless 6.15+ can't work with JDK8 even though we set "apply false". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want the binary compatibility to keep on Java 8, just declare See also https://jakewharton.com/gradle-toolchains-are-rarely-a-good-idea/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, you are right. We have set the https://github.com/apache/kafka/blob/trunk/build.gradle#L57 I know that we can use JDK11 to build kafak which is compatible with JRE8. However, our rules is "we ought to run all checks/tests with all supported JDKs". That is why we need to make sure spotless can work with all supported JDKs. for another, we will drop JDK8 in next release. Hence, we can remove this workaround and upgrade spotless to newest version later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good to see. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Goooler Do you approve this PR? it would be great to get approve from spotless core developer :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the delay. I think it would be great to throw exceptions if the current JRE is not Java 11 compatible. See #16176 (comment). Either way, we can do that after dropping JDK8 as you described. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I had similar idea before (see #13311 (comment)) . However, that means our developers can't use JDK8 to write code for kafka. Also, we can't follow our JDK rules - run all checks/tests with all supported JDKs |
||||||
} | ||||||
|
||||||
ext { | ||||||
|
@@ -200,7 +201,60 @@ def determineCommitId() { | |||||
} | ||||||
} | ||||||
|
||||||
def spotlessApplyModules = [''] | ||||||
def excludedSpotlessModules = [':clients', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
':connect:api', | ||||||
':connect:basic-auth-extension', | ||||||
':connect:file', | ||||||
':connect:json', | ||||||
':connect:mirror', | ||||||
':connect:mirror-client', | ||||||
':connect:runtime', | ||||||
':connect:test-plugins', | ||||||
':connect:transforms', | ||||||
':core', | ||||||
':examples', | ||||||
':generator', | ||||||
':group-coordinator', | ||||||
':jmh-benchmarks', | ||||||
':log4j-appender', | ||||||
':metadata', | ||||||
':raft', | ||||||
':server', | ||||||
':server-common', | ||||||
':shell', | ||||||
':storage', | ||||||
':storage:storage-api', // rename in settings.gradle | ||||||
':streams', | ||||||
':streams:examples', | ||||||
':streams:streams-scala', | ||||||
':streams:test-utils', | ||||||
':streams:upgrade-system-tests-0100', | ||||||
':streams:upgrade-system-tests-0101', | ||||||
':streams:upgrade-system-tests-0102', | ||||||
':streams:upgrade-system-tests-0110', | ||||||
':streams:upgrade-system-tests-10', | ||||||
':streams:upgrade-system-tests-11', | ||||||
':streams:upgrade-system-tests-20', | ||||||
':streams:upgrade-system-tests-21', | ||||||
':streams:upgrade-system-tests-22', | ||||||
':streams:upgrade-system-tests-23', | ||||||
':streams:upgrade-system-tests-24', | ||||||
':streams:upgrade-system-tests-25', | ||||||
':streams:upgrade-system-tests-26', | ||||||
':streams:upgrade-system-tests-27', | ||||||
':streams:upgrade-system-tests-28', | ||||||
':streams:upgrade-system-tests-30', | ||||||
':streams:upgrade-system-tests-31', | ||||||
':streams:upgrade-system-tests-32', | ||||||
':streams:upgrade-system-tests-33', | ||||||
':streams:upgrade-system-tests-34', | ||||||
':streams:upgrade-system-tests-35', | ||||||
':streams:upgrade-system-tests-36', | ||||||
':streams:upgrade-system-tests-37', | ||||||
':tools', | ||||||
':tools:tools-api', | ||||||
':transaction-coordinator', | ||||||
':trogdor'] | ||||||
|
||||||
|
||||||
apply from: file('wrapper.gradle') | ||||||
|
@@ -798,8 +852,8 @@ subprojects { | |||||
skipProjects = [ ":jmh-benchmarks", ":trogdor" ] | ||||||
skipConfigurations = [ "zinc" ] | ||||||
} | ||||||
|
||||||
if (project.path in spotlessApplyModules) { | ||||||
if(JavaVersion.current().isJava11Compatible() && project.path !in excludedSpotlessModules) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can just throw exceptions if the current JRE is not Java 11 compatible. |
||||||
apply plugin: 'com.diffplug.spotless' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. another idea: Could we revers the
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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, good idea. |
||||||
spotless { | ||||||
java { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remind developers that
spotlessCheck
will fail if env is JDK8.Make sure you pass it before you submit.
is a bit verbose since we have QA :)