diff options
Diffstat (limited to 'simulator/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts')
| -rw-r--r-- | simulator/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/simulator/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts b/simulator/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts index 8c07fdea..3e8aa741 100644 --- a/simulator/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts +++ b/simulator/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts @@ -32,19 +32,25 @@ repositories { mavenCentral() } -task<JacocoReport>("jacocoTestReport") { +tasks.register<JacocoReport>("codeCoverageReport") { group = "Coverage reports" - description = "Generates an aggregate report from all subprojects" + description = "Generates an aggregate report based on all subprojects" - val jacocoReportTasks = subprojects.map { it.tasks.withType<JacocoReport>() } - dependsOn(jacocoReportTasks) - executionData(jacocoReportTasks) + reports { + xml.isEnabled = true + xml.destination = file("${buildDir}/reports/jacoco/report.xml") - subprojects.forEach { testedProject -> - val sourceSets = testedProject.convention.findPlugin(JavaPluginConvention::class)?.sourceSets ?: return@forEach + html.isEnabled = true + } - this@task.additionalSourceDirs.from(sourceSets["main"].allSource.srcDirs) - this@task.sourceDirectories.from(sourceSets["main"].allSource.srcDirs) - this@task.classDirectories.from(sourceSets["main"].output) + subprojects { + this@subprojects.plugins.withType<JacocoPlugin>().configureEach { + this@subprojects.tasks.matching { + it.extensions.findByType<JacocoTaskExtension>() != null } + .configureEach { + sourceSets(this@subprojects.the<SourceSetContainer>().named("main").get()) + executionData(this) + } + } } } |
