Fix merging of JaCoCo reports

This commit is contained in:
Gary Tierney
2018-08-27 02:06:04 +01:00
parent b1a687be34
commit 0f009882af
+32 -35
View File
@@ -1,4 +1,4 @@
apply plugin: 'jacoco'
apply plugin: "jacoco"
def jacocoCoverageAggregate = "$buildDir/jacoco/jacocoTestAll.exec"
@@ -6,46 +6,43 @@ def testedProjects() {
subprojects.findAll { subproject -> subproject.plugins.hasPlugin('java') || subproject.plugins.hasPlugin('kotlin') }
}
configure(testedProjects()) {
jacoco {
toolVersion = '0.8.1'
}
jacocoTestReport {
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
}
test {
reports {
junitXml.enabled = true
html.enabled = false
}
gradle.projectsEvaluated {
configure(testedProjects()) {
apply plugin: "jacoco"
jacoco {
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpDir = file("$buildDir/jacoco/classpathdumps")
toolVersion = '0.8.1'
}
test {
reports {
junitXml.enabled = true
html.enabled = false
}
jacoco {
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpDir = file("$buildDir/jacoco/classpathdumps")
}
}
}
}
task jacocoMerge(type: JacocoMerge) {
destinationFile = file(jacocoCoverageAggregate)
executionData = project.fileTree(dir: '.', include: '**/build/jacoco/test.exec')
}
sonarqube {
properties {
property "sonar.organization", "apollo-rsps"
property "sonar.projectKey", "apollo:org.apollo"
property "sonar.projectName", "Apollo RSPS"
property "sonar.kotlin.file.suffixes", ".kt,.kts"
property "sonar.jacoco.reportPaths", jacocoCoverageAggregate
task jacocoMerge(type: JacocoMerge) {
destinationFile = file(jacocoCoverageAggregate)
executionData = project.fileTree(dir: '.', include: '**/build/jacoco/jacocoTest.exec')
}
sonarqube {
properties {
property "sonar.organization", "apollo-rsps"
property "sonar.projectKey", "apollo:org.apollo"
property "sonar.projectName", "Apollo RSPS"
property "sonar.kotlin.file.suffixes", ".kt,.kts"
property "sonar.jacoco.reportPaths", jacocoCoverageAggregate
}
}
tasks["sonarqube"].dependsOn(jacocoMerge)
}
tasks["sonarqube"].dependsOn(jacocoMerge)