Skip to content

Commit 6d4ce1c

Browse files
authored
Add target name to PIF graphviz output (#8678)
### Motivation: Improve PIF debugging capabilities (when using the new `--build-system swiftbuild` option). ### Modifications: Adds the `ProjectModel.TargetCommon.name` property to the graphviz output (i.e., `--print-pif-manifest-graph`). ### Result: For a sample output, try: $ swift build --package-path /FooPackage --build-system swiftbuild --print-pif-manifest-graph
1 parent 64b4746 commit 6d4ce1c

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

Sources/SwiftBuildSupport/DotPIFSerializer.swift

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ func writePIF(_ workspace: PIF.Workspace, toDOT outputStream: OutputByteStream)
2020

2121
graph.node(
2222
id: workspace.id,
23-
label: "<workspace>\n\(workspace.id)",
23+
label: """
24+
<workspace>
25+
\(workspace.id)
26+
""",
2427
shape: "box3d",
2528
color: .black,
2629
fontsize: 7
@@ -30,7 +33,10 @@ func writePIF(_ workspace: PIF.Workspace, toDOT outputStream: OutputByteStream)
3033
graph.edge(from: workspace.id, to: project.id, color: .lightskyblue)
3134
graph.node(
3235
id: project.id,
33-
label: "<project>\n\(project.id)",
36+
label: """
37+
<project>
38+
\(project.id)
39+
""",
3440
shape: "box3d",
3541
color: .gray56,
3642
fontsize: 7
@@ -43,7 +49,13 @@ func writePIF(_ workspace: PIF.Workspace, toDOT outputStream: OutputByteStream)
4349
case .target(let target):
4450
graph.node(
4551
id: target.id,
46-
label: "<target>\n\(target.id)\nproduct type: \(target.productType)\n\(target.buildPhases.summary)",
52+
label: """
53+
<target>
54+
\(target.id)
55+
name: \(target.name)
56+
product type: \(target.productType)
57+
\(target.buildPhases.summary)
58+
""",
4759
shape: "box",
4860
color: .gray88,
4961
fontsize: 5
@@ -52,7 +64,10 @@ func writePIF(_ workspace: PIF.Workspace, toDOT outputStream: OutputByteStream)
5264
case .aggregate:
5365
graph.node(
5466
id: target.id,
55-
label: "<aggregate target>\n\(target.id)",
67+
label: """
68+
<aggregate target>
69+
\(target.id)
70+
""",
5671
shape: "folder",
5772
color: .gray88,
5873
fontsize: 5,

0 commit comments

Comments
 (0)