Closed henriquenfaria closed 5 years ago
I don't know. Have you tried? If not it's something we can add.
It didn't work out of the box. I made some progress by adding org.jetbrains.kotlin.multiplatform
check in the isKotlinAndroid
method:
protected static boolean isKotlinAndroid(final Project project) {
final boolean isKotlinAndroidProject = project.plugins.hasPlugin('org.jetbrains.kotlin.android')
final boolean isKotlinMultiplatform = project.plugins.hasPlugin('org.jetbrains.kotlin.multiplatform')
return isKotlinAndroidProject || isKotlinMultiplatform
}
After this change, the plugin was able to correctly parse the subproject and generate a sane jacoco report. However, the jacocoTestReportMerged
task isn't working, it generates an empty report in the project root.
I've done all those tests using this code base.
I can create a PR so we can discuss this in there if you prefer.
It didn't work out of the box. I made some progress by adding
org.jetbrains.kotlin.multiplatform
check in theisKotlinAndroid
method:
It should probably be a separate method and then be applied.
However, the
jacocoTestReportMerged
task isn't working, it generates an empty report in the project root.
Also without your changes? If I remember correctly, others have also stated that they've had problems with that task.
I can create a PR so we can discuss this in there if you prefer.
Sure let's get this rolling!
Also without your changes? If I remember correctly, others have also stated that they've had problems with that task.
Yes, just tested it without my changes and it generated an empty report. I guess you are right about it being broken already.
I've just created a PR with my changes.
Thanks for adding support in #141
I'm not sure if it is the right place to ask it, but some of you people had used this plugin in a Kotlin Multiplatform with JVM Target? On Android Target it applies pretty good, but I'm in some trouble with JVM Targets.
@hugonardo I also had trouble getting this plugin to generate reports for my JVM targets.
The following worked for me:
plugins {
kotlin("multiplatform")
id("com.android.library")
id("com.vanniktech.android.junit.jacoco")
}
tasks.create<JacocoReport>("jacocoTestReport") {
dependsOn("jvmTest")
reports {
csv.isEnabled = false
xml.isEnabled = true
html.isEnabled = true
}
classDirectories.setFrom(file("${buildDir}/classes/kotlin/jvm/main"))
sourceDirectories.setFrom(files("src/commonMain", "src/jvmMain"))
executionData.setFrom(files("${buildDir}/jacoco/jvmTest.exec"))
}
kotlin {
jvm()
android()
sourceSets {
// ...
}
}
Then I generated reports for JVM and Android targets via: ./gradlew jacocoTestReport jacocoTestReportDebug
Does this plugin support multiplatform kotlin projects using the kotlin-multiplatform plugin?