Add Jacoco code coverage

After running tests, you can run jacocoTestReport. The jacocoTestReport
task does not depend on the tests, so they should be run separately.

There is still a lot of noise in the jacoco output since we aren't yet
filtering generated code.
This commit is contained in:
Eric Anderson 2015-05-05 12:29:26 -07:00
parent cde7eaa585
commit 041cdb11ed
2 changed files with 16 additions and 0 deletions

View File

@ -41,3 +41,18 @@ javadoc {
options.links subproject.javadoc.options.links.toArray(new String[0])
}
}
task jacocoMerge(type: JacocoMerge) {
destinationFile = file("${buildDir}/jacoco/test.exec")
executionData = files(rootProject.subprojects.jacocoTestReport.executionData)
.minus(files("${buildDir}/jacoco/test.exec"))
.filter { f -> f.exists() }
}
jacocoTestReport {
dependsOn(jacocoMerge)
additionalSourceDirs = files(rootProject.subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(rootProject.subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(rootProject.subprojects.sourceSets.main.output)
}

View File

@ -15,6 +15,7 @@ subprojects {
apply plugin: "idea"
apply plugin: "osdetector"
apply plugin: "signing"
apply plugin: "jacoco"
group = "io.grpc"
version = "0.1.0-SNAPSHOT"