From 6d7f683a2c1b1823c8cf99e304a1f569eaaff76a Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 21 Apr 2022 17:12:34 +0200 Subject: build: Include Quarkus tests in aggregated JaCoCo test report This change fixes an issue where the results of the Quarkus tests where not included in the aggregated JaCoCo test report, due to it not using the official Gradle JaCoCo plugin. This change defines a new configuration that exposes the execution data generated by Quarkus to the aggregation plugin. --- opendc-web/opendc-web-api/build.gradle.kts | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'opendc-web') diff --git a/opendc-web/opendc-web-api/build.gradle.kts b/opendc-web/opendc-web-api/build.gradle.kts index f6ae730d..503e0a5b 100644 --- a/opendc-web/opendc-web-api/build.gradle.kts +++ b/opendc-web/opendc-web-api/build.gradle.kts @@ -28,7 +28,6 @@ plugins { kotlin("plugin.allopen") kotlin("plugin.jpa") `testing-conventions` - `jacoco-conventions` id("io.quarkus") } @@ -77,9 +76,26 @@ tasks.quarkusDev { workingDir = rootProject.projectDir.toString() } -tasks.test { - extensions.configure(JacocoTaskExtension::class) { - excludeClassLoaders = listOf("*QuarkusClassLoader") +/* Make sure the jacoco-report-aggregation plugin picks up the Quarkus coverage data */ +configurations.create("coverageDataElementsForQuarkus") { + isVisible = false + isCanBeResolved = false + isCanBeConsumed = true + + extendsFrom(configurations["implementation"], configurations["runtimeOnly"]) + + @Suppress("UnstableApiUsage") + attributes { + attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category::class.java, Category.VERIFICATION)) + attribute(VerificationType.VERIFICATION_TYPE_ATTRIBUTE, objects.named(VerificationType::class.java, VerificationType.JACOCO_RESULTS)) + } + + artifacts { + add("coverageDataElementsForQuarkus", layout.buildDirectory.file("jacoco-quarkus.exec")) { + @Suppress("UnstableApiUsage") + type = ArtifactTypeDefinition.BINARY_DATA_TYPE + builtBy(tasks.test) + } } } -- cgit v1.2.3