dependency-analysis-gradle-plugin icon indicating copy to clipboard operation
dependency-analysis-gradle-plugin copied to clipboard

kaptTest not detected as kapt usage

Open bartek-wesolowski opened this issue 3 years ago • 12 comments

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:

  1. Add a kaptTest dependency on Dagger (com.google.dagger:dagger:2.42).
  2. Run dependency analysis.

Expected behavior When I have kaptTest dependencies then the plugin shouldn't suggest KAPT plugin removal.

bartek-wesolowski avatar Aug 25 '22 13:08 bartek-wesolowski

Hm, it's actually fairly unusually to see someone use kaptTest. I'm just checking, but do you mean kaptAndroidTest?

autonomousapps avatar Sep 06 '22 06:09 autonomousapps

I mean kaptTest, but kaptAndroidTest might have similar problems.

bartek-wesolowski avatar Sep 06 '22 06:09 bartek-wesolowski

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.

BenTilbrook avatar Sep 27 '22 02:09 BenTilbrook

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... 😢

autonomousapps avatar Sep 27 '22 18:09 autonomousapps

Yes, Hilt is very common. It's one of, if not the most popular DI frameworks on Android.

BenTilbrook avatar Sep 27 '22 22:09 BenTilbrook

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)

autonomousapps avatar Nov 14 '22 18:11 autonomousapps

I can check it, but please give me more time. I might be OOO until the end of this week.

bartek-wesolowski avatar Nov 14 '22 20:11 bartek-wesolowski

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).

autonomousapps avatar Nov 15 '22 18:11 autonomousapps

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.

bartek-wesolowski avatar Nov 19 '22 18:11 bartek-wesolowski

I thought it may have resolved it because #804 also made a change that I thought might fix the test issue. Guess not!

autonomousapps avatar Nov 21 '22 21:11 autonomousapps

If someone provides a minimal reproducer, that will make this easier to address. Thanks!

autonomousapps avatar Aug 07 '23 18:08 autonomousapps

Absent a reproducer, I'm going to remove this from the next milestone.

autonomousapps avatar Oct 01 '23 20:10 autonomousapps