Skip to content

Commit 780cc59

Browse files
committed
Merge pull request #216 from gliptak/jacocoroot
Process coverage for all subprojects
2 parents 071190f + 7ab6f63 commit 780cc59

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ script:
1717
- ./gradlew build coverage -s -i
1818

1919
after_success:
20-
- ./gradlew coverage coveralls -s -i
20+
- ./gradlew jacocoRootReport coveralls

build.gradle

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ buildscript {
1919
dependencies {
2020
classpath "com.ofg:uptodate-gradle-plugin:$uptodateVersion"
2121
classpath "me.tatarka:gradle-retrolambda:$retrolambdaVersion"
22-
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.4.0'
22+
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3'
2323
}
2424
}
2525

2626

2727
apply plugin: "jacoco"
2828
apply plugin: 'com.github.kt3k.coveralls'
2929

30-
3130
if (JavaVersion.current().isJava8Compatible()) {
3231
allprojects {
3332
tasks.withType(Javadoc) {
@@ -100,14 +99,9 @@ subprojects {
10099
repositories {
101100
mavenCentral()
102101
}
103-
104-
dependencies {
105-
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
106-
}
107102
}
108103

109104
apply plugin: "jacoco"
110-
apply plugin: 'com.github.kt3k.coveralls'
111105

112106
apply from: "$rootDir/lib.gradle"
113107
apply plugin: "java"
@@ -214,3 +208,23 @@ configure(subprojects.findAll { it.name != "props-core" }) {
214208
task env << {
215209
println System.getenv()
216210
}
211+
212+
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
213+
dependsOn = subprojects.jacocoTestReport
214+
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
215+
classDirectories = files(subprojects.sourceSets.main.output)
216+
executionData = files(subprojects.jacocoTestReport.executionData)
217+
reports {
218+
xml.enabled true
219+
xml.destination ="${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
220+
}
221+
// We could remove the following setOnlyIf line, but then
222+
// jacocoRootReport would silently be SKIPPED if something with
223+
// the projectsWithUnitTests is wrong (e.g. a project is missing
224+
// in there).
225+
setOnlyIf { true }
226+
}
227+
228+
coveralls {
229+
sourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs).files.absolutePath
230+
}

0 commit comments

Comments
 (0)