dependency-analysis-gradle-plugin
dependency-analysis-gradle-plugin copied to clipboard
Unnecessary advice in the report for flavors or buildTypes dependencies
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:
- if
<buildType><configuration>is added, then it is recommended to replace it withgoogle<buildType><configuration> - if
is added, then it is recommended to replace it with Debug
When we replace dependencies as advised, we get the following:
- if
<buildType><configuration>is replaced withgoogle<buildType><configuration>, the project failed building, since this dependency is also necessary forhuaweiflavor - if
is replaced with Debug , the plugin advises adding the missing <flavor>Release<configuration>dependency
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.
Can you try with version 1.28.0 (latest at time of writing)?
Sorry for the long answer. We are now using version 1.31.0 and this problem no longer exists. Thank you.
Great, thanks!