Skip to content

Commit

Permalink
Added jacoco jvmTestCoverage task
Browse files Browse the repository at this point in the history
It has the following limitations:

* Jacoco does not properly understand Kotlin inline classes and they
  are not considered to be covered. See:
  jacoco/jacoco#654
* Jacoco does not support Kotlin's convention for omitting common
  package prefix in source files, so it cannot find the corresponding
  source files and does not provide navigation to them.
  • Loading branch information
elizarov committed Aug 27, 2019
1 parent a730f25 commit d1deb71
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions kotlinx-coroutines-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

plugins {
id 'jacoco'
}

apply plugin: 'kotlin-multiplatform'
apply from: rootProject.file("gradle/targets.gradle")
apply from: rootProject.file("gradle/compile-jvm-multiplatform.gradle")
Expand Down Expand Up @@ -40,6 +44,21 @@ kotlin {
}
}
}

// this is needed for Jacoco
jvm {
withJava()
}
}

task jvmTestCoverage(type: JacocoReport, dependsOn: jvmTest) {
group = "verification"
executionData jvmTest
setClassDirectories(files("$buildDir/classes/kotlin/jvm/main"))
setSourceDirectories(files(["$projectDir/common/src", "$projectDir/jvm/src"]))
reports {
html.destination "$buildDir/reports/jacoco/jvmTest"
}
}

kotlin.sourceSets {
Expand Down

0 comments on commit d1deb71

Please sign in to comment.