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

Unnecessary advice in the report for flavors or buildTypes dependencies #1082

Closed OVOSKOP closed 2 weeks ago

OVOSKOP commented 6 months ago

Plugin version 1.25.0

Gradle version 8.3

JDK version 17

(Optional) reason output for bugs relating to incorrect advice reason for ":some-libs-debug"

Source: googleDebug, main
-------------------------
* Exposes 3 classes: com.edna.android.push_lite.PushBroadcastReceiver, com.edna.android.push_lite.PushController, com.edna.android.push_lite.fcm.FcmPushService (implies api).
* Provides 1 Android Activity: com.edna.android.push_lite.NotificationHandlingActivity (implies runtimeOnly).
* Provides 1 Android Service: com.edna.android.push_lite.fcm.FcmPushService (implies runtimeOnly).

Source: huaweiDebug, main
-------------------------
* Exposes 2 classes: com.edna.android.push_lite.PushBroadcastReceiver, com.edna.android.push_lite.PushController (implies api).
* Provides 1 Android Activity: com.edna.android.push_lite.NotificationHandlingActivity (implies runtimeOnly).
* Provides 1 Android Service: com.edna.android.push_lite.fcm.FcmPushService (implies runtimeOnly).

Describe the bug Our project has some flavors (google, huawei) and build types (debug, release). The following dependencies have been added to the project/build.gradle.kts:

debugApi(":some-libs-debug")
huaweiImplementation(":some-libs-huawei")

The report provides the following advice for these dependencies

googleDebugApi(":some-libs-debug") (was debugApi)
huaweiDebugImplementation(":some-libs-huawei") (was huaweiImplementation)

When a dependency is declared common to both flavors or build types, the plugin advises adding one of two specific configurations:

When we replace dependencies as advised, we get the following:

This seems like a bug, since adding several specific dependencies instead of one general one seems redundant.

To Reproduce ./gradlew buildHealth or ./gradlew :proj:projectHealth in a project with some flavors and build types

Expected behavior A report without advice on replacing general dependencies with specific ones.

autonomousapps commented 6 months ago

Can you try with version 1.28.0 (latest at time of writing)?

OVOSKOP commented 2 weeks ago

Sorry for the long answer. We are now using version 1.31.0 and this problem no longer exists. Thank you.

autonomousapps commented 2 weeks ago

Great, thanks!