-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Describe the bug
This code eagerly evaluates applicationVariants
/libraryVariants
in Android projects, and the result is that they have empty variants if the plugin is applied before the android variants are set up and the kover report task will be skipped due to no inputs.
kotlinx-kover/src/main/kotlin/kotlinx/kover/gradle/plugin/locators/Android.kt
Lines 28 to 32 in 9c36932
val variants = if ("applicationVariants" in androidExtension) { | |
androidExtension.propertyBeans("applicationVariants") | |
} else { | |
androidExtension.propertyBeans("libraryVariants") | |
} |
Errors
If present, stacktraces or files from build/kover/errors
directory
Expected behavior
This API is old and the wrong API to use. Instead, the new androidComponents.onVariants
API should be used, as this is a push system that will callback with each variant. This API is present in AGP 7.0 and later.
Reproducer
Easy to reproduce in a project that applies the kover plugin before configuring android variants.
Reports
If applicable, report files or screenshots.
Environment
- Kover Gradle Plugin version: 0.7.0-Beta
- Gradle version: 8.0.2/8.1.1
- Kotlin project type: Kotlin/Android
- Coverage Engine version (if customized in build script): N/A
- Other context important for this bug: [e.g. OS version]