diff --git a/build.gradle.kts b/build.gradle.kts index e5c29accf..29ec8e262 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -232,6 +232,18 @@ sonarqube { } } +subprojects { + sonarqube.properties { + property( + "sonar.coverage.jacoco.xmlReportPaths", + listOf( + "build/reports/jacoco/test/jacocoTestReport.xml", + "${project.rootDir}/sonar-kotlin-plugin/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml" + ).joinToString(",") + ) + } +} + artifactory { clientConfig.info.buildName = "sonar-kotlin" clientConfig.info.buildNumber = System.getenv("BUILD_NUMBER") diff --git a/sonar-kotlin-plugin/build.gradle.kts b/sonar-kotlin-plugin/build.gradle.kts index 8ff637266..a97d70e1d 100644 --- a/sonar-kotlin-plugin/build.gradle.kts +++ b/sonar-kotlin-plugin/build.gradle.kts @@ -6,6 +6,7 @@ import java.util.jar.JarInputStream plugins { id("com.gradleup.shadow") version "8.3.1" kotlin("jvm") + id("jacoco-report-aggregation") } dependencies { @@ -141,3 +142,8 @@ fun checkJarEntriesPathUniqueness(file: File) { throw GradleException("Duplicated entries in the jar: '${file.path}': ${duplicatedNames.joinToString(", ")}") } } + +tasks.check { + // Generate aggregate coverage report + dependsOn(tasks.named("testCodeCoverageReport")) +}