diff options
author | Philipp Wollermann <philwo@google.com> | 2016-10-19 12:14:38 +0000 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2016-10-19 13:19:18 +0000 |
commit | d628b8005aa8e6489e407f105466e7c3df478776 (patch) | |
tree | 5ba50236351a163bba3a12f8ea138b1b9a287702 /src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java | |
parent | 4b4b9d33e50dfba8c4b2e798d3ede2c75fa3b256 (diff) |
Rollback of commit e0d7a540e3c615c628f63fcaaaba0c47fca2cb25.
*** Reason for rollback ***
Suspected root cause for Windows bootstrap on Bazel CI breakage:
java.lang.NullPointerException
at com.google.devtools.build.lib.vfs.Path$1.run(Path.java:123)
http://ci.bazel.io/view/Bazel%20bootstrap%20and%20maintenance/job/Bazel/922/JAVA_VERSION=1.8,PLATFORM_NAME=windows-x86_64/console
*** Original change description ***
VFS: implement a Windows-specific Path subclass
The new subclass WindowsFileSystem.WindowsPath is
aware of Windows drives.
This change:
- introduces a new factory for Path objects so
FileSystems can return a custom implementation
that instantiates filesystem-specific Paths
- implements the WindowsPath subclass of Path that
is aware of Windows drives
- introduces the bazel.windows_unix_root JVM
argument that defines the MSYS root, which
defines the absolute Windows path that is the...
***
--
MOS_MIGRATED_REVID=136583352
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java b/src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java index 23e7ad79ed..a9825959a8 100644 --- a/src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java +++ b/src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java @@ -14,6 +14,7 @@ package com.google.devtools.build.lib.vfs; import com.google.devtools.build.lib.util.Preconditions; + import java.io.Serializable; import java.util.Objects; @@ -48,21 +49,7 @@ public class RootedPath implements Serializable { * Returns a rooted path representing {@code relativePath} relative to {@code root}. */ public static RootedPath toRootedPath(Path root, PathFragment relativePath) { - if (relativePath.isAbsolute()) { - if (root.isRootDirectory()) { - return new RootedPath( - root.getRelative(relativePath.windowsVolume()), relativePath.toRelative()); - } else { - Preconditions.checkArgument( - relativePath.startsWith(root.asFragment()), - "relativePath '%s' is absolute, but it's not under root '%s'", - relativePath, - root); - return new RootedPath(root, relativePath.relativeTo(root.asFragment())); - } - } else { - return new RootedPath(root, relativePath); - } + return new RootedPath(root, relativePath); } /** @@ -70,7 +57,7 @@ public class RootedPath implements Serializable { */ public static RootedPath toRootedPath(Path root, Path path) { Preconditions.checkState(path.startsWith(root), "path: %s root: %s", path, root); - return toRootedPath(root, path.asFragment()); + return new RootedPath(root, path.relativeTo(root)); } /** |