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

False-positive redundant plugin when annotation processing is used only in androidTest

Open eugene-krivobokov opened this issue 4 years ago • 5 comments
trafficstars

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 avatar Jun 09 '21 18:06 eugene-krivobokov

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

autonomousapps avatar Jun 19 '21 18:06 autonomousapps

Unfortunately, still reproducible. I've updated a reproducer accordingly.

eugene-krivobokov avatar Jun 21 '21 08:06 eugene-krivobokov

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.

autonomousapps avatar Aug 01 '21 00:08 autonomousapps

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.

autonomousapps avatar Mar 23 '22 19:03 autonomousapps

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")
      }
    }
  }
}

autonomousapps avatar Mar 26 '22 07:03 autonomousapps

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.

autonomousapps avatar Nov 10 '22 15:11 autonomousapps

Fixed.

autonomousapps avatar Nov 14 '22 17:11 autonomousapps