dependency-analysis-gradle-plugin
dependency-analysis-gradle-plugin copied to clipboard
kaptTest not detected as kapt usage
Build scan link http://gradle.affirm-dev.com/s/3irzggszoazni
Plugin version 1.13.1
Gradle version 7.5
(Optional) Android Gradle Plugin (AGP) version 7.2.1
reason output for bugs relating to incorrect advice
Unused plugins that can be removed: kotlin-kapt: this project has the kotlin-kapt (org.jetbrains.kotlin.kapt) plugin applied, but there are no used annotation processors.
Describe the bug
I have a kaptTest dependency on Dagger. The plugin suggests KAPT removal.
To Reproduce Steps to reproduce the behavior:
- Add a
kaptTestdependency on Dagger (com.google.dagger:dagger:2.42). - Run dependency analysis.
Expected behavior
When I have kaptTest dependencies then the plugin shouldn't suggest KAPT plugin removal.
Hm, it's actually fairly unusually to see someone use kaptTest. I'm just checking, but do you mean kaptAndroidTest?
I mean kaptTest, but kaptAndroidTest might have similar problems.
it's actually fairly unusually to see someone use kaptTest
kaptTest is required for Hilt Android unit tests, so I think it is very common.
required for Hilt Android unit tests
Is Hilt that common?
That looks like a huge anti-pattern to me. 😱 What is Android doing to unit tests... 😢
Yes, Hilt is very common. It's one of, if not the most popular DI frameworks on Android.
This may possibly be resolved with a recent merge to main. https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/pull/804
Would you mind checking the snapshot? (wait at least a couple of hours)
I can check it, but please give me more time. I might be OOO until the end of this week.
No problem. I said "wait at least a couple of hours" just in case you tried too early and didn't get the right snapshot. This has actually been released at this point and you can just use the latest version (1.14.1 at time of writing).
I checked it using 1.14.1. The problem still exists for me. I think https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/pull/804 doesn't solve it because it adds support for analysing androidTest source sets (which is very nice BTW) and this problem is about regular unit tests.
Could anyone else test it too? I'm working on a big project and my issue might be with something else.
I thought it may have resolved it because #804 also made a change that I thought might fix the test issue. Guess not!
If someone provides a minimal reproducer, that will make this easier to address. Thanks!
Absent a reproducer, I'm going to remove this from the next milestone.