You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/12/21 05:15:41 UTC

groovy git commit: jacoco plugin config amendments to work with latest build

Repository: groovy
Updated Branches:
  refs/heads/master 8e7114d73 -> e6649b31b


jacoco plugin config amendments to work with latest build


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/e6649b31
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e6649b31
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e6649b31

Branch: refs/heads/master
Commit: e6649b31b78e3812babe93d9f5aad091dd9d73b8
Parents: 8e7114d
Author: paulk <pa...@asert.com.au>
Authored: Thu Dec 21 15:15:15 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Thu Dec 21 15:15:34 2017 +1000

----------------------------------------------------------------------
 build.gradle                |  2 +-
 gradle/jacoco/jacoco.gradle | 49 ++++++++++++++++++++++++++++++++--------
 2 files changed, 40 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e6649b31/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 1d61df1..708d140 100644
--- a/build.gradle
+++ b/build.gradle
@@ -73,7 +73,7 @@ ext.modules = {
 ext.isReleaseVersion = !groovyVersion.toLowerCase().endsWith("snapshot")
 
 apply from: 'gradle/bad-practices.gradle'
-apply from: 'gradle/indy.gradle'
+//apply from: 'gradle/indy.gradle'
 apply from: 'gradle/publish.gradle'
 apply plugin: 'javadocHotfix'
 apply plugin: "com.github.jk1.dependency-license-report"

http://git-wip-us.apache.org/repos/asf/groovy/blob/e6649b31/gradle/jacoco/jacoco.gradle
----------------------------------------------------------------------
diff --git a/gradle/jacoco/jacoco.gradle b/gradle/jacoco/jacoco.gradle
index 0fddbe9..c483005 100644
--- a/gradle/jacoco/jacoco.gradle
+++ b/gradle/jacoco/jacoco.gradle
@@ -28,21 +28,24 @@ if (rootProject.hasProperty('coverage') && Boolean.valueOf(rootProject.getProper
 
         project.afterEvaluate {
             tasks.withType(JacocoReport) {
-                if (name!='jacocoAllReport') {
+                if (name != 'jacocoAllReport' && name != 'jacocoAllIndyReport') {
                     sourceDirectories += files(project.sourceSets.main.allGroovy.srcDirs)
-                    classDirectories += files(project.sourceSets.main.output)
+//                    classDirectories += files(project.sourceSets.main.output)
                 }
             }
         }
-
     }
 
-    task jacocoMerge(type:JacocoMerge) {
+    // To avoid "Can't add different class with same name" fatal error
+    // due to different classes generated when using Indy, create two reports
+    // No need to include Java class directories since Groovy one includes those classes
+
+    task jacocoMerge(type: JacocoMerge) {
         destinationFile = file("$buildDir/jacoco/jacoco-all.exec")
         allprojects {
             project.plugins.withType(JavaPlugin) {
                 project.tasks.withType(Test) { task ->
-                    if (sourceSets.test.allSource.srcDirs.any { it.exists() }) {
+                    if (sourceSets.test.allSource.srcDirs.any { it.exists() } && !task.name.contains('Indy')) {
                         executionData(task)
                     }
                 }
@@ -50,17 +53,43 @@ if (rootProject.hasProperty('coverage') && Boolean.valueOf(rootProject.getProper
         }
     }
 
-    task jacocoAllReport(type:JacocoReport, dependsOn: 'jacocoMerge') {
+    task jacocoMergeIndy(type: JacocoMerge) {
+        destinationFile = file("$buildDir/jacoco/jacoco-all-indy.exec")
+        allprojects {
+            project.plugins.withType(JavaPlugin) {
+                project.tasks.withType(Test) { task ->
+                    if (sourceSets.test.allSource.srcDirs.any { it.exists() } && task.name.contains('Indy')) {
+                        executionData(task)
+                    }
+                }
+            }
+        }
+    }
+
+    task jacocoAllReport(type: JacocoReport, dependsOn: 'jacocoMerge') {
         executionData jacocoMerge.destinationFile
         allprojects {
             project.plugins.withType(JavaPlugin) {
-                def sd = sourceDirectories?:files()
-                def cd = classDirectories?:files()
+                def sd = sourceDirectories ?: files()
+                def cd = classDirectories ?: files()
+                sourceDirectories = sd + files(project.sourceSets.main.allGroovy.srcDirs, project.sourceSets.main.allJava.srcDirs)
+                classDirectories = cd + files(compileGroovy.destinationDir)
+            }
+        }
+    }
+
+    task jacocoAllIndyReport(type: JacocoReport, dependsOn: 'jacocoMergeIndy') {
+        executionData jacocoMergeIndy.destinationFile
+        allprojects {
+            project.plugins.withType(JavaPlugin) {
+                def sd = sourceDirectories ?: files()
+                def cd = classDirectories ?: files()
                 sourceDirectories = sd + files(project.sourceSets.main.allGroovy.srcDirs, project.sourceSets.main.allJava.srcDirs)
-                classDirectories = cd + files(project.sourceSets.main.output)
+                classDirectories = cd + files(compileGroovyWithIndy.destinationDir)
             }
         }
     }
 
     check.dependsOn jacocoAllReport
-}
\ No newline at end of file
+    check.dependsOn jacocoAllIndyReport
+}