autonomousapps / dependency-analysis-gradle-plugin

Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins
Apache License 2.0
1.74k stars 117 forks source link

kaptTest not detected as kapt usage #776

Open bartek-wesolowski opened 2 years ago

bartek-wesolowski commented 2 years ago

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.

autonomousapps commented 2 years ago

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

bartek-wesolowski commented 2 years ago

I mean kaptTest, but kaptAndroidTest might have similar problems.

BenTilbrook commented 1 year ago

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.

autonomousapps commented 1 year ago

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

BenTilbrook commented 1 year ago

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

autonomousapps commented 1 year ago

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)

bartek-wesolowski commented 1 year ago

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

autonomousapps commented 1 year ago

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

bartek-wesolowski commented 1 year ago

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.

autonomousapps commented 1 year ago

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

autonomousapps commented 1 year ago

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

autonomousapps commented 11 months ago

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