diff options
author | 2016-02-04 01:10:19 +0000 | |
---|---|---|
committer | 2016-02-04 18:10:58 +0000 | |
commit | b795e6bd2a2371a4a9f5e1b2cd618fdd7eceb30a (patch) | |
tree | 9ace9e0182666b0a43b756597289d5e2499d58a7 /src/main/java/com/google/devtools/build/lib/skyframe/GlobValue.java | |
parent | 9f7a9095bc0909a5fd335c43dae31ab8ac5af2a7 (diff) |
Have GlobFunction make use of the assumption that the glob's package exists by having it not declare a dep on the PackageLookupValue for the package. This optimization means that a BUILD file edit doesn't (necessarily) invalidate all the globs in the package; the PackageLookupValue node would get change-pruned but we still pay the very small cost of invalidating unnecessarily.
Also slightly improve variable naming in GlobFunctionTest.
--
MOS_MIGRATED_REVID=113799936
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/GlobValue.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/GlobValue.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/GlobValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/GlobValue.java index 127db0c4bf..5e877bd078 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/GlobValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/GlobValue.java @@ -20,6 +20,7 @@ import com.google.devtools.build.lib.collect.nestedset.Order; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; import com.google.devtools.build.lib.util.Preconditions; +import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.PathFragment; import com.google.devtools.build.lib.vfs.UnixGlob; import com.google.devtools.build.skyframe.SkyKey; @@ -79,9 +80,8 @@ public final class GlobValue implements SkyValue { * @throws InvalidGlobPatternException if the pattern is not valid. */ @ThreadSafe - public static SkyKey key(PackageIdentifier packageId, String pattern, boolean excludeDirs, - PathFragment subdir) - throws InvalidGlobPatternException { + public static SkyKey key(PackageIdentifier packageId, Path packageRoot, String pattern, + boolean excludeDirs, PathFragment subdir) throws InvalidGlobPatternException { if (pattern.indexOf('?') != -1) { throw new InvalidGlobPatternException(pattern, "wildcard ? forbidden"); } @@ -91,7 +91,7 @@ public final class GlobValue implements SkyValue { throw new InvalidGlobPatternException(pattern, error); } - return internalKey(packageId, subdir, pattern, excludeDirs); + return internalKey(packageId, packageRoot, subdir, pattern, excludeDirs); } /** @@ -100,10 +100,10 @@ public final class GlobValue implements SkyValue { * <p>Do not use outside {@code GlobFunction}. */ @ThreadSafe - static SkyKey internalKey(PackageIdentifier packageId, PathFragment subdir, String pattern, - boolean excludeDirs) { + static SkyKey internalKey(PackageIdentifier packageId, Path packageRoot, PathFragment subdir, + String pattern, boolean excludeDirs) { return new SkyKey(SkyFunctions.GLOB, - new GlobDescriptor(packageId, subdir, pattern, excludeDirs)); + new GlobDescriptor(packageId, packageRoot, subdir, pattern, excludeDirs)); } /** @@ -113,7 +113,7 @@ public final class GlobValue implements SkyValue { */ @ThreadSafe static SkyKey internalKey(GlobDescriptor glob, String subdirName) { - return internalKey(glob.packageId, glob.subdir.getRelative(subdirName), + return internalKey(glob.packageId, glob.packageRoot, glob.subdir.getRelative(subdirName), glob.pattern, glob.excludeDirs); } |