public void MakeTargetGraph(bool force = false) { var trimPath = Bazel.ExecRoot + Path.DirectorySeparatorChar; if (DiagnosticsEnabled || force) { TargetGraph = new TargetGraph(trimPath, ProjectFile, null); } }
private List <TargetGraph.Edge> WriteCluster(TargetGraph g, Cluster cluster) { var externalEdges = new List <TargetGraph.Edge>(); if (g != cluster && cluster.Nodes.Count == 0) { cluster.GetOrAdd("empty"); } foreach (var node in cluster.Nodes.Values) { Indent() .Append(node.Id); var style = _styler.GetAttrs(node); var attrs = new Dictionary <string, string>() { ["style"] = $"\"{style.Style}\"" }; if (style.Fill != null) { node.Color = style.Fill; // highlight edges with this color attrs["fillcolor"] = "\"" + style.Fill + "\""; } if (style.Penwidth != null) { attrs["penwidth"] = style.Penwidth; } if (style.outline != null) { attrs["color"] = style.outline; } attrs["label"] = $"<{node.Name}>"; InlineAttributes(attrs); foreach (var dep in node.Dependencies.Values.Cast <TargetGraph.Edge>()) { if (dep.To.Cluster != dep.From.Cluster) { // graphviz sometimes doesn't like it when we declare inter-cluster edges inside a cluster. // sometimes it will draw the external node in the current cluster instead of making a new // cluster externalEdges.Add(dep); continue; } WriteEdge(dep); } } return(externalEdges); }
public override void SaveGraph(List <NodeData> nodes, List <ConnectionData> connections, bool resetAll = false) { //base.SaveGraph(nodes, connections, resetAll); UnityEngine.Assertions.Assert.IsNotNull(this); TargetGraph.ApplyGraph(nodes, connections); NodeGraphObj obj = TargetGraph; var allAssets = AllNeededAssets(); SetSubAssets(allAssets, obj); UnityEditor.EditorUtility.SetDirty(obj); }
public string Write(TargetGraph g) { _sb.Append("digraph g"); Open(); Indent(); _sb.AppendLine("ranksep=1.8"); _sb.AppendLine("fillcolor=grey21 style=filled"); _sb.AppendLine("fontcolor=gray92"); Indent(); _sb.AppendLine("node [shape=box style=filled]"); WriteCluster(g, g); var clusters = g.Clusters.Values.ToList(); foreach (var cluster in clusters) { Indent().Append($"subgraph cluster_{cluster.Id}"); Open(); Indent(); Attributes(new Dictionary <string, string>() { ["label"] = $"<{cluster.Name}<br/>{cluster.PropertiesString}>" }); _sb.AppendLine(); var externalEdges = WriteCluster(g, cluster); Close(); foreach (var edge in externalEdges) { WriteEdge(edge); } } Close(); return(_sb.ToString()); }
public TargetGraphLogger(TargetGraph targetGraph, PathMapper pathMapper) { _pathMapper = pathMapper; _targetGraph = targetGraph; }