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.67k stars 115 forks source link

`primary` feature gives advices to add already added dependencies #1134

Open BraisGabin opened 4 months ago

BraisGabin commented 4 months ago

Plugin version 1.30.0 (but it was present before too)

Gradle version 8.6

JDK version 17

(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version 1.9.22

(Optional) Android Gradle Plugin (AGP) version 8.2.2

Describe the bug I have a project like this: consumer -> unused -> used ~and consumer only uses :used~ (this is not important, if consumer uses both the problem is still there). And a bundle like this:

bundle('facade') {
  includeDependency(':unused')
  includeDependency(':used')
}

I expect not advices. And that works! But when I change the bundle to this:

bundle('facade') {
  primary(':unused')
  includeDependency(':used')
}

I also expect not advices but I get an advice telling me that :consumer should depend on :unused. But :consumer already depends on :unused so the advice shouldn't exist

To Reproduce Steps to reproduce the behavior:

  1. Go to src/functionalTest/groovy/com/autonomousapps/jvm/projects/BundleProject2.groovy and edit the line 31 from includeDependency to primary
  2. Run the test

Expected behavior No advices

autonomousapps commented 4 months ago

Thanks for the report.