diff --git a/buildSrc/src/main/kotlin/kover-conventions.gradle.kts b/buildSrc/src/main/kotlin/kover-conventions.gradle.kts index 052e2bb684..e9490f1ee0 100644 --- a/buildSrc/src/main/kotlin/kover-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/kover-conventions.gradle.kts @@ -4,7 +4,6 @@ import kotlinx.kover.tasks.* /* * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ -apply(plugin = "kover") val notCovered = sourceless + internal + unpublished @@ -14,41 +13,43 @@ val expectedCoverage = mutableMapOf( "kotlinx-coroutines-javafx" to 39, // JavaFx is not tested on TC because its graphic subsystem cannot be initialized in headless mode // Reactor has lower coverage in general due to various fatal error handling features - "kotlinx-coroutines-reactor" to 75) - -extensions.configure { - disabledProjects = notCovered - /* - * Is explicitly enabled on TC in a separate build step. - * Examples: - * ./gradlew :p:check -- doesn't verify coverage - * ./gradlew :p:check -Pkover.enabled=true -- verifies coverage - * ./gradlew :p:koverReport -Pkover.enabled=true -- generates report - */ - isDisabled = !(properties["kover.enabled"]?.toString()?.toBoolean() ?: false) - // TODO remove when updating Kover to version 0.5.x - intellijEngineVersion.set("1.0.657") -} + "kotlinx-coroutines-reactor" to 75 +) + + subprojects { val projectName = name if (projectName in notCovered) return@subprojects - tasks.withType { - rule { - bound { - /* - * 85 is our baseline that we aim to raise to 90+. - * Missing coverage is typically due to bugs in the agent - * (e.g. signatures deprecated with an error are counted), - * sometimes it's various diagnostic `toString` or `catch` for OOMs/VerificationErrors, - * but some places are definitely worth visiting. - */ - minValue = expectedCoverage[projectName] ?: 85 // COVERED_LINES_PERCENTAGE + apply(plugin = "kover") + + extensions.configure { + /* + * Is explicitly enabled on TC in a separate build step. + * Examples: + * ./gradlew :p:check -- doesn't verify coverage + * ./gradlew :p:check -Pkover.enabled=true -- verifies coverage + * ./gradlew :p:koverReport -Pkover.enabled=true -- generates report + */ + isDisabled.set(!(properties["kover.enabled"]?.toString()?.toBoolean() ?: false)) + + verify { + rule { + bound { + /* + * 85 is our baseline that we aim to raise to 90+. + * Missing coverage is typically due to bugs in the agent + * (e.g. signatures deprecated with an error are counted), + * sometimes it's various diagnostic `toString` or `catch` for OOMs/VerificationErrors, + * but some places are definitely worth visiting. + */ + minValue = expectedCoverage[projectName] ?: 85 // COVERED_LINES_PERCENTAGE + } } } - } - tasks.withType { - htmlReportDir.set(file(rootProject.buildDir.toString() + "/kover/" + project.name + "/html")) + htmlReport { + reportDir.set(file(rootProject.buildDir.toString() + "/kover/" + project.name + "/html")) + } } } diff --git a/gradle.properties b/gradle.properties index 308588ff72..755517a7ef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,7 +23,7 @@ rxjava3_version=3.0.2 javafx_version=11.0.2 javafx_plugin_version=0.0.8 binary_compatibility_validator_version=0.11.0 -kover_version=0.5.0 +kover_version=0.6.0-Beta blockhound_version=1.0.2.RELEASE jna_version=5.9.0 diff --git a/reactive/kotlinx-coroutines-reactive/build.gradle.kts b/reactive/kotlinx-coroutines-reactive/build.gradle.kts index c2e4b5c9f0..3f2ba6b829 100644 --- a/reactive/kotlinx-coroutines-reactive/build.gradle.kts +++ b/reactive/kotlinx-coroutines-reactive/build.gradle.kts @@ -41,10 +41,10 @@ val commonKoverExcludes = listOf( "kotlinx.coroutines.reactive.ConvertKt" // Deprecated ) -tasks.koverHtmlReport { - excludes = commonKoverExcludes -} - -tasks.koverVerify { - excludes = commonKoverExcludes +kover { + filters { + classes { + excludes += commonKoverExcludes + } + } } diff --git a/reactive/kotlinx-coroutines-reactor/build.gradle.kts b/reactive/kotlinx-coroutines-reactor/build.gradle.kts index d4bb135f73..a90b3cbd3c 100644 --- a/reactive/kotlinx-coroutines-reactor/build.gradle.kts +++ b/reactive/kotlinx-coroutines-reactor/build.gradle.kts @@ -33,10 +33,10 @@ val commonKoverExcludes = listOf( "kotlinx.coroutines.reactor.ConvertKt\$asFlux$1" // Deprecated ) -tasks.koverHtmlReport { - excludes = commonKoverExcludes -} - -tasks.koverVerify { - excludes = commonKoverExcludes +kover { + filters { + classes { + excludes += commonKoverExcludes + } + } } diff --git a/ui/kotlinx-coroutines-android/build.gradle.kts b/ui/kotlinx-coroutines-android/build.gradle.kts index 7618c529f7..b5c9c0cf5d 100644 --- a/ui/kotlinx-coroutines-android/build.gradle.kts +++ b/ui/kotlinx-coroutines-android/build.gradle.kts @@ -115,6 +115,6 @@ open class RunR8 : JavaExec() { tasks.withType { extensions.configure { - excludes = excludes + listOf("com.android.*", "android.*") // Exclude robolectric-generated classes + excludes.addAll(listOf("com.android.*", "android.*")) // Exclude robolectric-generated classes } }