Browse Source

Split up coverage gathering + reporting.

Subprojects need to gather but not report.
pull/59/head
Chris Smith 9 years ago
parent
commit
57d87a90f3
3 changed files with 43 additions and 27 deletions
  1. 1
    1
      build.gradle
  2. 4
    26
      gradle/coverage.gradle
  3. 38
    0
      gradle/coveralls.gradle

+ 1
- 1
build.gradle View File

@@ -136,5 +136,5 @@ buildscript {
136 136
     }
137 137
 }
138 138
 
139
-apply from: 'gradle/coverage.gradle'
139
+apply from: 'gradle/coveralls.gradle'
140 140
 

+ 4
- 26
gradle/coverage.gradle View File

@@ -1,34 +1,12 @@
1 1
 apply plugin: 'jacoco'
2
-apply plugin: 'com.github.kt3k.coveralls'
3 2
 
4
-task jacocoRootReport(type: JacocoReport, group: 'Coverage reports', dependsOn: subprojects.test) {
5
-  description = 'Generates an aggregate report from all subprojects'
6
-
7
-  additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
8
-  sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
9
-  classDirectories = files(subprojects.sourceSets.main.output)
10
-  executionData = files(subprojects.jacocoTestReport.executionData)
3
+jacocoTestReport {
4
+  group = 'Coverage reports'
5
+  description = 'Generates a test coverage report for a project'
11 6
 
12 7
   reports {
13
-    html.enabled = true
14 8
     xml.enabled = true
9
+    html.enabled = true
15 10
   }
16
-
17
-  doFirst {
18
-    executionData = files(executionData.findAll { it.exists() })
19
-  }
20
-}
21
-
22
-coveralls {
23
-  jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
24
-  subprojects.sourceSets.main.allSource.srcDirs*.path.each { sourceDirs.addAll(it) }
25
-}
26
-
27
-tasks.coveralls {
28
-  group = 'Coverage reports'
29
-  description = 'Uploads the aggregated coverage report to Coveralls'
30
-
31
-  dependsOn jacocoRootReport
32
-  onlyIf { System.env.'CI' }
33 11
 }
34 12
 

+ 38
- 0
gradle/coveralls.gradle View File

@@ -0,0 +1,38 @@
1
+apply plugin: 'com.github.kt3k.coveralls'
2
+apply plugin: 'jacoco'
3
+
4
+repositories {
5
+  jcenter()
6
+}
7
+
8
+task jacocoRootReport(type: JacocoReport, group: 'Coverage reports', dependsOn: subprojects.test) {
9
+  description = 'Generates an aggregate report from all subprojects'
10
+
11
+  additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
12
+  sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
13
+  classDirectories = files(subprojects.sourceSets.main.output)
14
+  executionData = files(subprojects.jacocoTestReport.executionData)
15
+
16
+  reports {
17
+    html.enabled = true
18
+    xml.enabled = true
19
+  }
20
+
21
+  doFirst {
22
+    executionData = files(executionData.findAll { it.exists() })
23
+  }
24
+}
25
+
26
+coveralls {
27
+  jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
28
+  subprojects.sourceSets.main.allSource.srcDirs*.path.each { sourceDirs.addAll(it) }
29
+}
30
+
31
+tasks.coveralls {
32
+  group = 'Coverage reports'
33
+  description = 'Uploads the aggregated coverage report to Coveralls'
34
+
35
+  dependsOn jacocoRootReport
36
+  onlyIf { System.env.'CI' }
37
+}
38
+

Loading…
Cancel
Save