Skip to content

Commit

Permalink
Enable configuration caching and fix testkit jacoco aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
ogolberg authored Sep 7, 2023
1 parent c3ab04e commit 1d68cea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
kotlin.code.style=official
org.gradle.caching=true
#org.gradle.configuration-cache=true
18 changes: 17 additions & 1 deletion plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,24 @@ tasks {
val jacoco = project.zipTree(configurations.getByName("jacocoAgent").asPath).filter {
it.name == "jacocoagent.jar"
}.singleFile
val destfile = layout.buildDirectory.file("jacoco/test.exec").get()

val destfile = layout.buildDirectory.file("jacoco/testkit.exec").get()
// declare an additional jacoco output file so that the JUnit JVM and the TestKit JVM
// do not try to write to the same file
outputs.file(destfile).withPropertyName("testkit-jacoco")

systemProperty("testkit-javaagent", "$jacoco=destfile=$destfile")

// add the TestKit jacoco file to outgoing artifacts so that it can be aggregated
configurations.getAt("coverageDataElementsForTest").outgoing.artifact(destfile) {
type = ArtifactTypeDefinition.BINARY_DATA_TYPE
builtBy("test")
}
}

jacocoTestReport {
// add the TestKit jacoco file to the local jacoco report
this.executionData.from(layout.buildDirectory.dir("jacoco").map { files("test.exec", "testkit.exec") })
}
}

Expand Down

0 comments on commit 1d68cea

Please sign in to comment.