This is an automated email from the ASF dual-hosted git repository.
vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/master by this push:
new c23abbe Add './gradlew style' task to apply code format and report
violations
c23abbe is described below
commit c23abbe90e6142cac9cc93d1a54e4dd30bab0a93
Author: Vladimir Sitnikov <[email protected]>
AuthorDate: Tue Nov 19 13:14:29 2019 +0300
Add './gradlew style' task to apply code format and report violations
---
build.gradle.kts | 15 +++++++++++++++
site/_docs/howto.md | 3 ++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/build.gradle.kts b/build.gradle.kts
index 9fa93f7..c72a975 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -283,6 +283,9 @@ allprojects {
"base_dir" to rootDir.toString()
)
}
+ tasks.register("checkstyleAll") {
+ dependsOn(tasks.withType<Checkstyle>())
+ }
tasks.withType<Checkstyle>().configureEach {
// Excludes here are faster than in suppressions.xml
// Since here we can completely remove file from the analysis.
@@ -300,6 +303,18 @@ allprojects {
}
}
}
+ if (!skipSpotless || !skipCheckstyle) {
+ tasks.register("style") {
+ group = LifecycleBasePlugin.VERIFICATION_GROUP
+ description = "Formats code (license header, import order,
whitespace at end of line, ...) and executes Checkstyle verifications"
+ if (!skipSpotless) {
+ dependsOn("spotlessApply")
+ }
+ if (!skipCheckstyle) {
+ dependsOn("checkstyleAll")
+ }
+ }
+ }
tasks.withType<AbstractArchiveTask>().configureEach {
// Ensure builds are reproducible
diff --git a/site/_docs/howto.md b/site/_docs/howto.md
index 23274dc..6a0668c 100644
--- a/site/_docs/howto.md
+++ b/site/_docs/howto.md
@@ -93,7 +93,8 @@ $ ./gradlew assemble # build the artifacts
$ ./gradlew build -x test # build the artifacts, verify code style, skip tests
$ ./gradlew check # verify code style, execute tests
$ ./gradlew test # execute tests
-$ ./gradlew checkstyleMain checkstyleTest # verify code style
+$ ./gradlew style # update code formatting (for auto-correctable cases) and
verify style
+$ ./gradlew spotlessCheck checkstyleAll # report code style violations
{% endhighlight %}
You can use `./gradlew assemble` to build the artifacts and skip all tests and
verifications.