Skip to content

Instantly share code, notes, and snippets.

@luongvo
Created January 3, 2018 17:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luongvo/1b8c2913358362a7f30cfa900ea5d24d to your computer and use it in GitHub Desktop.
Save luongvo/1b8c2913358362a7f30cfa900ea5d24d to your computer and use it in GitHub Desktop.
Aggregated Jacoco reports in a multi-project Gradle build
allprojects {
apply plugin: 'java'
apply plugin: 'jacoco'
repositories {
jcenter()
}
jacoco {
toolVersion = '0.7.1.201405082137'
}
}
subprojects {
dependencies {
testCompile 'junit:junit:4.11'
}
jacocoTestReport {
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
}
}
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment