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

FR: Suggest converting an android project to a JVM-only project if possible #1163

Open ZacSweers opened 2 months ago

ZacSweers commented 2 months ago

Is your feature request related to a problem? Please describe. In some cases, android projects may use no android APIs/features. In these cases, these projects could be converted wholly to JVM projects and offload the work that the comparatively-expensive AGP plugin does.

I think the logic could be:

Describe the solution you'd like Advice produced in this case!

Describe alternatives you've considered

Additional context

autonomousapps commented 2 months ago

This feature already exists, partially. See here. It uses a heuristic to determine if an Android module "could" or "should" be a JVM module. If you run ./gradlew lib:projectHealth on an Android module that uses limited or no Android features, you should see "module advice" telling you you could turn it into a JVM module. The reason task also supports providing more information about why this advice is emitted (or not).

As far as I know, we have no real users of this "module advice" feature yet, so we don't know how useful it is, if at all. Feedback is very welcome!