dependency-analysis-gradle-plugin
dependency-analysis-gradle-plugin copied to clipboard
False-positive redundant plugin when annotation processing is used only in androidTest
Plugin version
0.73.0
Gradle version
6.9
Android Gradle Plugin (AGP) version
4.1.3
Describe the bug
False-positive onRedundantPlugins for kotlin-kapt plugin when it's used only in instrumentation tests (androidTestImplementation).
To Reproduce A minimal reproducer: https://github.com/eugene-krivobokov/dependency-analysis-kapt-androidTests
Expected behavior
No error.
Additional context
@eugene-krivobokov could you try this again with 0.74.0? I've recently made some improvements to how test code and dependencies are processed.
Unfortunately, still reproducible. I've updated a reproducer accordingly.
Part of the issue here is that the plugin currently offers no support for androidTests, and I simply don't have time to implement it right now. After my experience with normal tests, I know it's not a trivial improvement. As such, I will be working on https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/issues/427 first, and removing this issue from milestone 1.0.
I have observed that, despite the plugin not supporting androidTest in any way, it can still emit advice about "unused" dependencies in the androidTest source set. So at the very least it needs to stop doing that for v1.0.
Sorry to keep going back and forth on this, but after some analysis I'm back to where I started: I'll implement androidTest support post-1.0. For anyone else who runs into this, you can configure the plugin to exclude such advice like so:
// build.gradle
dependencyAnalysis {
issues {
all {
onRedundantPlugins {
exclude("kotlin-kapt")
}
}
}
}
The associated PR finally adds support for androidTest analysis, but I don't yet have a functional test in place verifying this case. I will be adding that.
Fixed.