Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Android compilations in aggregation #655

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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