Skip to content

Commit

Permalink
KAFKA-16896 upgrade spotless version after we drop JDK8 (apache#17423)
Browse files Browse the repository at this point in the history
Reviewers: Chia-Ping Tsai <[email protected]>
  • Loading branch information
m1a2st authored Oct 9, 2024
1 parent 48e2176 commit 91390a9
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ plugins {
id "com.github.spotbugs" version '5.1.3' apply false
id 'org.scoverage' version '8.0.3' apply false
id 'io.github.goooler.shadow' version '8.1.3' 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.15.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
id 'com.diffplug.spotless' version "6.25.0"
}

ext {
Expand Down Expand Up @@ -854,17 +851,12 @@ subprojects {
skipProjects = [ ":jmh-benchmarks", ":trogdor" ]
skipConfigurations = [ "zinc" ]
}
// the task `removeUnusedImports` is implemented by google-java-format,
// and unfortunately the google-java-format version used by spotless 6.14.0 can't work with JDK 21.
// Hence, we apply spotless tasks only if the env is either JDK11 or JDK17
if ((JavaVersion.current().isJava11() || (JavaVersion.current() == JavaVersion.VERSION_17))) {
apply plugin: 'com.diffplug.spotless'
spotless {
java {
targetExclude('**/generated/**/*.java','**/generated-test/**/*.java')
importOrder('kafka', 'org.apache.kafka', 'com', 'net', 'org', 'java', 'javax', '', '\\#')
removeUnusedImports()
}
apply plugin: 'com.diffplug.spotless'
spotless {
java {
targetExclude('**/generated/**/*.java','**/generated-test/**/*.java')
importOrder('kafka', 'org.apache.kafka', 'com', 'net', 'org', 'java', 'javax', '', '\\#')
removeUnusedImports()
}
}
}
Expand Down Expand Up @@ -2832,15 +2824,12 @@ project(':streams:streams-scala') {
dependsOn 'copyDependantLibs'
}

// spotless 6.14 requires Java 11 at runtime
if (JavaVersion.current().isJava11Compatible()) {
apply plugin: 'com.diffplug.spotless'
spotless {
scala {
target '**/*.scala'
scalafmt("$versions.scalafmt").configFile('../../checkstyle/.scalafmt.conf').scalaMajorVersion(versions.baseScala)
licenseHeaderFile '../../checkstyle/java.header', 'package'
}
apply plugin: 'com.diffplug.spotless'
spotless {
scala {
target '**/*.scala'
scalafmt("$versions.scalafmt").configFile('../../checkstyle/.scalafmt.conf').scalaMajorVersion(versions.baseScala)
licenseHeaderFile '../../checkstyle/java.header', 'package'
}
}
}
Expand Down

0 comments on commit 91390a9

Please sign in to comment.