Browse Source

KAFKA-15476: Resolves cache misses in checkstyle (#14344)

Resolves cache misses in checkstyle tasks due to absolute paths in configProperties.

Sets configDirectory extension property, which is made available by the checkstyle plugin as ${config_loc} in the checkstyle xml files, as shown in the Checkstyle Gradle docs. The absolute paths set in configProperties are then replaced by relative paths from configDirectory. Because the header and suppression config file names are static and only referenced once, these were removed from configProperties and the file names are given directly in checkstyle.xml

Reviewers: Divij Vaidya <diviv@amazon.com>
pull/14419/head
Tyler Bertrand 1 year ago committed by GitHub
parent
commit
eea1854479
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      build.gradle
  2. 6
      checkstyle/checkstyle.xml

6
build.gradle

@ -685,7 +685,7 @@ subprojects { @@ -685,7 +685,7 @@ subprojects {
}
checkstyle {
configFile = new File(rootDir, "checkstyle/checkstyle.xml")
configDirectory = rootProject.layout.projectDirectory.dir("checkstyle")
configProperties = checkstyleConfigProperties("import-control.xml")
toolVersion = versions.checkstyle
}
@ -789,9 +789,7 @@ def fineTuneEclipseClasspathFile(eclipse, project) { @@ -789,9 +789,7 @@ def fineTuneEclipseClasspathFile(eclipse, project) {
}
def checkstyleConfigProperties(configFileName) {
[importControlFile: "$rootDir/checkstyle/$configFileName",
suppressionsFile: "$rootDir/checkstyle/suppressions.xml",
headerFile: "$rootDir/checkstyle/java.header"]
[importControlFile: "$configFileName"]
}
// Aggregates all jacoco results into the root project directory

6
checkstyle/checkstyle.xml

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
<!-- header -->
<module name="Header">
<property name="headerFile" value="${headerFile}" />
<property name="headerFile" value="${config_loc}/java.header" />
</module>
<module name="TreeWalker">
@ -79,7 +79,7 @@ @@ -79,7 +79,7 @@
<!-- dependencies -->
<module name="ImportControl">
<property name="file" value="${importControlFile}"/>
<property name="file" value="${config_loc}/${importControlFile}"/>
</module>
<!-- whitespace -->
@ -149,7 +149,7 @@ @@ -149,7 +149,7 @@
</module>
<module name="SuppressionFilter">
<property name="file" value="${suppressionsFile}"/>
<property name="file" value="${config_loc}/suppressions.xml"/>
</module>
<!-- Allows the use of the @SuppressWarnings annotation in the code -->

Loading…
Cancel
Save