Kotlin/kotlinx-kover

Multiplatform: Task '<module1>:koverXmlReport' uses this output of task '<module2>:desktopTest' without declaring an explicit or implicit dependency

realdadfish opened this issue · 2 comments

I'm using Kover 0.8.1 in a multiplatform multi-module environment like so:

afterEvaluate {
    kover {
        reports {
            filters {
                excludes {
                    annotatedBy("*Generated*")
                }
            }

            verify {
                rule {
                    minBound(80)
                    maxBound(90)
                }
            }
        }
    }
}

The multiplatform project is configured to use a JVM ("desktop") and Android target:

fun configureMultiplatform(project: Project) {
    project.plugins.apply("org.jetbrains.kotlin.plugin.compose")
    project.plugins.apply("org.jetbrains.compose")
    project.plugins.apply("com.google.devtools.ksp")

    configure<KotlinMultiplatformExtension> {
        jvm("desktop")
        androidTarget()

        sourceSets {
            val commonMain by getting
            val commonTest by getting

            // if the compose plugin is applied, the compiler also always requests a runtime to be present
            // refactor to use accessors when they become available (https://github.com/gradle/gradle/issues/15383)
            project.extensions.getByType(VersionCatalogsExtension::class.java).find("libs").ifPresent { libs ->
                val composeBom = libs.findLibrary("androidx.compose.bom").get()
                val composeRuntime = libs.findLibrary("androidx.compose.runtime").get()
                commonMain.dependencies {
                    compileOnly(project.dependencies.platform(composeBom))
                    compileOnly(composeRuntime)
                }
                commonTest.dependencies {
                    compileOnly(project.dependencies.platform(composeBom))
                    compileOnly(composeRuntime)
                }
            }
        }
    }

    // ...
}

and there are library and app modules set up that depend on one another.

When then

./gradlew test koverVerify koverXmlReport

is executed, the build fails with

[2024-07-03T12:43:05.700Z] FAILURE: Build failed with an exception.
[2024-07-03T12:43:05.700Z] 
[2024-07-03T12:43:05.700Z] * What went wrong:
[2024-07-03T12:43:05.700Z] Some problems were found with the configuration of task ':inbound-domain:koverXmlReport' (type 'KoverXmlTask').
[2024-07-03T12:43:05.700Z]   - Gradle detected a problem with the following location: '/home/jenkins/workspace/droid-monorepo_inboundend_PR-296/inboundend/inbound-data/build/kover/bin-reports/desktopTest.ic'.
[2024-07-03T12:43:05.700Z]     
[2024-07-03T12:43:05.700Z]     Reason: Task ':inbound-domain:koverXmlReport' uses this output of task ':inbound-data:desktopTest' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
[2024-07-03T12:43:05.700Z]     
[2024-07-03T12:43:05.700Z]     Possible solutions:
[2024-07-03T12:43:05.700Z]       1. Declare task ':inbound-data:desktopTest' as an input of ':inbound-domain:koverXmlReport'.
[2024-07-03T12:43:05.701Z]       2. Declare an explicit dependency on ':inbound-data:desktopTest' from ':inbound-domain:koverXmlReport' using Task#dependsOn.
[2024-07-03T12:43:05.701Z]       3. Declare an explicit dependency on ':inbound-data:desktopTest' from ':inbound-domain:koverXmlReport' using Task#mustRunAfter.
[2024-07-03T12:43:05.701Z]     
[2024-07-03T12:43:05.701Z]     For more information, please refer to https://docs.gradle.org/8.9-rc-1/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
[2024-07-03T12:43:05.701Z]   - Gradle detected a problem with the following location: '/home/jenkins/workspace/droid-monorepo_inboundend_PR-296/inboundend/inbound-data/build/generated/compose/resourceGenerator/kotlin/desktopMainResourceAccessors'.
[2024-07-03T12:43:05.701Z]     
[2024-07-03T12:43:05.701Z]     Reason: Task ':inbound-domain:koverXmlReport' uses this output of task ':inbound-data:generateResourceAccessorsForDesktopMain' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
[2024-07-03T12:43:05.701Z]     
[2024-07-03T12:43:05.701Z]     Possible solutions:
[2024-07-03T12:43:05.701Z]       1. Declare task ':inbound-data:generateResourceAccessorsForDesktopMain' as an input of ':inbound-domain:koverXmlReport'.
[2024-07-03T12:43:05.701Z]       2. Declare an explicit dependency on ':inbound-data:generateResourceAccessorsForDesktopMain' from ':inbound-domain:koverXmlReport' using Task#dependsOn.
[2024-07-03T12:43:05.701Z]       3. Declare an explicit dependency on ':inbound-data:generateResourceAccessorsForDesktopMain' from ':inbound-domain:koverXmlReport' using Task#mustRunAfter.
[2024-07-03T12:43:05.701Z]     
[2024-07-03T12:43:05.701Z]     For more information, please refer to https://docs.gradle.org/8.9-rc-1/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
[2024-07-03T12:43:05.701Z]   - Gradle detected a problem with the following location: '/home/jenkins/workspace/droid-monorepo_inboundend_PR-296/inboundend/inbound-data/build/generated/compose/resourceGenerator/kotlin/commonResClass'.
[2024-07-03T12:43:05.701Z]     
[2024-07-03T12:43:05.701Z]     Reason: Task ':inbound-domain:koverXmlReport' uses this output of task ':inbound-data:generateComposeResClass' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
[2024-07-03T12:43:05.701Z]     
[2024-07-03T12:43:05.701Z]     Possible solutions:
[2024-07-03T12:43:05.701Z]       1. Declare task ':inbound-data:generateComposeResClass' as an input of ':inbound-domain:koverXmlReport'.
[2024-07-03T12:43:05.701Z]       2. Declare an explicit dependency on ':inbound-data:generateComposeResClass' from ':inbound-domain:koverXmlReport' using Task#dependsOn.
[2024-07-03T12:43:05.701Z]       3. Declare an explicit dependency on ':inbound-data:generateComposeResClass' from ':inbound-domain:koverXmlReport' using Task#mustRunAfter.
[2024-07-03T12:43:05.701Z]     
[2024-07-03T12:43:05.701Z]     For more information, please refer to https://docs.gradle.org/8.9-rc-1/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
[2024-07-03T12:43:05.701Z]   - Gradle detected a problem with the following location: '/home/jenkins/workspace/droid-monorepo_inboundend_PR-296/inboundend/inbound-data/build/generated/compose/resourceGenerator/kotlin/commonMainResourceAccessors'.
[2024-07-03T12:43:05.701Z]     
[2024-07-03T12:43:05.701Z]     Reason: Task ':inbound-domain:koverXmlReport' uses this output of task ':inbound-data:generateResourceAccessorsForCommonMain' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
[2024-07-03T12:43:05.701Z]     
[2024-07-03T12:43:05.701Z]     Possible solutions:
[2024-07-03T12:43:05.701Z]       1. Declare task ':inbound-data:generateResourceAccessorsForCommonMain' as an input of ':inbound-domain:koverXmlReport'.
[2024-07-03T12:43:05.701Z]       2. Declare an explicit dependency on ':inbound-data:generateResourceAccessorsForCommonMain' from ':inbound-domain:koverXmlReport' using Task#dependsOn.
[2024-07-03T12:43:05.701Z]       3. Declare an explicit dependency on ':inbound-data:generateResourceAccessorsForCommonMain' from ':inbound-domain:koverXmlReport' using Task#mustRunAfter.
[2024-07-03T12:43:05.701Z]     
[2024-07-03T12:43:05.701Z]     For more information, please refer to https://docs.gradle.org/8.9-rc-1/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
[2024-07-03T12:43:05.701Z] 
[2024-07-03T12:43:05.701Z] * Try:
[2024-07-03T12:43:05.701Z] > Run with --stacktrace option to get the stack trace.
[2024-07-03T12:43:05.701Z] > Run with --info or --debug option to get more log output.
[2024-07-03T12:43:05.701Z] > Run with --scan to get full insights.
[2024-07-03T12:43:05.701Z] > Get more help at https://help.gradle.org.

Hi,
have you tried the 0.8.2 version?

Perhaps the same problem as in #633

Yes, indeed, 0.8.2 fixed it. Thanks for the quick response and sorry for the duplicate!