Fix Checkstyle to rely on the absolute path

It turns out that relative path in the property
`<property name="file" value="src/checkstyle/checkstyle-suppressions.xml"/>`
in some cases is resolved against a Gradle deamon dir as a root for configs

* Fix Checkstyle plugin config to use an absolute path in the project for
the `configDirectory`.
* Since `configDirectory` is exposed as a Checkstyle config variable,
we can use its `${config_loc}` placeholder to rely on the absolute path
in the project
This commit is contained in:
Artem Bilan
2020-05-06 15:53:28 -04:00
parent 3e63fe4eb7
commit f047f0528b
2 changed files with 3 additions and 3 deletions

View File

@@ -317,7 +317,7 @@ configure(javaProjects) { subproject ->
}
checkstyle {
configFile = file("$rootDir/src/checkstyle/checkstyle.xml")
configDirectory.set(rootProject.file("src/checkstyle"))
toolVersion = project.hasProperty('checkstyleVersion') ? project.checkstyleVersion : '8.32'
}

View File

@@ -5,12 +5,12 @@
<module name="Checker">
<module name="SuppressionFilter">
<property name="file" value="src/checkstyle/checkstyle-suppressions.xml"/>
<property name="file" value="${config_loc}/checkstyle-suppressions.xml"/>
</module>
<!-- Root Checks -->
<module name="RegexpHeader">
<property name="headerFile" value="src/checkstyle/checkstyle-header.txt"/>
<property name="headerFile" value="${config_loc}/checkstyle-header.txt"/>
<property name="fileExtensions" value="java"/>
</module>