This is an automated email from the ASF dual-hosted git repository.

vladimirsitnikov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
     new 31a23f3809 [CALCITE-4947] Checkstyle fails on classes generated by 
Intellij when using option "build and run [tests] using Intellij IDEA"
31a23f3809 is described below

commit 31a23f38092c185ef0faf19f770c1de8625db0e8
Author: Thomas Rebele <[email protected]>
AuthorDate: Fri Dec 17 17:47:42 2021 +0100

    [CALCITE-4947] Checkstyle fails on classes generated by Intellij when using 
option "build and run [tests] using Intellij IDEA"
    
    Addendum to the previous commit: ignore files generated by Intellij
    during the compilation.
---
 build.gradle.kts | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/build.gradle.kts b/build.gradle.kts
index 4be15b5a7a..33ff8905c8 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -319,15 +319,24 @@ override fun execute(context: ComponentMetadataContext) {
     "**/parser/**/Token.*",
     "**/parser/**/TokenMgrError.*",
     "**/org/apache/calcite/runtime/Resources.java",
-    "**/parser/**/*ParserTokenManager.*",
-    "generated_tests/org/apache/calcite/**/*",
-    "generated/org/apache/calcite/**/*"
+    "**/parser/**/*ParserTokenManager.*"
 )
 
 fun PatternFilterable.excludeJavaCcGenerated() {
     exclude(*javaccGeneratedPatterns)
 }
 
+val intellijGeneratedPatterns = arrayOf(
+    "generated_tests/org/apache/calcite/**/*",
+    "generated/org/apache/calcite/**/*"
+)
+
+// Ignore files generated by Intellij's compiler
+// when using the option to build and run tests using Intellij IDEA instead of 
Gradle
+fun PatternFilterable.excludeIntellijGenerated() {
+    exclude(*intellijGeneratedPatterns)
+}
+
 fun com.github.autostyle.gradle.BaseFormatExtension.license() {
     licenseHeader(rootProject.ide.licenseHeader) {
         copyrightStyle("bat", 
com.github.autostyle.generic.DefaultCopyrightStyle.PAAMAYIM_NEKUDOTAYIM)
@@ -466,6 +475,7 @@ fun 
com.github.autostyle.gradle.BaseFormatExtension.license() {
             // On the other hand, supporessions.xml still analyzes the file, 
and
             // then it recognizes it should suppress all the output.
             excludeJavaCcGenerated()
+            excludeIntellijGenerated()
             // Workaround for https://github.com/gradle/gradle/issues/13927
             // Absolute paths must not be used as they defeat Gradle build 
cache
             // Unfortunately, Gradle passes only config_loc variable by 
default, so we make
@@ -505,6 +515,7 @@ fun 
com.github.autostyle.gradle.BaseFormatExtension.license() {
     tasks {
         configureEach<Javadoc> {
             excludeJavaCcGenerated()
+            excludeIntellijGenerated()
             (options as StandardJavadocDocletOptions).apply {
                 // Please refrain from using non-ASCII chars below since the 
options are passed as
                 // javadoc.options file which is parsed with "default encoding"
@@ -812,6 +823,7 @@ fun 
com.github.autostyle.gradle.BaseFormatExtension.license() {
 
             configureEach<CheckForbiddenApis> {
                 excludeJavaCcGenerated()
+                excludeIntellijGenerated()
                 exclude(
                     
"**/org/apache/calcite/adapter/os/Processes${'$'}ProcessFactory.class",
                     "**/org/apache/calcite/adapter/os/OsAdapterTest.class",
@@ -836,6 +848,7 @@ fun 
com.github.autostyle.gradle.BaseFormatExtension.license() {
                 if (enableCheckerframework) {
                     options.forkOptions.memoryMaximumSize = "2g"
                 }
+                excludeIntellijGenerated()
             }
             configureEach<Test> {
                 outputs.cacheIf("test results depend on the database 
configuration, so we shouldn't cache it") {

Reply via email to