Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Adding graph nodes for all targets found to ensure that BUILD files a… #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ private static void parseFiles(

boolean hasEdges = false;
classToFile.put(qualifiedSrc, srcFilePath.toString());
classToClass.addNode(qualifiedSrc);
for (QualifiedName qualifiedDst : parser.qualifiedTopLevelNames) {
if (!qualifiedSrc.equals(qualifiedDst.value())) {
classToClass.putEdge(qualifiedSrc, qualifiedDst.value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public void createDepsGraph_unresolvedClasses() throws IOException {

ImmutableGraph<String> actual = parser.getClassToClass();
MutableGraph<String> expected = newGraph();
expected.addNode("Dummy");

assertThatGraphsEqual(actual, expected);
assertThat(parser.getUnresolvedClassNames()).containsExactly("Foo");
Expand Down Expand Up @@ -271,13 +272,14 @@ public void allFilesInSameDirAreOnACycle() throws IOException {
ImmutableGraph<String> actual = parser.getClassToClass();

MutableGraph<String> expected = newGraph();
expected.addNode("x.A");
expected.putEdge("y.A", "y.B");
expected.putEdge("y.B", "y.A");
expected.putEdge("z.A", "z.B");
expected.putEdge("z.B", "z.C");
expected.putEdge("z.C", "z.A");
// Implicit: there's no tests.A and tests.B here, because 'tests/' is not in
// oneRulePerPackageRoots.
expected.addNode("tests.A");
expected.addNode("tests.B");

assertThatGraphsEqual(actual, expected);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/google/devtools/build/bfg/Bfg.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private ImmutableGraph<String> protoMultimapToGraph(
MutableGraph<String> result = GraphBuilder.directed().build();
m.forEach(
(u, deps) -> {
result.addNode(u);
for (String s : deps.getElementsList()) {
result.putEdge(u, s);
}
Expand Down