Kotlin / kotlinx-kover

Apache License 2.0
1.28k stars 48 forks source link

Kover 0.7.5 breaks with merging #514

Closed r4phab closed 6 months ago

r4phab commented 6 months ago

Describe the bug A clear and concise description of what the bug is. I have multiple modules, some are JVM only (domain) and others and Android modules. With the latest version 0.7.5 the reports merging with JVM and Android modules is broken. Worked fine in 0.7.3

Errors If present, stacktraces or files from build/kover/errors directory

Execution failed for task ':app:koverGenerateArtifact'.

> Failed to notify dependency resolution listener.

   > Kover android variant 'prodRelease' was not matched with any variant from dependency ':domain' of project ':app'. Check that the Kover plugin is applied in the ':domain' project and there is a variant compatible with 'prodRelease' in it.

Expected behavior Skip the mergedWith instruction if not found in the JVM module ?

Reproducer A link to your project, if it is open source. Otherwise, please try to reproduce the problem on a small project. If this is not feasible, give an example of the code on which the problem manifests itself.

Reports If applicable, report files or screenshots.

Environment

koverReport { filters { excludes { classes(koverExcludes) annotatedBy(*koverAnnotationsExcludes) } } defaults { mergeWith("prodRelease")

    xml {
        onCheck = false
        setReportFile(layout.buildDirectory.file("reports/kover/xml/result.xml"))
    }

    html {
        onCheck = false
        setReportDir(layout.buildDirectory.dir("reports/kover/html"))
    }
}

}

shanshin commented 6 months ago

Hi, in version 0.7.5, an additional configuration correctness check was added, so now an error is displayed indicating that the configuration is incorrect.

The uncontrolled using of mergeWith can lead to unexpected consequences, optionality feature will be implemented in the next version of DSL.

Now you can use the steps described in this comment to specify a more correct configuration.

r4phab commented 6 months ago

@shanshin Indeed we updated our configuration following the comment you mentioned and it works now ! Thank you very much for guiding us in the right direction 🥳