Permalink
Browse files

Export dot-format graphs as-is and download dot as an external repo

--
PiperOrigin-RevId: 142692462
MOS_MIGRATED_REVID=142692462
  • Loading branch information...
1 parent 98398a2 commit b7c00d8762d74fb54d0a6b0eb355abc6dc7a97c3 @kchodorow kchodorow committed with aehlig Dec 21, 2016
View
@@ -64,3 +64,10 @@ new_local_repository(
path = "./third_party/protobuf/3.0.0/",
build_file = "./third_party/protobuf/3.0.0/com_google_protobuf_java.BUILD",
)
+
+load('//tools/build_defs/pkg:apt_get.bzl', 'apt_get')
+
+apt_get(
+ name = "graphviz",
+ exports_files = ["usr/bin/dot"],
+)
View
@@ -12,6 +12,8 @@ py_library(
py_binary(
name = "generate_dot_graphs",
srcs = ["generate_dot_graphs.py"],
+ data = ["@graphviz//:usr/bin/dot"],
+ tags = ["manual"],
visibility = ["//site:__pkg__"],
deps = [":dot-converter"],
)
@@ -18,6 +18,8 @@
from scripts.docs.dot_converter import DotConverter
-if __name__ == "__main__":
- converter = DotConverter(["dot", "-Tsvg"], os.environ.copy())
+if __name__ == '__main__':
+ converter = DotConverter(
+ ['%s/external/graphviz/usr/bin/dot' % os.environ['PWD'], '-Tsvg'],
+ os.environ.copy())
converter.convert()
@@ -99,115 +99,19 @@ <h3 id="targets">Targets</h3>
</p>
<div style='margin:auto; text-align: center'>
-<svg width="582pt" height="188pt"
- viewBox="0.00 0.00 581.89 188.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 184)">
-<title>G1</title>
-<polygon fill="white" stroke="transparent" points="-4,4 -4,-184 577.888,-184 577.888,4 -4,4"/>
-<!-- Target -->
-<g id="node1" class="node">
-<title>Target</title>
-<ellipse fill="none" stroke="black" cx="376.795" cy="-162" rx="40.0939" ry="18"/>
-<text text-anchor="middle" x="376.795" y="-158.3" font-family="arial" font-size="14.00">Target</text>
-</g>
-<!-- Rule -->
-<g id="node2" class="node">
-<title>Rule</title>
-<ellipse fill="none" stroke="black" cx="241.795" cy="-90" rx="30.5947" ry="18"/>
-<text text-anchor="middle" x="241.795" y="-86.3" font-family="arial" font-size="14.00">Rule</text>
-</g>
-<!-- Target&#45;&gt;Rule -->
-<g id="edge1" class="edge">
-<title>Target&#45;&gt;Rule</title>
-<path fill="none" stroke="black" d="M351.402,-147.834C329.151,-136.296 296.735,-119.487 272.926,-107.142"/>
-<polygon fill="black" stroke="black" points="274.432,-103.98 263.943,-102.484 271.21,-110.195 274.432,-103.98"/>
-</g>
-<!-- File -->
-<g id="node6" class="node">
-<title>File</title>
-<ellipse fill="none" stroke="black" cx="376.795" cy="-90" rx="30.5947" ry="18"/>
-<text text-anchor="middle" x="376.795" y="-86.3" font-family="arial" font-size="14.00">File</text>
-</g>
-<!-- Target&#45;&gt;File -->
-<g id="edge5" class="edge">
-<title>Target&#45;&gt;File</title>
-<path fill="none" stroke="black" d="M376.795,-143.697C376.795,-135.983 376.795,-126.712 376.795,-118.112"/>
-<polygon fill="black" stroke="black" points="380.295,-118.104 376.795,-108.104 373.295,-118.104 380.295,-118.104"/>
-</g>
-<!-- Package group -->
-<g id="node9" class="node">
-<title>Package group</title>
-<ellipse fill="none" stroke="black" cx="499.795" cy="-90" rx="74.187" ry="18"/>
-<text text-anchor="middle" x="499.795" y="-86.3" font-family="arial" font-size="14.00">Package group</text>
-</g>
-<!-- Target&#45;&gt;Package group -->
-<g id="edge8" class="edge">
-<title>Target&#45;&gt;Package group</title>
-<path fill="none" stroke="black" d="M400.802,-147.337C418.506,-137.262 442.911,-123.373 463.059,-111.906"/>
-<polygon fill="black" stroke="black" points="465.018,-114.819 471.978,-106.831 461.555,-108.735 465.018,-114.819"/>
-</g>
-<!-- cc_library -->
-<g id="node3" class="node">
-<title>cc_library</title>
-<ellipse fill="none" stroke="black" cx="59.7947" cy="-18" rx="59.5901" ry="18"/>
-<text text-anchor="middle" x="59.7947" y="-14.3" font-family="arial" font-size="14.00">cc_library</text>
-</g>
-<!-- Rule&#45;&gt;cc_library -->
-<g id="edge2" class="edge">
-<title>Rule&#45;&gt;cc_library</title>
-<path fill="none" stroke="black" d="M216.87,-79.4136C188.038,-68.3243 140.006,-49.8505 104.633,-36.2453"/>
-<polygon fill="black" stroke="black" points="105.607,-32.8704 95.0176,-32.5473 103.095,-39.4038 105.607,-32.8704"/>
-</g>
-<!-- java_test -->
-<g id="node4" class="node">
-<title>java_test</title>
-<ellipse fill="none" stroke="black" cx="191.795" cy="-18" rx="54.6905" ry="18"/>
-<text text-anchor="middle" x="191.795" y="-14.3" font-family="arial" font-size="14.00">java_test</text>
-</g>
-<!-- Rule&#45;&gt;java_test -->
-<g id="edge3" class="edge">
-<title>Rule&#45;&gt;java_test</title>
-<path fill="none" stroke="black" d="M230.449,-73.1159C224.298,-64.5051 216.557,-53.6674 209.621,-43.9567"/>
-<polygon fill="black" stroke="black" points="212.453,-41.9004 203.793,-35.7973 206.757,-45.9691 212.453,-41.9004"/>
-</g>
-<!-- ... -->
-<g id="node5" class="node">
-<title>...</title>
-<ellipse fill="none" stroke="black" cx="291.795" cy="-18" rx="27" ry="18"/>
-<text text-anchor="middle" x="291.795" y="-14.3" font-family="arial" font-size="14.00">...</text>
-</g>
-<!-- Rule&#45;&gt;... -->
-<g id="edge4" class="edge">
-<title>Rule&#45;&gt;...</title>
-<path fill="none" stroke="black" d="M253.14,-73.1159C259.469,-64.2555 267.482,-53.0373 274.57,-43.1152"/>
-<polygon fill="black" stroke="black" points="277.529,-44.9929 280.494,-34.8212 271.833,-40.9242 277.529,-44.9929"/>
-</g>
-<!-- Source -->
-<g id="node7" class="node">
-<title>Source</title>
-<ellipse fill="none" stroke="black" cx="376.795" cy="-18" rx="40.0939" ry="18"/>
-<text text-anchor="middle" x="376.795" y="-14.3" font-family="arial" font-size="14.00">Source</text>
-</g>
-<!-- File&#45;&gt;Source -->
-<g id="edge6" class="edge">
-<title>File&#45;&gt;Source</title>
-<path fill="none" stroke="black" d="M376.795,-71.6966C376.795,-63.9827 376.795,-54.7125 376.795,-46.1124"/>
-<polygon fill="black" stroke="black" points="380.295,-46.1043 376.795,-36.1043 373.295,-46.1044 380.295,-46.1043"/>
-</g>
-<!-- Generated -->
-<g id="node8" class="node">
-<title>Generated</title>
-<ellipse fill="none" stroke="black" cx="489.795" cy="-18" rx="54.6905" ry="18"/>
-<text text-anchor="middle" x="489.795" y="-14.3" font-family="arial" font-size="14.00">Generated</text>
-</g>
-<!-- File&#45;&gt;Generated -->
-<g id="edge7" class="edge">
-<title>File&#45;&gt;Generated</title>
-<path fill="none" stroke="black" d="M396.997,-76.4854C413.512,-66.2547 437.203,-51.579 456.513,-39.6169"/>
-<polygon fill="black" stroke="black" points="458.378,-42.579 465.036,-34.3375 454.691,-36.6283 458.378,-42.579"/>
-</g>
-</g>
-</svg>
+<div class='graphviz dot'><!--
+digraph G1 {
+ node [shape=ellipse];
+ Target -> Rule;
+ Rule -> cc_library
+ Rule -> java_test
+ Rule -> "..."
+ Target -> File;
+ File -> Source;
+ File -> Generated;
+ Target -> "Package group"
+}
+--></div>
<p><i>Hierarchy of targets.</i></p>
</div>
@@ -524,103 +428,26 @@ <h3 id="rules">Rules</h3>
</p>
<div style="margin:auto; text-align:center">
-<svg width="157pt" height="246pt"
- viewBox="0.00 0.00 156.50 246.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 242)">
-<title>G1</title>
-<polygon fill="white" stroke="transparent" points="-4,4 -4,-242 152.5,-242 152.5,4 -4,4"/>
-<!-- r1 -->
-<g id="node1" class="node">
-<title>r1</title>
-<polygon fill="none" stroke="black" points="88.5,-173 34.5,-173 34.5,-137 88.5,-137 88.5,-173"/>
-<text text-anchor="middle" x="61.5" y="-152.5" font-family="arial" font-size="10.00" fill="#006000">rule</text>
-</g>
-<!-- s1 -->
-<g id="node3" class="node">
-<title>s1</title>
-<ellipse fill="none" stroke="black" cx="14.5" cy="-223.5" rx="14.5" ry="14.5"/>
-<text text-anchor="middle" x="14.5" y="-221" font-family="arial" font-size="10.00" fill="#006000">in</text>
-</g>
-<!-- r1&#45;&gt;s1 -->
-<g id="edge1" class="edge">
-<title>r1&#45;&gt;s1</title>
-<path fill="none" stroke="black" d="M49.3963,-173.125C42.9655,-182.224 35.0324,-193.449 28.3559,-202.895"/>
-<polygon fill="black" stroke="black" points="25.3432,-201.094 22.4297,-211.28 31.0596,-205.134 25.3432,-201.094"/>
-</g>
-<!-- s2 -->
-<g id="node4" class="node">
-<title>s2</title>
-<ellipse fill="none" stroke="black" cx="61.5" cy="-223.5" rx="14.5" ry="14.5"/>
-<text text-anchor="middle" x="61.5" y="-221" font-family="arial" font-size="10.00" fill="#006000">in</text>
-</g>
-<!-- r1&#45;&gt;s2 -->
-<g id="edge2" class="edge">
-<title>r1&#45;&gt;s2</title>
-<path fill="none" stroke="black" d="M61.5,-173.125C61.5,-180.918 61.5,-190.27 61.5,-198.729"/>
-<polygon fill="black" stroke="black" points="58.0001,-198.782 61.5,-208.782 65.0001,-198.782 58.0001,-198.782"/>
-</g>
-<!-- s3 -->
-<g id="node5" class="node">
-<title>s3</title>
-<ellipse fill="none" stroke="black" cx="108.5" cy="-223.5" rx="14.5" ry="14.5"/>
-<text text-anchor="middle" x="108.5" y="-221" font-family="arial" font-size="10.00" fill="#006000">in</text>
-</g>
-<!-- r1&#45;&gt;s3 -->
-<g id="edge3" class="edge">
-<title>r1&#45;&gt;s3</title>
-<path fill="none" stroke="black" d="M73.6037,-173.125C80.0345,-182.224 87.9676,-193.449 94.6441,-202.895"/>
-<polygon fill="black" stroke="black" points="91.9404,-205.134 100.57,-211.28 97.6568,-201.094 91.9404,-205.134"/>
-</g>
-<!-- r2 -->
-<g id="node2" class="node">
-<title>r2</title>
-<polygon fill="none" stroke="black" points="148.5,-101 94.5,-101 94.5,-65 148.5,-65 148.5,-101"/>
-<text text-anchor="middle" x="121.5" y="-80.5" font-family="arial" font-size="10.00" fill="#006000">rule</text>
-</g>
-<!-- r2&#45;&gt;r1 -->
-<g id="edge5" class="edge">
-<title>r2&#45;&gt;r1</title>
-<path fill="none" stroke="black" d="M106.669,-101.303C99.4753,-109.695 90.7033,-119.93 82.8097,-129.139"/>
-<polygon fill="black" stroke="black" points="80.0114,-127.025 76.1609,-136.896 85.3262,-131.581 80.0114,-127.025"/>
-</g>
-<!-- s4 -->
-<g id="node6" class="node">
-<title>s4</title>
-<ellipse fill="none" stroke="black" cx="121.5" cy="-155" rx="14.5" ry="14.5"/>
-<text text-anchor="middle" x="121.5" y="-152.5" font-family="arial" font-size="10.00" fill="#006000">in</text>
-</g>
-<!-- r2&#45;&gt;s4 -->
-<g id="edge4" class="edge">
-<title>r2&#45;&gt;s4</title>
-<path fill="none" stroke="black" d="M121.5,-101.303C121.5,-110.01 121.5,-120.7 121.5,-130.171"/>
-<polygon fill="black" stroke="black" points="118,-130.175 121.5,-140.175 125,-130.176 118,-130.175"/>
-</g>
-<!-- o1 -->
-<g id="node7" class="node">
-<title>o1</title>
-<ellipse fill="none" stroke="black" cx="61.5" cy="-83" rx="14.5" ry="14.5"/>
-<text text-anchor="middle" x="61.5" y="-80.5" font-family="arial" font-size="10.00" fill="#006000">out</text>
-</g>
-<!-- o1&#45;&gt;r1 -->
-<g id="edge6" class="edge">
-<title>o1&#45;&gt;r1</title>
-<path fill="none" stroke="black" d="M61.5,-97.8297C61.5,-106.081 61.5,-116.847 61.5,-126.744"/>
-<polygon fill="black" stroke="black" points="58.0001,-126.981 61.5,-136.981 65.0001,-126.981 58.0001,-126.981"/>
-</g>
-<!-- o2 -->
-<g id="node8" class="node">
-<title>o2</title>
-<ellipse fill="none" stroke="black" cx="121.5" cy="-14.5" rx="14.5" ry="14.5"/>
-<text text-anchor="middle" x="121.5" y="-12" font-family="arial" font-size="10.00" fill="#006000">out</text>
-</g>
-<!-- o2&#45;&gt;r2 -->
-<g id="edge7" class="edge">
-<title>o2&#45;&gt;r2</title>
-<path fill="none" stroke="black" d="M121.5,-29.2788C121.5,-36.6355 121.5,-45.9556 121.5,-54.7067"/>
-<polygon fill="black" stroke="black" points="118,-54.9286 121.5,-64.9286 125,-54.9286 118,-54.9286"/>
-</g>
-</g>
-</svg>
+<div class='graphviz dot'><!--
+digraph G1 {
+ graph [rankdir=BT];
+ node [fontname="Courier-Bold",fontsize=10,fontcolor="#006000"];
+
+ node [shape=box,label="rule"]; r1; r2;
+
+ node [shape=circle,width=.4,fixedsize=1];
+ node [label="in"]; s1; s2; s3; s4;
+ node [label="out"]; o1; o2;
+
+ r1 -> s1;
+ r1 -> s2;
+ r1 -> s3;
+ r2 -> s4;
+ r2 -> r1;
+ o1 -> r1;
+ o2 -> r2;
+}
+--></div>
<p><i>Source files, rules, and generated files.</i></p>
</div>
Oops, something went wrong.

0 comments on commit b7c00d8

Please sign in to comment.