build: Aggregated test reports for main modules

This commit is contained in:
2026-04-20 12:57:26 +02:00
parent 52e2a52468
commit cd7ac288d4

View File

@@ -1,4 +1,5 @@
plugins { plugins {
`test-report-aggregation`
`jacoco-report-aggregation` `jacoco-report-aggregation`
`maven-publish` `maven-publish`
id("de.siphalor.tweed5.root-properties") id("de.siphalor.tweed5.root-properties")
@@ -7,9 +8,23 @@ plugins {
group = "de.siphalor.tweed5" group = "de.siphalor.tweed5"
version = project.property("tweed5.version").toString() version = project.property("tweed5.version").toString()
configurations.aggregateTestReportResults {
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.VERIFICATION))
attribute(VerificationType.VERIFICATION_TYPE_ATTRIBUTE, objects.named(VerificationType.TEST_RESULTS))
}
}
configurations.aggregateCodeCoverageReportResults {
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.VERIFICATION))
attribute(VerificationType.VERIFICATION_TYPE_ATTRIBUTE, objects.named(VerificationType.JACOCO_RESULTS))
}
}
dependencies { dependencies {
rootProject.subprojects.forEach { subproject -> rootProject.subprojects.forEach { subproject ->
subproject.plugins.withId("jacoco") { if (subproject.name.startsWith("tweed5-")) {
testReportAggregation(project(subproject.path))
jacocoAggregation(project(subproject.path)) jacocoAggregation(project(subproject.path))
} }
} }
@@ -17,8 +32,18 @@ dependencies {
reporting { reporting {
reports { reports {
val aggregatedTestReport by creating(AggregateTestReport::class) {
testSuiteName = "test"
}
val aggregatedCoverageReport by creating(JacocoCoverageReport::class) { val aggregatedCoverageReport by creating(JacocoCoverageReport::class) {
testSuiteName = "test" testSuiteName = "test"
} }
} }
} }
tasks.register("test") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Runs all tests"
subprojects.mapNotNull { it.tasks.findByName("test") }.forEach { dependsOn(it) }
finalizedBy(tasks.named("aggregatedTestReport"), tasks.named("aggregatedCoverageReport"))
}