aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2018-01-19 09:28:06 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-01-19 09:30:16 -0800
commit8cc5dcf34cf5156db78ccf5f936ca3c8b893c36f (patch)
tree5d10eb07b1c4bcd43c36ac4dc02c31a18a2fe3d0 /src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java
parent8608df20d98873d1aecf2d6f08836d0b56f826fa (diff)
Rename relativePath -> rootRelativePath in Root and friends.
This makes it clearer that the path fragments in question are relative *to the root*. Confusingly, when the root is absolute, the root relative fragment is also absolute. This makes it a tiny bit clearer that the path fragment may be absolute. PiperOrigin-RevId: 182544893
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java
index d8e569eea3..bc02d56ac9 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java
@@ -54,10 +54,12 @@ public final class RecursiveFilesystemTraversalFunction implements SkyFunction {
public static final class GeneratedPathConflictException extends
RecursiveFilesystemTraversalException {
GeneratedPathConflictException(TraversalRequest traversal) {
- super(String.format(
- "Generated directory %s conflicts with package under the same path. Additional info: %s",
- traversal.path.getRelativePath().getPathString(),
- traversal.errorInfo != null ? traversal.errorInfo : traversal.toString()));
+ super(
+ String.format(
+ "Generated directory %s conflicts with package under the same path. "
+ + "Additional info: %s",
+ traversal.path.getRootRelativePath().getPathString(),
+ traversal.errorInfo != null ? traversal.errorInfo : traversal.toString()));
}
}
@@ -132,8 +134,10 @@ public final class RecursiveFilesystemTraversalFunction implements SkyFunction {
if (rootInfo.type.isFile()) {
if (traversal.pattern == null
- || traversal.pattern.matcher(
- rootInfo.realPath.getRelativePath().getPathString()).matches()) {
+ || traversal
+ .pattern
+ .matcher(rootInfo.realPath.getRootRelativePath().getPathString())
+ .matches()) {
// The root is a file or a symlink to one.
return resultForFileRoot(traversal.path, rootInfo);
} else {
@@ -152,8 +156,10 @@ public final class RecursiveFilesystemTraversalFunction implements SkyFunction {
new GeneratedPathConflictException(traversal));
} else if (pkgLookupResult.isPackage() && !traversal.skipTestingForSubpackage) {
// The traversal was requested for a directory that defines a package.
- String msg = traversal.errorInfo + " crosses package boundary into package rooted at "
- + traversal.path.getRelativePath().getPathString();
+ String msg =
+ traversal.errorInfo
+ + " crosses package boundary into package rooted at "
+ + traversal.path.getRootRelativePath().getPathString();
switch (traversal.crossPkgBoundaries) {
case CROSS:
// We are free to traverse the subpackage but we need to display a warning.
@@ -298,8 +304,9 @@ public final class RecursiveFilesystemTraversalFunction implements SkyFunction {
throws MissingDepException, IOException, InterruptedException {
Preconditions.checkArgument(rootInfo.type.exists() && !rootInfo.type.isFile(),
"{%s} {%s}", traversal, rootInfo);
- PackageLookupValue pkgLookup = (PackageLookupValue) getDependentSkyValue(env,
- PackageLookupValue.key(traversal.path.getRelativePath()));
+ PackageLookupValue pkgLookup =
+ (PackageLookupValue)
+ getDependentSkyValue(env, PackageLookupValue.key(traversal.path.getRootRelativePath()));
if (pkgLookup.packageExists()) {
if (traversal.isGenerated) {
@@ -340,8 +347,10 @@ public final class RecursiveFilesystemTraversalFunction implements SkyFunction {
List<SkyKey> result = new ArrayList<>();
for (Dirent dirent : dirListing.getDirents()) {
- RootedPath childPath = RootedPath.toRootedPath(traversal.path.getRoot(),
- traversal.path.getRelativePath().getRelative(dirent.getName()));
+ RootedPath childPath =
+ RootedPath.toRootedPath(
+ traversal.path.getRoot(),
+ traversal.path.getRootRelativePath().getRelative(dirent.getName()));
TraversalRequest childTraversal = traversal.forChildEntry(childPath);
result.add(RecursiveFilesystemTraversalValue.key(childTraversal));
}