Skip to content

Commit c60ff8f

Browse files
authored
Generate aggregate coverage report and import it into Sonar
1 parent 6cf2db2 commit c60ff8f

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,18 @@ sonarqube {
232232
}
233233
}
234234

235+
subprojects {
236+
sonarqube.properties {
237+
property(
238+
"sonar.coverage.jacoco.xmlReportPaths",
239+
listOf(
240+
"build/reports/jacoco/test/jacocoTestReport.xml",
241+
"${project.rootDir}/sonar-kotlin-plugin/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"
242+
).joinToString(",")
243+
)
244+
}
245+
}
246+
235247
artifactory {
236248
clientConfig.info.buildName = "sonar-kotlin"
237249
clientConfig.info.buildNumber = System.getenv("BUILD_NUMBER")

sonar-kotlin-plugin/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import java.util.jar.JarInputStream
66
plugins {
77
id("com.gradleup.shadow") version "8.3.1"
88
kotlin("jvm")
9+
id("jacoco-report-aggregation")
910
}
1011

1112
dependencies {
@@ -141,3 +142,8 @@ fun checkJarEntriesPathUniqueness(file: File) {
141142
throw GradleException("Duplicated entries in the jar: '${file.path}': ${duplicatedNames.joinToString(", ")}")
142143
}
143144
}
145+
146+
tasks.check {
147+
// Generate aggregate coverage report
148+
dependsOn(tasks.named<JacocoReport>("testCodeCoverageReport"))
149+
}

0 commit comments

Comments
 (0)