aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java
diff options
context:
space:
mode:
authorGravatar nharmata <nharmata@google.com>2017-10-30 14:40:40 -0400
committerGravatar John Cater <jcater@google.com>2017-10-31 10:37:24 -0400
commit8d874b0f8fd8b562945e94a4099cf31687afd9f0 (patch)
tree23276d1dc0f90bfc9b9ebc1f542b5dfe0bd9e226 /src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java
parent1fef5277c8c47dd976e7028890246df612216456 (diff)
Fix bug where all three implementations of RecursivePackageProvider#getPackagesUnderDirectory assumed that the given directory needed to be strictly underneath all directories in the given blacklistedSubdirectories set, yet the callsites were calling this method such that the given directory was not-necessarily-strictly underneath the blacklistedSubdirectories.
N.B. There is no end-to-end bug in EnvironmentBackedRecursivePackageProvider because TargetPatternFunction's usage of TargetPattern#eval is always with blacklistedSubdirectories=ImmutableSet.of(). Also note that the existing fast-path in GraphBackedRecursivePackageProvider is dead code because the Preconditions check would fail first :( RELNOTES: None PiperOrigin-RevId: 173924216
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java b/src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java
index e070b659b4..82cbe381f9 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/EnvironmentBackedRecursivePackageProvider.java
@@ -13,6 +13,7 @@
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
@@ -141,9 +142,13 @@ public final class EnvironmentBackedRecursivePackageProvider implements Recursiv
roots.add(repositoryValue.getPath());
}
+ if (blacklistedSubdirectories.contains(directory)) {
+ return ImmutableList.of();
+ }
+ PathFragment.checkAllPathsAreUnder(blacklistedSubdirectories, directory);
+
LinkedHashSet<PathFragment> packageNames = new LinkedHashSet<>();
for (Path root : roots) {
- PathFragment.checkAllPathsAreUnder(blacklistedSubdirectories, directory);
RecursivePkgValue lookup = (RecursivePkgValue) env.getValue(RecursivePkgValue.key(
repository, RootedPath.toRootedPath(root, directory), blacklistedSubdirectories));
if (lookup == null) {