From 434e473da17d18771b3a013edb1a905bbe7e898b Mon Sep 17 00:00:00 2001 From: Eric Fellheimer Date: Tue, 4 Aug 2015 18:08:45 +0000 Subject: Create a parameter to GlobFunction to determine whether it should deal with non-pattern sub-expressions via file stat or directory listing. There is an inherent incrementality tradeoff here: A directory listing should be independent of any file edits in the directory, but may be overly conservative if an unrelated file is added or removed. The file stat is overly conservative when the file is modified, since glob() cares only about existence vs. non-existence. -- MOS_MIGRATED_REVID=99838654 --- .../java/com/google/devtools/build/lib/skyframe/GlobFunction.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java') diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java index 7e80689b72..66b2bce9b7 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java @@ -44,6 +44,12 @@ public final class GlobFunction implements SkyFunction { private final Cache regexPatternCache = CacheBuilder.newBuilder().concurrencyLevel(4).build(); + private final boolean alwaysUseDirListing; + + public GlobFunction(boolean alwaysUseDirListing) { + this.alwaysUseDirListing = alwaysUseDirListing; + } + @Override public SkyValue compute(SkyKey skyKey, Environment env) throws GlobFunctionException { GlobDescriptor glob = (GlobDescriptor) skyKey.argument(); @@ -110,7 +116,7 @@ public final class GlobFunction implements SkyFunction { PathFragment dirPathFragment = glob.getPackageId().getPackageFragment().getRelative(globSubdir); RootedPath dirRootedPath = RootedPath.toRootedPath(globPkgLookupValue.getRoot(), dirPathFragment); - if (containsGlobs(patternHead)) { + if (alwaysUseDirListing || containsGlobs(patternHead)) { // Pattern contains globs, so a directory listing is required. // // Note that we have good reason to believe the directory exists: if this is the -- cgit v1.2.3