Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
227a957
update hide file
gongxuanzhang May 27, 2024
7596c2d
add Project.xml
gongxuanzhang May 27, 2024
7e56b6a
Merge branch 'apache:trunk' into import-order
gongxuanzhang May 27, 2024
00ad230
upload Project.xml
gongxuanzhang May 28, 2024
2d6b289
update suppressions.xml
gongxuanzhang May 28, 2024
77f46e1
Merge branch 'apache:trunk' into import-order
gongxuanzhang May 28, 2024
e9db586
Delete .idea directory
gongxuanzhang May 29, 2024
f2ef540
Merge branch 'apache:trunk' into import-order
gongxuanzhang May 29, 2024
37cc473
revert gitignore
gongxuanzhang May 29, 2024
40aabc0
Merge branch 'apache:trunk' into import-order
gongxuanzhang May 30, 2024
2960a41
add spotless
gongxuanzhang May 30, 2024
7cde3f8
update build.gradle
gongxuanzhang May 30, 2024
8e171fb
Merge branch 'apache:trunk' into import-order
gongxuanzhang May 30, 2024
82de188
revert blank
gongxuanzhang May 31, 2024
5623a3b
change the build.gradle
gongxuanzhang May 31, 2024
3cb353d
update README
gongxuanzhang May 31, 2024
1ee4e62
Merge branch 'apache:trunk' into import-order
gongxuanzhang May 31, 2024
076b467
Merge branch 'apache:trunk' into import-order
gongxuanzhang Jun 1, 2024
c3abfc2
update checkstyle
gongxuanzhang Jun 1, 2024
462625d
update readme
gongxuanzhang Jun 1, 2024
6f25e4d
update build.gradle
gongxuanzhang Jun 1, 2024
7d99f05
update build.gradle
gongxuanzhang Jun 1, 2024
d956ba3
update checkstyle.xml
gongxuanzhang Jun 2, 2024
9f316a9
update build.gradle
gongxuanzhang Jun 2, 2024
bfa5077
Merge branch 'apache:trunk' into import-order
gongxuanzhang Jun 2, 2024
5e08003
revert build.gradle
gongxuanzhang Jun 2, 2024
3702bb1
lowercase
gongxuanzhang Jun 2, 2024
54277f3
Update README.md
gongxuanzhang Jun 2, 2024
89999a8
Merge branch 'apache:trunk' into import-order
gongxuanzhang Jun 2, 2024
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
23 changes: 21 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ 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
id 'com.diffplug.spotless' version '6.14.0' apply false // 6.14.1 and newer require Java 11 at compile time, so we can't upgrade until AK 4.0
id 'com.diffplug.spotless' version "${spotlessVersion}" apply false
Comment thread
chia7712 marked this conversation as resolved.
Outdated
}

ext {
Expand Down Expand Up @@ -196,6 +196,19 @@ def determineCommitId() {
}
}

def spotlessApplyModules = ['']

def configureSpotless = { project ->
project.apply plugin: 'com.diffplug.spotless'

project.spotless {
java {
importOrder('kafka', 'org.apache.kafka', 'com', 'net', 'org', 'java', 'javax', '', '\\#')
removeUnusedImports()
}
}
}

apply from: file('wrapper.gradle')

if (repo != null) {
Expand Down Expand Up @@ -787,6 +800,12 @@ subprojects {
skipProjects = [ ":jmh-benchmarks", ":trogdor" ]
skipConfigurations = [ "zinc" ]
}

afterEvaluate {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we can set spotless directly. For example:

  if (project.name in spotlessApplyModules) {
    apply plugin: 'com.diffplug.spotless'
    spotless {
      java {
        importOrder('kafka', 'org.apache.kafka', 'com', 'net', 'org', 'java', 'javax', '', '\\#')
        removeUnusedImports()
      }
    }
  }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I change the PR,please review it @chia7712

if (project.name in spotlessApplyModules) {
configureSpotless(project)
}
}
}

gradle.taskGraph.whenReady { taskGraph ->
Expand Down Expand Up @@ -1007,7 +1026,7 @@ project(':core') {
testImplementation libs.junitJupiter
testImplementation libs.slf4jlog4j
testImplementation libs.caffeine

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please revert this change


generator project(':generator')
}

Expand Down
8 changes: 8 additions & 0 deletions checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@
<property name="file" value="${config_loc}/${importControlFile}"/>
</module>

<module name="ImportOrder">
<property name="groups" value="kafka,org.apache.kafka,com,net,org,java,javax"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="option" value="bottom"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>

<!-- whitespace -->
<module name="GenericWhitespace"/>
<module name="NoWhitespaceBefore"/>
Expand Down
3 changes: 3 additions & 0 deletions checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,7 @@
<suppress checks="(ClassDataAbstractionCoupling|ClassFanOutComplexity)"
files="(ReplicaFetcherThreadBenchmark).java"/>

<!--import order -->
<suppress checks="ImportOrder" files="^*$"/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why we need this change?

@gongxuanzhang gongxuanzhang May 31, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think checkstyle should consistent with auto format . If you open the A module auto format, we should open the module check rule.
ImportOrder rule can't custom in each module(It's going to take a lot of changes,maybe should add build.gradle every module).
So i add this line in order that open rule some module in future,This is what I think is a more convenient way to modify by module

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Making the consistency is extra effort. Also, those changes will complicate checkstyle files. Hence, I prefer to remove them if we do NOT use it actually.


</suppressions>
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ scalaVersion=2.13.14
# Adding swaggerVersion in gradle.properties to have a single version in place for swagger
# New version of Swagger 2.2.14 requires minimum JDK 11.
swaggerVersion=2.2.8
# 6.14.0 and newer are need for java 11
spotlessVersion=6.13.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

spotlessVersion is used by only one-line, hence we can inline it.

task=build
org.gradle.jvmargs=-Xmx2g -Xss4m -XX:+UseParallelGC
org.gradle.parallel=true