autonomousapps / autonomousapps/dependency-analysis-gradle-plugin
After adding dependency flagged as an undeclared used transitive, advice says to remove same dependency because it is unused
- Dominant language
- Kotlin
- Stars
- 2.2k
- Forks
- 158
- Avg merge
- 16h 25m
- Merged PRs (30d)
- 46
Description
**Build scan link**
**Plugin version**
1.25.0
**Gradle version**
8.3
**JDK version**
17
**(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version**
Kotlin 1.9.10
**(Optional) Android Gradle Plugin (AGP) version**
AGP 8.1.1
**(Optional) `reason` output for bugs relating to incorrect advice**
```
$ ./gradlew -p common/bill-pay/payment-methods/impl reason --id deps.uisys.utils
> Task :common:bill-pay:payment-methods:impl:reason
----------------------------------------
You asked about the dependency 'com.squareup.ui.utils:uisys-android-utils:9.6.0 (deps.uisys.utils)'.
There is no advice regarding this dependency.
----------------------------------------
Shortest path from :common:bill-pay:payment-methods:impl to com.squareup.ui.utils:uisys-android-utils:9.6.0 (deps.uisys.utils) for debugCompileClasspath:
:common:bill-pay:payment-methods:impl
\--- register.common.container-inversion:public
\--- register.uisys.components-mosaic:public
\--- com.squareup.ui.utils:uisys-android-utils:9.6.0
Shortest path from :common:bill-pay:payment-methods:impl to com.squareup.ui.utils:uisys-android-utils:9.6.0 (deps.uisys.utils) for debugRuntimeClasspath:
:common:bill-pay:payment-methods:impl
\--- com.squareup.ui.market:uisys-android-market-components:9.6.0
\--- com.squareup.ui.utils:uisys-android-utils:9.6.0
Source: debug, main
-------------------
(no usages)
```
**Describe the bug**
DAGP in CI flags a dependency as unused when running `buildHealth` on the set of `common` projects:
```
> Advice for :common:bill-pay:payment-methods:impl
These transitive dependencies should be declared directly:
implementation deps.uisys.utils
```
Running `projectHealth` locally on this same commit returns no issue.
When I add the requested dependency requested by the CI failure, `buildHealth` returns:
```
> Advice for :common:bill-pay:payment-methods:impl
Unused dependencies which should be removed:
implementation deps.uisys.utils
```
I ran `projectHealth` locally and it reports the same conclusion.
**To Reproduce**
Steps to reproduce the behavior:
1. Checkout commit `e917cfb80c61bde10f93713a095b24e09f5fb8c4` of the relevant repo
2. run `./gradlew -p common/bill-pay/payment-methods/impl projectHealth`. It does not report the same result as `buildHealth` run in CI (see above)
**Expected behavior**
One and only one of the above suggestions should is correct and DAGP should provide that one, not both 😄
Contributor guide
Assessment
This issue has not been assessed yet.