From d7b49857a4f881342392d6926205a14ca9d42875 Mon Sep 17 00:00:00 2001 From: Dimitris ZARRAS Date: Wed, 28 Feb 2024 16:51:35 +0200 Subject: [PATCH] Configure jacoco test report generation. --- build.gradle.kts | 19 +++++++++++++++++++ gradle.properties | 6 +++++- gradle/libs.versions.toml | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 04374cac..50d88401 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,6 +11,7 @@ plugins { alias(libs.plugins.kotlin.plugin.spring) alias(libs.plugins.kotlin.plugin.serialization) alias(libs.plugins.spotless) + jacoco } repositories { @@ -61,6 +62,20 @@ tasks.withType().configureEach { } } +tasks.test { + finalizedBy(tasks.jacocoTestReport) +} + +tasks.jacocoTestReport { + dependsOn(tasks.test) + + reports { + xml.required = true + csv.required = true + html.required = true + } +} + testing { suites { val test by getting(JvmTestSuite::class) { @@ -69,6 +84,10 @@ testing { } } +jacoco { + toolVersion = libs.versions.jacoco.get() +} + springBoot { buildInfo() } diff --git a/gradle.properties b/gradle.properties index 74597b95..05a0bd02 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,4 +2,8 @@ group=eu.europa.ec.eudi version=0.2.0-SNAPSHOT kotlin.code.style=official -org.gradle.parallel=true \ No newline at end of file +org.gradle.parallel=true + +# Sonar +systemProp.sonar.gradle.skipCompile=true +systemProp.sonar.host.url=https://sonarcloud.io diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 336df907..57522649 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ presentationExchange = "0.2.0-SNAPSHOT" ktlintVersion = "0.50.0" bouncyCastle = "1.77" arrow = "1.2.1" - +jacoco = "0.8.11" [libraries] kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }