Skip to content

Commit

Permalink
Fix the classic query package-loading cutoff optimization with extern…
Browse files Browse the repository at this point in the history
…al workspaces.

A package's path fragment is not unambiguous when external workspaces are involved.

Fixes #12497.
  • Loading branch information
benjaminp committed Dec 1, 2020
1 parent 9cd7a8a commit 30ef3d5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ private void getTargetsMatchingPatternImpl(String pattern, Callback<Target> call
}
}

Set<PathFragment> packages = CompactHashSet.create();
Set<PackageIdentifier> packages = CompactHashSet.create();
for (Target target : targets) {
packages.add(target.getLabel().getPackageFragment());
packages.add(target.getLabel().getPackageIdentifier());
}

for (Target target : targets) {
Expand All @@ -205,7 +205,7 @@ private void getTargetsMatchingPatternImpl(String pattern, Callback<Target> call
} else if (target instanceof Rule) {
Rule rule = (Rule) target;
for (Label label : rule.getLabels(dependencyFilter)) {
if (!packages.contains(label.getPackageFragment())) {
if (!packages.contains(label.getPackageIdentifier())) {
continue; // don't cause additional package loading
}
try {
Expand Down

0 comments on commit 30ef3d5

Please sign in to comment.