From 0079e1ff446106176d87867cec5216c5a4699bd9 Mon Sep 17 00:00:00 2001 From: dejan2609 Date: Sat, 22 May 2021 17:09:32 +0200 Subject: [PATCH] KAFKA-12770: introduce `checkstyleVersion` build option (for overriding CheckStyle project-defined dependency version) rationale/notes: * useful for experimenting and regression testing * requested by a CheckStyle team so they can add Kafka into their regression suite --- README.md | 3 ++- build.gradle | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2ee837174b09c..5c59c71354623 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,7 @@ You can run checkstyle using: The checkstyle warnings will be found in `reports/checkstyle/reports/main.html` and `reports/checkstyle/reports/test.html` files in the subproject build directories. They are also printed to the console. The build will fail if Checkstyle fails. +For experiments (or regression testing purposes) add -PcheckstyleVersion=8.xy (to override project-defined checkstyle version). #### Spotbugs #### Spotbugs uses static analysis to look for bugs in the code. @@ -245,7 +246,7 @@ includes inlining of methods within the scala library (which avoids lambda alloc only safe if the Scala library version is the same at compile time and runtime. Since we cannot guarantee this for all cases (for example, users may depend on the kafka jar for integration tests where they may include a scala library with a different version), we don't enable it by default. See https://www.lightbend.com/blog/scala-inliner-optimizer for more details. - +* `checkstyleVersion` overrides project-defined checkstyle dependency version. See "Checkstyle" manual section for example how to use it. ### Dependency Analysis ### The gradle [dependency debugging documentation](https://docs.gradle.org/current/userguide/viewing_debugging_dependencies.html) mentions using the `dependencies` or `dependencyInsight` tasks to debug dependencies for the root project or individual subprojects. diff --git a/build.gradle b/build.gradle index 0b3c570ddf5ca..99b7b0c3fe387 100644 --- a/build.gradle +++ b/build.gradle @@ -131,6 +131,9 @@ ext { generatedDocsDir = new File("${project.rootDir}/docs/generated") commitId = project.hasProperty('commitId') ? commitId : null + + // See README.md for this build option details and example of usage + checkstyleVersion = project.hasProperty('checkstyleVersion') ? checkstyleVersion : versions.checkstyle } apply from: file('wrapper.gradle') @@ -588,7 +591,7 @@ subprojects { checkstyle { configFile = new File(rootDir, "checkstyle/checkstyle.xml") configProperties = checkstyleConfigProperties("import-control.xml") - toolVersion = versions.checkstyle + toolVersion = checkstyleVersion } configure(checkstyleMain) {