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.67k stars 115 forks source link

Please print `build.gradle` paths #1114

Open rjrjr opened 5 months ago

rjrjr commented 5 months ago

It would be nice if the buildHealth / projectHealth reports posted paths to gradle files, for easier copy / paste into the IDE's Open File field.

common/addons-ui/common/public/build.gradle >> :common:addons-ui:common:public

autonomousapps commented 5 months ago

Thanks for the issue! I don't have time to work on it right now, but I think it might be a relatively simple PR if someone wants to implement it themselves. I will only note that it should support build.gradle and build.gradle.kts paths.

handstandsam commented 5 months ago

Implementation Callout: File paths don't always match Gradle Paths, so a .replace("/", ":") isn't smart enough to handle those cases.

Example: https://stackoverflow.com/a/19303545

include ":logger"
project(":logger").projectDir = file("../the-logger-module-folder")
autonomousapps commented 5 months ago

Folks should be able to use https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html#getBuildFile--.

seregamorph commented 2 months ago

This PR solves request for projectHealth (not buildHealth yet) https://github.com/autonomousapps/dependency-analysis-gradle-plugin/pull/1178