Skip to content

Commit 7c72a47

Browse files
committed
Add merged report. Fixes #1
1 parent 3bc2e13 commit 7c72a47

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

src/main/groovy/com/vanniktech/android/junit/jacoco/Generation.groovy

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ class Generation implements Plugin<Project> {
1010
project.subprojects { subProject ->
1111
subProject.plugins.apply('jacoco')
1212

13-
jacoco {
13+
subProject.jacoco {
1414
toolVersion '0.7.2.201409121644'
1515
}
1616

17-
subProject.task("jacocoReport", type: JacocoReport, dependsOn: 'testDebugUnitTest') {
17+
subProject.task('jacocoReport', type: JacocoReport, dependsOn: 'testDebugUnitTest') {
1818
group = 'Reporting'
1919
description = 'Generate Jacoco coverage reports after running tests.'
2020

@@ -49,5 +49,36 @@ class Generation implements Plugin<Project> {
4949
}
5050
}
5151
}
52+
53+
project.plugins.apply('jacoco')
54+
55+
project.jacoco {
56+
toolVersion '0.7.2.201409121644'
57+
}
58+
59+
project.task('jacocoFullReport', type: JacocoReport, group: 'Coverage reports') {
60+
group = 'Reporting'
61+
description = 'Generate Jacoco coverage reports aggregated from all subprojects.'
62+
dependsOn(project.subprojects.jacocoReport)
63+
64+
executionData = project.files(project.subprojects.jacocoReport.executionData)
65+
classDirectories = project.files(project.subprojects.jacocoReport.classDirectories)
66+
sourceDirectories = project.files(project.subprojects.jacocoReport.sourceDirectories)
67+
68+
reports {
69+
xml {
70+
enabled = true
71+
destination "${project.buildDir}/reports/jacoco/full/jacoco.xml"
72+
}
73+
html {
74+
enabled = true
75+
destination "${project.buildDir}/reports/jacoco/full"
76+
}
77+
}
78+
79+
doFirst {
80+
executionData = project.files(executionData.findAll { it.exists() })
81+
}
82+
}
5283
}
5384
}

0 commit comments

Comments
 (0)