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

Feature Request: Give advice about plugin usage. #1043

Open yogurtearl opened 10 months ago

yogurtearl commented 10 months ago

Is your feature request related to a problem? Please describe. I often want to know the minimal set of plugins that need to be applied to a given subproject. Specifically:

Specifically, AGP, ksp, kapt and other plugins that can be heavy weight.

Describe the solution you'd like This might be impossible to do in the general case, and likely would need a way to define configurable logic per plugin to answer the question "is this plugin required for this subproject"

Maybe could detect if the plugin outputs nothing and doesn't generate any tasks, suggest that it may not be needed.

Also, could remove each thing in the plugins {...} block from each subproject one by one programmatically, and then run some configurable list of tasks to check if anything broke. This would probably be very slow and doesn't scale well.

autonomousapps commented 10 months ago

I think doing this generally is outside the scope of this plugin, at least for now. For specific use-cases, such as detecting that kapt is unused (which we already do), we can consider them on an individual basis.

In addition to kapt, the plugin also has some basic features for determining if AGP is needed. This is encapsulated in the "module advice" concept. I haven't had much user feedback on that feature, so I don't know what it needs to be "industry grade" yet.

ksp might be another interesting example. I don't have any personal experience with it, so couldn't say offhand how to detect if it's "used" or not.

As a way forward, I would suggest opening a new issue for each plugin you want to talk about. You could repurpose this issue for one of them, or leave this as-is for general discussion.