Skip to content

Commit

Permalink
Merge reports manually after tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Thijsiez committed Nov 26, 2023
1 parent d641292 commit a8755ca
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
33 changes: 27 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@

plugins {
kotlin("jvm")
jacoco
id("org.sonarqube")
}

dependencies {
implementation(project(":library"))
implementation(project(":examples"))
jacoco
}

allprojects {
Expand All @@ -49,8 +44,10 @@ configure(subprojects) {
}

tasks.jacocoTestReport {
dependsOn(tasks.test)
finalizedBy(tasks.jacocoTestCoverageVerification)
reports {
html.required = true
xml.required = true
}
}
Expand All @@ -64,6 +61,30 @@ configure(subprojects) {
}
}

val mergeReportsTaskName = "merged"
tasks.register<JacocoReport>(mergeReportsTaskName) {
dependsOn(project(":library").tasks.jacocoTestReport)
dependsOn(project(":examples").tasks.jacocoTestReport)

executionData.setFrom(
fileTree(project.layout.projectDirectory)
.apply { include("**/jacoco/*.exec") }
)
sourceSets(
project(":library").sourceSets["main"],
project(":examples").sourceSets["main"]
)

reports {
html.required = true
xml.required = true
}
}
tasks.test {
useJUnitPlatform()
finalizedBy(tasks[mergeReportsTaskName])
}

project.afterEvaluate {
getTasksByName("quarkusGenerateCode", true).forEach { task ->
task.setDependsOn(task.dependsOn.filterIsInstance<Provider<Task>>()
Expand Down
2 changes: 1 addition & 1 deletion examples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ ksp {
}

tasks.jacocoTestReport {
sourceSets(project(":library").sourceSets.getByName("main"))
sourceSets(project(":library").sourceSets["main"])
}

0 comments on commit a8755ca

Please sign in to comment.