Kotlin / kotlinx-kover

Apache License 2.0
1.37k stars 53 forks source link

Android 'debug' variant not found in KMM + Android project #388

Closed alvr closed 1 year ago

alvr commented 1 year ago

Describe the bug When applying the plugin to the root project and specified subprojects, and using mergeWith in the default configuration, it throws and exception that the 'debug' Android variant was not found. Kover executes the tests that are in jvmTest source set (no commonTest yet), I suppose that when using mergeWith with the Android variant will execute also the tests in androidTest and commonTest.

Errors Android build variant 'debug' was not found - it is impossible to add it to the default report

Expected behavior Include the debug variant of Android in a KMM project.

Reproducer The configuration of Kover is here, and the only variants the project has are 'debug', 'beta' and 'release'. The full project is in feature/kmm/stable.

Environment

sabufung30 commented 1 year ago

It looks like a duplicate of https://github.com/Kotlin/kotlinx-kover/issues/362 Is there any workaround by the moment ? @shanshin

alvr commented 1 year ago

I saw that issue and tried to put all the Project.configure() inside afterEvalute and I get the same error.

shanshin commented 1 year ago

It looks like a duplicate of #362

Yes, most likely a duplicate

Is there any workaround by the moment ?

@alvr, @sabufung30, сould you change the configuration so that the kover plugin is applied only after the android plugin?

In this case, the Android plugin will create build variants before the Kover plugin starts searching for them.

sabufung30 commented 1 year ago

@shanshin @alvr I have put the configuration from subprojects into every single build.gradle.kts and it works. Build variants is not created when evaluating the configuration from subprojects

shanshin commented 1 year ago

@sabufung30 the order of applying of plugins is important. By moving the configuration from subprojects, you most likely changed the order and the Kover plugin started being applied after Android Gradle Plugin. This is one of the solutions.

shanshin commented 1 year ago

Closing as a duplicate. Follow the progress in correcting the error in the #362 task.