From 30ef3d531da32d759807efd77e21fa4c409b3013 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 1 Dec 2020 10:41:07 -0600 Subject: [PATCH] Fix the classic query package-loading cutoff optimization with external workspaces. A package's path fragment is not unambiguous when external workspaces are involved. Fixes https://github.com/bazelbuild/bazel/issues/12497. --- .../build/lib/query2/query/BlazeQueryEnvironment.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/query2/query/BlazeQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/query/BlazeQueryEnvironment.java index dada1ea9cd4788..05fc3bd43fab9d 100644 --- a/src/main/java/com/google/devtools/build/lib/query2/query/BlazeQueryEnvironment.java +++ b/src/main/java/com/google/devtools/build/lib/query2/query/BlazeQueryEnvironment.java @@ -184,9 +184,9 @@ private void getTargetsMatchingPatternImpl(String pattern, Callback call } } - Set packages = CompactHashSet.create(); + Set packages = CompactHashSet.create(); for (Target target : targets) { - packages.add(target.getLabel().getPackageFragment()); + packages.add(target.getLabel().getPackageIdentifier()); } for (Target target : targets) { @@ -205,7 +205,7 @@ private void getTargetsMatchingPatternImpl(String pattern, Callback 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 {