summaryrefslogtreecommitdiff
path: root/main/graphviz
diff options
context:
space:
mode:
authorJoseph K. Strauss <joseph.k.strauss@gmail.com>2018-08-08 09:36:17 -0400
committerLi Haoyi <haoyi.sg@gmail.com>2018-08-08 21:36:17 +0800
commit87dfb308db0a83a3443fe71127716411474b0b69 (patch)
treeac8170997f74766ef982ba451191d3d3562acb36 /main/graphviz
parent5ad6d60e6665f53860927c8a383bc6348e89c5e4 (diff)
downloadmill-87dfb308db0a83a3443fe71127716411474b0b69.tar.gz
mill-87dfb308db0a83a3443fe71127716411474b0b69.tar.bz2
mill-87dfb308db0a83a3443fe71127716411474b0b69.zip
Visualize Plan (#404)
* Make necessary import changes * Refactor to allow calling internally w/o println * Refactor to allow multiple visualize modes * Add new visualizaPlan grap entire plan * Remove and alphabetize imports * Document visualizePlan
Diffstat (limited to 'main/graphviz')
-rw-r--r--main/graphviz/src/mill/main/graphviz/GraphvizTools.scala12
1 files changed, 9 insertions, 3 deletions
diff --git a/main/graphviz/src/mill/main/graphviz/GraphvizTools.scala b/main/graphviz/src/mill/main/graphviz/GraphvizTools.scala
index 300bd98a..4e8c59ce 100644
--- a/main/graphviz/src/mill/main/graphviz/GraphvizTools.scala
+++ b/main/graphviz/src/mill/main/graphviz/GraphvizTools.scala
@@ -1,17 +1,18 @@
package mill.main.graphviz
import ammonite.ops.Path
+import guru.nidi.graphviz.attribute.Style
import mill.define.{Graph, NamedTask}
import org.jgrapht.graph.{DefaultEdge, SimpleDirectedGraph}
object GraphvizTools{
- def apply(rs: Seq[NamedTask[Any]], dest: Path) = {
+ def apply(targets: Seq[NamedTask[Any]], rs: Seq[NamedTask[Any]], dest: Path) = {
val transitive = Graph.transitiveTargets(rs.distinct)
val topoSorted = Graph.topoSorted(transitive)
val goalSet = rs.toSet
val sortedGroups = Graph.groupAroundImportantTargets(topoSorted){
case x: NamedTask[Any] if goalSet.contains(x) => x
}
- import guru.nidi.graphviz.model.Factory._
import guru.nidi.graphviz.engine.{Format, Graphviz}
+ import guru.nidi.graphviz.model.Factory._
val edgesIterator =
for((k, vs) <- sortedGroups.items())
@@ -38,7 +39,12 @@ object GraphvizTools{
org.jgrapht.alg.TransitiveReduction.INSTANCE.reduce(jgraph)
- val nodes = indexToTask.map(t => node(t.ctx.segments.render))
+ val nodes = indexToTask.map(t =>
+ node(t.ctx.segments.render).`with`{
+ if(targets.contains(t)) Style.SOLID
+ else Style.DOTTED
+ }
+ )
var g = graph("example1").directed
for(i <- indexToTask.indices){