dependency-analysis-gradle-plugin icon indicating copy to clipboard operation
dependency-analysis-gradle-plugin copied to clipboard

#1114 print build path in projectHealth

Open seregamorph opened this issue 1 year ago • 2 comments

Solves #1114 (only projectHealth, but not buildHealth). Prints absolute path of according build.gradle of the project module. This can be pretty helpful in large multi-module projects, especially when there is no full matching between module name and submodule directory.

Sample task output:

> Task :utilities:projectHealth
/Users/morph/Projects/demo-gradle-multi-module/utilities/build.gradle
Unused dependencies which should be removed:
  testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'

Using absolute path

The absolute path is printed intentionally as it seems to be the best trade-off. This path is recognized in IDEA to open file in "Navigate to File...": Screenshot 2024-04-27 at 19 25 50 For instance, if relative path is used, there can be ambiguity: Screenshot 2024-04-27 at 19 26 10 Also, the relative path is not always in parent directory (for included builds) and printing "../../parent/build.gradle" will not help navigating to the file in the IDE.

seregamorph avatar Apr 27 '24 18:04 seregamorph

I've updated the implementation moving the gradle file name prepending to ProjectHealthTask not to cache the GenerateProjectHealthReportTask output with absolute path (while it's not a task input).

seregamorph avatar Apr 29 '24 08:04 seregamorph

I only worry about it being inconsistent with how buildHealth works

What would you prefer - address both projectHealth and buildHealth in scope of a single PR or implement them separately? The problem here is that these two tasks have different ways to aggregate and format reports.

seregamorph avatar May 05 '24 18:05 seregamorph