Skip to content

Commit

Permalink
Include Android compilations in aggregation
Browse files Browse the repository at this point in the history
PR #655
  • Loading branch information
ephemient authored Jul 15, 2024
1 parent 82a65bc commit d837e39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ package kotlinx.kover.gradle.aggregation.commons.names

internal object PluginId {
const val KOTLIN_JVM_PLUGIN_ID = "org.jetbrains.kotlin.jvm"
const val KOTLIN_ANDROID_PLUGIN_ID = "org.jetbrains.kotlin.android"
const val KOTLIN_MULTIPLATFORM_PLUGIN_ID = "org.jetbrains.kotlin.multiplatform"
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ internal class KoverProjectGradlePlugin : Plugin<Project> {

val compilations = project.layout.buildDirectory.map {
val compilations = when {
pluginManager.hasPlugin(KOTLIN_JVM_PLUGIN_ID) -> {
pluginManager.hasPlugin(KOTLIN_JVM_PLUGIN_ID) || pluginManager.hasPlugin(KOTLIN_ANDROID_PLUGIN_ID) -> {
val kotlin = exts.findByName("kotlin")?.bean()
?: throw KoverCriticalException("Kotlin JVM extension not found")
kotlin["target"]["compilations"].sequence()
Expand All @@ -100,7 +100,7 @@ internal class KoverProjectGradlePlugin : Plugin<Project> {

compilations.filter { compilation ->
val compilationName = compilation["name"].value<String>()
if (compilationName == "test") return@filter false
if (compilationName == "test" || compilationName.endsWith("Test")) return@filter false

val taskPath = projectPath + (if (projectPath == Project.PATH_SEPARATOR) "" else Project.PATH_SEPARATOR) + compilation["compileTaskProvider"]["name"].value<String>()
taskGraph.hasTask(taskPath)
Expand Down

0 comments on commit d837e39

Please sign in to comment.