aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java
diff options
context:
space:
mode:
authorGravatar Eric Fellheimer <felly@google.com>2015-08-04 18:08:45 +0000
committerGravatar John Field <jfield@google.com>2015-08-04 20:27:42 +0000
commit434e473da17d18771b3a013edb1a905bbe7e898b (patch)
treed70570f70a0980cb15ad437b58f4033e41c9b2c9 /src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java
parentf31b947420070b161e1cab4c9ff9e346ee81b65a (diff)
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
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java8
1 files changed, 7 insertions, 1 deletions
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<String, Pattern> 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