summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-05-06 16:41:53 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-05-18 15:21:32 +0200
commit0f7e0bdbec732b23141f6bbe11b3b2299ca22813 (patch)
treeca8d6a7c949d68190b63b461da205fe4e6adf6e0
parentcc9310efad6177909ff2f7415384d7c393383106 (diff)
build: Update Jacoco to version 0.8.7
This change updates the Gradle build configuration to use Jacoco 0.8.7, which is necessary for Kotlin 1.5.0 to work nicely with Jacoco.
-rw-r--r--buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts7
-rw-r--r--buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts38
2 files changed, 12 insertions, 33 deletions
diff --git a/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts b/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts
index 3e8aa741..1ea5de4c 100644
--- a/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts
+++ b/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts
@@ -1,3 +1,5 @@
+import gradle.kotlin.dsl.accessors._a850a9ab866951e91ee43960bbc39582.jacoco
+
/*
* MIT License
*
@@ -32,6 +34,11 @@ repositories {
mavenCentral()
}
+jacoco {
+ // Necessary for Kotlin 1.5.0. See https://github.com/jacoco/jacoco/issues/1155
+ toolVersion = "0.8.7"
+}
+
tasks.register<JacocoReport>("codeCoverageReport") {
group = "Coverage reports"
description = "Generates an aggregate report based on all subprojects"
diff --git a/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts b/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts
index d0534d4f..5c7aea83 100644
--- a/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts
+++ b/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts
@@ -25,41 +25,13 @@ plugins {
jacoco
}
+jacoco {
+ // Necessary for Kotlin 1.5.0. See https://github.com/jacoco/jacoco/issues/1155
+ toolVersion = "0.8.7"
+}
+
tasks.jacocoTestReport {
reports {
html.isEnabled = true
}
}
-
-/* Share sources folder with other projects for aggregated JaCoCo reports */
-configurations.create("transitiveSourcesElements") {
- isVisible = false
- isCanBeResolved = false
- isCanBeConsumed = true
- extendsFrom(configurations.implementation.get())
- attributes {
- attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
- attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
- attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named("source-folders"))
- }
- sourceSets.main.get().java.srcDirs.forEach {
- outgoing.artifact(it)
- }
-}
-
-/* Share the coverage data to be aggregated for the whole product */
-configurations.create("coverageDataElements") {
- isVisible = false
- isCanBeResolved = false
- isCanBeConsumed = true
- extendsFrom(configurations.implementation.get())
- attributes {
- attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
- attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
- attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named("jacoco-coverage-data"))
- }
- // This will cause the test task to run if the coverage data is requested by the aggregation task
- outgoing.artifact(tasks.test.map { task ->
- task.extensions.getByType<JacocoTaskExtension>().destinationFile!!
- })
-}