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 16:13:58 -04:00
parent 4180b9289f
commit 97ba480e71
2 changed files with 3 additions and 3 deletions

View File

@@ -256,7 +256,7 @@ subprojects { subproject ->
}
checkstyle {
configFile = file("${rootDir}/src/checkstyle/checkstyle.xml")
configDirectory.set(rootProject.file("src/checkstyle"))
toolVersion = '8.24'
}

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>
<module name="NewlineAtEndOfFile">