snazy commented on code in PR #1880:
URL: https://github.com/apache/polaris/pull/1880#discussion_r2144948872
##########
build-logic/src/main/kotlin/polaris-java.gradle.kts:
##########
@@ -30,18 +30,34 @@ plugins {
`java-library`
`java-test-fixtures`
`jvm-test-suite`
+ checkstyle
id("polaris-spotless")
id("jacoco-report-aggregation")
id("net.ltgt.errorprone")
}
apply<PublishingHelperPlugin>()
-if (project.extra.has("duplicated-project-sources")) {
- // skip the style check for duplicated projects
- tasks.withType<Checkstyle>().configureEach { enabled = false }
+val checkstyleVersion =
Review Comment:
Nit: move this into the `checkstyle {` block.
##########
build-logic/src/main/kotlin/polaris-java.gradle.kts:
##########
@@ -30,18 +30,34 @@ plugins {
`java-library`
`java-test-fixtures`
`jvm-test-suite`
+ checkstyle
id("polaris-spotless")
id("jacoco-report-aggregation")
id("net.ltgt.errorprone")
}
apply<PublishingHelperPlugin>()
-if (project.extra.has("duplicated-project-sources")) {
- // skip the style check for duplicated projects
- tasks.withType<Checkstyle>().configureEach { enabled = false }
+val checkstyleVersion =
+ versionCatalogs
+ .named("libs")
+ .findVersion("checkstyle")
+ .orElseThrow { GradleException("checkstyle version not found in
libs.versions.toml") }
+ .requiredVersion
+
+checkstyle {
+ toolVersion = checkstyleVersion
+ configFile = rootProject.file("codestyle/checkstyle.xml")
+ isIgnoreFailures = false
+ maxErrors = 0
+ maxWarnings = 0
}
+// Ensure Checkstyle runs after jandex to avoid task dependency issues
+tasks
+ .matching { it.name.startsWith("checkstyle") }
Review Comment:
This is a trap and prevents "configure on demand", `.matching` gives you the
fully configured tasks.
I'd use
```kotlin
tasks.withType<Checkstyle>().configureEach { ...
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]