Repository: vanniktech/gradle-dependency-graph-generator-plugin (kotlin)

Issue:
Print all generated files path
This would be helpful to open the svg/png/dot file once generated with a simple clic instead of navigating to the right directory (and to know where to look).
I thought about adding such log with `logger.lifecycle()` which could be silenced with `-q` if needed.
WDYT?

Pull request description:
Fixes #155

Here is what it looks like on Windows:

```
> Task :generateDependencyGraph
C:\...\build\reports\dependency-graph\dependency-graph.dot
C:\...\build\reports\dependency-graph\dependency-graph.png
C:\...\build\reports\dependency-graph\dependency-graph.svg

BUILD SUCCESSFUL in 27s
```

Unfortunately, clickable file uri in IntelliJ's terminal is awful.
On Windows, it works only if the IDE has indexed the file before printing it.
Not sure about the Unix/Macos behavior.

Patch:
diff --git a/src/main/kotlin/com/vanniktech/dependency/graph/generator/DependencyGraphGeneratorTask.kt b/src/main/kotlin/com/vanniktech/dependency/graph/generator/DependencyGraphGeneratorTask.kt
index f9fea21..0234453 100644
--- a/src/main/kotlin/com/vanniktech/dependency/graph/generator/DependencyGraphGeneratorTask.kt
+++ b/src/main/kotlin/com/vanniktech/dependency/graph/generator/DependencyGraphGeneratorTask.kt
@@ -25,12 +25,15 @@ import java.io.File
   }
 
   @TaskAction fun run() {
-    File(outputDirectory, generator.outputFileNameDot).writeText(graph.toString())
+    val dot = File(outputDirectory, generator.outputFileNameDot)
+    dot.writeText(graph.toString())
 
     val graphviz = Graphviz.fromGraph(graph)
 
-    generator.outputFormats.forEach {
+    val renders = generator.outputFormats.map {
       graphviz.render(it).toFile(File(outputDirectory, generator.outputFileName))
     }
+
+    listOf(dot).plus(renders).forEach { logger.lifecycle(it.absolutePath) }
   }
 }
diff --git a/src/main/kotlin/com/vanniktech/dependency/graph/generator/ProjectDependencyGraphGeneratorTask.kt b/src/main/kotlin/com/vanniktech/dependency/graph/generator/ProjectDependencyGraphGeneratorTask.kt
index 14eb945..83abcd3 100644
--- a/src/main/kotlin/com/vanniktech/dependency/graph/generator/ProjectDependencyGraphGeneratorTask.kt
+++ b/src/main/kotlin/com/vanniktech/dependency/graph/generator/ProjectDependencyGraphGeneratorTask.kt
@@ -25,12 +25,15 @@ import java.io.File
   }
 
   @TaskAction fun run() {
-    File(outputDirectory, projectGenerator.outputFileNameDot).writeText(graph.toString())
+    val dot = File(outputDirectory, projectGenerator.outputFileNameDot)
+    dot.writeText(graph.toString())
 
     val graphviz = Graphviz.fromGraph(graph)
 
-    projectGenerator.outputFormats.forEach {
+    val renders = projectGenerator.outputFormats.map {
       graphviz.render(it).toFile(File(outputDirectory, projectGenerator.outputFileName))
     }
+
+    listOf(dot).plus(renders).forEach { logger.lifecycle(it.absolutePath) }
   }
 }


Test patch:
diff --git a/src/test/java/com/vanniktech/dependency/graph/generator/DependencyGraphGeneratorPluginTest.kt b/src/test/java/com/vanniktech/dependency/graph/generator/DependencyGraphGeneratorPluginTest.kt
index 5a8c658..5120c39 100644
--- a/src/test/java/com/vanniktech/dependency/graph/generator/DependencyGraphGeneratorPluginTest.kt
+++ b/src/test/java/com/vanniktech/dependency/graph/generator/DependencyGraphGeneratorPluginTest.kt
@@ -1,5 +1,7 @@
 package com.vanniktech.dependency.graph.generator
 
+import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorExtension.Generator
+import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorExtension.ProjectGenerator
 import org.gradle.api.internal.project.DefaultProject
 import org.gradle.api.plugins.JavaLibraryPlugin
 import org.gradle.testfixtures.ProjectBuilder
@@ -33,7 +35,7 @@ class DependencyGraphGeneratorPluginTest {
     singleProject.evaluate() // Need to call this for afterEvaluate() to pick up.
 
     val task = singleProject.tasks.getByName("generateDependencyGraph") as DependencyGraphGeneratorTask
-    assertEquals(true, task.generator === DependencyGraphGeneratorExtension.Generator.ALL)
+    assertEquals(true, task.generator === Generator.ALL)
     assertEquals("reporting", task.group)
     assertEquals("Generates a dependency graph", task.description)
     assertEquals(File(singleProject.buildDir, "reports/dependency-graph/").toString(), task.outputDirectory.toString())
@@ -45,7 +47,7 @@ class DependencyGraphGeneratorPluginTest {
     singleProject.evaluate() // Need to call this for afterEvaluate() to pick up.
 
     val task = singleProject.tasks.getByName("generateProjectDependencyGraph") as ProjectDependencyGraphGeneratorTask
-    assertEquals(true, task.projectGenerator === DependencyGraphGeneratorExtension.ProjectGenerator.ALL)
+    assertEquals(true, task.projectGenerator === ProjectGenerator.ALL)
     assertEquals("reporting", task.group)
     assertEquals("Generates a project dependency graph", task.description)
     assertEquals(File(singleProject.buildDir, "reports/project-dependency-graph/").toString(), task.outputDirectory.toString())
@@ -89,10 +91,21 @@ class DependencyGraphGeneratorPluginTest {
     assertEquals(TaskOutcome.SUCCESS, result.task(":generateDependencyGraph")?.outcome)
     assertEquals(TaskOutcome.SUCCESS, result.task(":generateProjectDependencyGraph")?.outcome)
 
-    // We don't want to assert the content of the images, just that they exist.
-    assertEquals(true, File(testProjectDir.root, "build/reports/dependency-graph/dependency-graph.png").exists())
-    assertEquals(true, File(testProjectDir.root, "build/reports/dependency-graph/dependency-graph.svg").exists())
+    // We don't want to assert the content of the images, just that they exist and that their path is logged
+    Generator.ALL.outputFormats.forEach {
+      val file = File(testProjectDir.root, "build/reports/dependency-graph/dependency-graph.${it.fileExtension}")
+      assertEquals(true, file.exists())
+      assertEquals(true, file.absolutePath in result.output)
+    }
+    Generator.ALL.outputFormats.map {
+      File(testProjectDir.root, "build/reports/dependency-graph/dependency-graph.${it.fileExtension}")
+    }.forEach {
+      assertEquals(true, it.exists())
+      assertEquals(true, it.absolutePath in result.output)
+    }
 
+    val dependencyGraphDot = File(testProjectDir.root, "build/reports/dependency-graph/dependency-graph.dot")
+    assertEquals(true, dependencyGraphDot.absolutePath in result.output)
     assertEquals(
       """
         digraph "G" {
@@ -113,13 +126,19 @@ class DependencyGraphGeneratorPluginTest {
         "ioreactivexrxjava2rxjava" -> "orgreactivestreamsreactivestreams"
         }
       """.trimIndent(),
-      File(testProjectDir.root, "build/reports/dependency-graph/dependency-graph.dot").readText()
+      dependencyGraphDot.readText()
     )
 
-    // We don't want to assert the content of the images, just that they exist.
-    assertEquals(true, File(testProjectDir.root, "build/reports/project-dependency-graph/project-dependency-graph.png").exists())
-    assertEquals(true, File(testProjectDir.root, "build/reports/project-dependency-graph/project-dependency-graph.svg").exists())
+    // We don't want to assert the content of the images, just that they exist and that their path is logged
+    ProjectGenerator.ALL.outputFormats.map {
+      File(testProjectDir.root, "build/reports/project-dependency-graph/project-dependency-graph.${it.fileExtension}")
+    }.forEach {
+      assertEquals(true, it.exists())
+      assertEquals(true, it.absolutePath in result.output)
+    }
 
+    val projectDependencyGraphDot = File(testProjectDir.root, "build/reports/project-dependency-graph/project-dependency-graph.dot")
+    assertEquals(true, projectDependencyGraphDot.absolutePath in result.output)
     assertEquals(
       """
         digraph {
@@ -132,7 +151,7 @@ class DependencyGraphGeneratorPluginTest {
         }
         }
       """.trimIndent(),
-      File(testProjectDir.root, "build/reports/project-dependency-graph/project-dependency-graph.dot").readText()
+      projectDependencyGraphDot.readText()
     )
 
     val secondResult = runBuild()