Skip to content

Commit

Permalink
Generate aggregate coverage report and import it into Sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
Godin authored Oct 23, 2024
1 parent 6cf2db2 commit c60ff8f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 6 additions & 0 deletions sonar-kotlin-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<JacocoReport>("testCodeCoverageReport"))
}

0 comments on commit c60ff8f

Please sign in to comment.