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.66k stars 116 forks source link

`reason` task only shows used classes if there are no exposed classes #1199

Open shashachu opened 3 weeks ago

shashachu commented 3 weeks ago

Plugin version 1.32.0

Gradle version 8.6

JDK version 17

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

(Optional) Android Gradle Plugin (AGP) version 8.3.2

Describe the bug I'm running the reason task to understand why modules depend on our hairball module. It will only output used classes if there are no exposed classes. Is this intended?

To Reproduce (unfortunately I have to redact specific class/module information) With an exposed class:

$ ./gradlew :feature-library:xxx:reason --id :hairball

> Task :feature-library:xxx:reason

----------------------------------------
You asked about the dependency ':hairball'.
You have been advised to change this dependency to 'api' from 'implementation'.
----------------------------------------

<clip>

Source: debug, main
-------------------
* Exposes 1 class: com.pinterest.hairball.xyz (implies api).

When I comment out the usage of the exposed class:

$ ./gradlew :feature-library:xxx:reason --id :hairball

> Task :feature-library:xxx:reason

----------------------------------------
You asked about the dependency ':hairball'.
There is no advice regarding this dependency.
----------------------------------------

<clip>

Source: debug, main
-------------------
* Uses 11 classes, 5 of which are shown: com.pinterest.xxx ... <clipped>

Expected behavior I'd like to use this task to prioritize classes to pull out of our hairball module, but without complete information it's difficult. Is there a way to make the reason task print out everything?