groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] branch master updated: minor refactor: use consistent subdirectory naming for generated sources and exclude from checkstyle
Date Mon, 01 Apr 2019 07:48:59 GMT
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new c64afcc  minor refactor: use consistent subdirectory naming for generated sources
and exclude from checkstyle
c64afcc is described below

commit c64afcc57f072139b8006a4358be4a3ad5304238
Author: Paul King <paulk@asert.com.au>
AuthorDate: Mon Apr 1 17:48:46 2019 +1000

    minor refactor: use consistent subdirectory naming for generated sources and exclude from
checkstyle
---
 build.gradle                           | 9 ++++-----
 gradle/quality.gradle                  | 7 +------
 subprojects/parser-antlr4/build.gradle | 3 +++
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/build.gradle b/build.gradle
index 8688e13..2d74d29 100644
--- a/build.gradle
+++ b/build.gradle
@@ -188,7 +188,6 @@ dependencies {
     compile("org.apache.ivy:ivy:$ivyVersion") {
         transitive = false
     }
-    compile files("${buildDir}/generated-classes")
 
     compileOnly "com.github.spotbugs:spotbugs-annotations:$spotbugsannotationsVersion"
 
@@ -225,21 +224,21 @@ dependencies {
     testCompile project(':groovy-macro')
 }
 
-ext.generatedDirectory = "${buildDir}/generated-sources"
+ext.generatedDirectory = "${buildDir}/generated/sources"
 
 sourceSets {
     main {
         java {
             // the only reason we add src/main/groovy here is for the bootstrap compiler
             srcDir 'src/main/groovy'
-            srcDir "$generatedDirectory/src/main"
+            srcDir "$generatedDirectory/antlr2/src/main"
             if (!JavaVersion.current().isJava8Compatible()) {
                 exclude '**/v8/*'
                 exclude '**/vm8/*'
             }
         }
         groovy {
-            srcDir "$generatedDirectory/src/main"
+            srcDir "$generatedDirectory/antlr2/src/main"
             if (!JavaVersion.current().isJava8Compatible()) {
                 exclude '**/v8/*'
                 exclude '**/vm8/*'
@@ -294,7 +293,7 @@ task ensureGrammars {
     description = 'Ensure all the Antlr2 generated files are up to date.'
     ext.antlrDirectory = "$projectDir/src/main/antlr2/org/codehaus/groovy/antlr"
     ext.javaParserDirectory = "$ext.antlrDirectory/java"
-    ext.genPath = "$generatedDirectory/src/main/org/codehaus/groovy/antlr"
+    ext.genPath = "$generatedDirectory/antlr2/src/main/org/codehaus/groovy/antlr"
     ext.groovyOutDir = "$ext.genPath/parser"
     ext.javaOutDir = "$ext.genPath/java"
     inputs.dir(antlrDirectory)
diff --git a/gradle/quality.gradle b/gradle/quality.gradle
index 2047d22..4ab5948 100644
--- a/gradle/quality.gradle
+++ b/gradle/quality.gradle
@@ -80,10 +80,6 @@ allprojects {
         configFile = file("$rootProject.projectDir/config/checkstyle/checkstyle.xml")
         configProperties = ['rootProject.projectDir': rootProject.projectDir]
         def reportFile = file("${buildDir}/reports/checkstyle/${name}.xml")
-        source = sourceSets.main.allJava.matching {
-            // TODO why doesn't this exclusion work?
-            exclude '**/generated-sources/**/*'
-        }
         reports {
             include ( '**/*.java')
             xml {
@@ -109,8 +105,7 @@ allprojects {
                     def xml = new XmlSlurper().parse(reportFile.newReader('utf-8'))
                     def files = []
                     xml.file.each { f ->
-                        // TODO remove generated-sources check once exclude above works
-                        if (f.error.size() && !f.@name.toString().contains('generated-sources'))
{
+                        if (f.error.size() && !f.@name.toString().matches('.*[/\\\\]generated[/\\\\].*'))
{
                             files << [
                                     name: f.@name.toString(),
                                     errors: f.error.collect { e ->
diff --git a/subprojects/parser-antlr4/build.gradle b/subprojects/parser-antlr4/build.gradle
index c2bb3b2..e1f5e46 100644
--- a/subprojects/parser-antlr4/build.gradle
+++ b/subprojects/parser-antlr4/build.gradle
@@ -18,6 +18,7 @@
  */
 
 apply plugin: 'antlr'
+
 sourceSets {
     main {
         antlr {
@@ -33,6 +34,8 @@ def srcTest = "$srcBase/test"
 generateGrammarSource {
     maxHeapSize = '1g'
     outputs.cacheIf { true }
+    outputDirectory = file("$generatedDirectory/antlr4")
+    sourceSets.main.java.srcDirs += outputDirectory
 
     final PARSER_PACKAGE_NAME = 'org.apache.groovy.parser.antlr4'
     arguments += ["-visitor", "-no-listener", "-package", PARSER_PACKAGE_NAME]


Mime
View raw message