diff options
author | 2015-06-22 16:02:24 +0000 | |
---|---|---|
committer | 2015-06-23 09:01:45 +0000 | |
commit | b815432074f669eea59b70736f0b4f20a4fdf6d9 (patch) | |
tree | 7b736d9b25ec635d57c015320d771d7e5a5f4062 /src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java | |
parent | a1036d7d8489cb3258c28c5c7ae1203978e5e085 (diff) |
Extract, reuse excluded directory assertion
Also adds tests for it.
--
MOS_MIGRATED_REVID=96572991
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java index 835bf97da2..fe2d2c4300 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java @@ -70,23 +70,18 @@ class RecursivePkgValue implements SkyValue { * set of subdirectories beneath {@code rootedPath} to skip. * * <p>Throws {@link IllegalArgumentException} if {@code excludedPaths} contains any paths that - * are not beneath {@code rootedPath}. + * are equal to {@code rootedPath} or that are not beneath {@code rootedPath}. */ @ThreadSafe public static final class RecursivePkgKey implements Serializable { private final RootedPath rootedPath; private final ImmutableSet<PathFragment> excludedPaths; - private RecursivePkgKey(RootedPath rootedPath, ImmutableSet<PathFragment> excludedPaths) { + public RecursivePkgKey(RootedPath rootedPath, ImmutableSet<PathFragment> excludedPaths) { + PathFragment.checkAllPathsAreUnder(excludedPaths, + rootedPath.getRelativePath()); this.rootedPath = Preconditions.checkNotNull(rootedPath); this.excludedPaths = Preconditions.checkNotNull(excludedPaths); - - PathFragment rootedPathFragment = rootedPath.getRelativePath(); - for (PathFragment excludedPath : excludedPaths) { - Preconditions.checkArgument(!excludedPath.equals(rootedPathFragment) - && excludedPath.startsWith(rootedPathFragment), "%s is not beneath %s", excludedPath, - rootedPathFragment); - } } public RootedPath getRootedPath() { |