Skip to content

Commit

Permalink
Adding option to disable auto opening of output file. Also printing o…
Browse files Browse the repository at this point in the history
…ut the location of both the dot file and output file. Version 0.9
  • Loading branch information
savvasdalkitsis committed Aug 1, 2020
1 parent c0ee2b0 commit 8aed2ed
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Apply the gradle plugin on your root `build.gradle` file:

```
plugins {
id 'com.savvasdalkitsis.module-dependency-graph' version '0.8'
id 'com.savvasdalkitsis.module-dependency-graph' version '0.9'
}
```

Expand All @@ -23,7 +23,7 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "com.savvasdalkitsis:module-dependency-graph:0.8"
classpath "com.savvasdalkitsis:module-dependency-graph:0.9"
}
}
Expand Down Expand Up @@ -70,6 +70,21 @@ or in the `gradle.properties` file:
graphOutputFormat=svg
```

### Auto open output file

By default, the generated graph will be opened using the system's default app for handling
the specified format. If you don't want this to happen, you can specify the following parameter:

```bash
./gradlew graphModules -PautoOpenGraph=false
```

or in the `gradle.properties` file:

```
autoOpenGraph=false
```

## Requirements

You must have graphviz installed on your system in order to use this plugin. For more information on how to install it visit http://www.graphviz.org/
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group 'com.savvasdalkitsis'
version '0.8'
version '0.9'

pluginBundle {
website = 'https://github.com/savvasdalkitsis/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,24 @@ class ModuleDependencyGraphPlugin implements Plugin<Project> {
graphOutputFile = new File(project.property('graphOutputFilePath'))
graphOutputFile.createNewFile()
}
def autoOpenGraph = true
if (project.hasProperty('autoOpenGraph')) {
autoOpenGraph = Boolean.parseBoolean(project.property('autoOpenGraph'))
}
dotFile.write(dot)
project.exec {
executable = "dot"
args("-o", graphOutputFile.absolutePath, "-T$graphOutputFormat", dotFile.absolutePath)
}
def exec = System.properties['os.name'].toLowerCase().contains("mac") ? "open" : "xdg-open"
project.exec {
executable = exec
args(graphOutputFile.absolutePath)
println("Generaged dot file at: ${dotFile.absolutePath}")
println("Generaged output file at: ${graphOutputFile.absolutePath}")

if (autoOpenGraph) {
def exec = System.properties['os.name'].toLowerCase().contains("mac") ? "open" : "xdg-open"
project.exec {
executable = exec
args(graphOutputFile.absolutePath)
}
}
}
}
Expand Down

0 comments on commit 8aed2ed

Please sign in to comment.