VisTeg is a Gradle plugin for exporting task execution graph as .dot file.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'gradle.plugin.cz.malohlava:visteg:1.0.5'
}
}
apply plugin: 'cz.malohlava.visteg'plugins {
id 'cz.malohlava.visteg' version '1.0.5'
}The plugin publishes visteg extension with following configuration options:
visteg {
enabled = true
colouredNodes = true
colouredEdges = true
destination = 'build/reports/visteg.dot'
exporter = 'dot'
colorscheme = 'spectral11'
nodeShape = 'box'
startNodeShape = 'hexagon'
endNodeShape = 'doubleoctagon'
}The plugin supports the following options:
enabled- Enables plugin for the project.colouredNodes- Produces colored nodes.colouredEdges- Produces colored edges.destination- The output file location.exporter- Name of graph exporter, onlydotvalue is supported now.colorscheme- Name of color scheme used for graph coloring. For full list of values see Graphviz page.nodeShape- Name of shape used for graph inner nodes. See Graphviz page for full list of values.startNodeShape- Name of shape used for graph start nodes. See Graphviz page for full list of values.endNodeShape- Name of shape used for graph leaf nodes. See Graphviz page for full list of values.
Perform any Gradle task, for example build:
./gradlew build
It will generate a .dot file in the directory build/reports containing execution plan graph for task build.
The generated file can be post-processed via Graphviz dot utility.
For example, png image is produced as follows:
cd build/reports/
dot -Tpng ./visteg.dot -o ./visteg.dot.png
For more information, please visit Graphviz home page.
The plugin installs itself as a listener to Gradle lifecycle via gradle.taskGraph.whenReady.
During execution it obtains reference to task execution graph via reflection and performs a walk through the graph.
Based on idea published by Code Wader - http://codewader.blogspot.com/2011/11/show-gradle-dependencies-as-graphwiz.html