diff options
author | 2016-01-26 08:46:08 +0000 | |
---|---|---|
committer | 2016-01-26 13:06:07 +0000 | |
commit | 546c265ba453008d302a6c73acefc22dbcd6d6e1 (patch) | |
tree | 4f9987ba711ebaadeff9997dda941e39f04972c7 /src/main/java/com/google/devtools/build/lib/vfs | |
parent | c66373c21630cf467a46d96e2dd1f0f8daf0f42e (diff) |
Add a (working) windows compatibility mode that makes Bazel create hardlinks for links to writable files.
Curiously enough, the native Unix JNI wrapper already had a function for link(), but it wasn't on the Java interface.
build-runfiles is also updated accordingly.
--
MOS_MIGRATED_REVID=113029168
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/vfs/UnixFileSystem.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/UnixFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/UnixFileSystem.java index c0d41bd9c1..ee6af3fb39 100644 --- a/src/main/java/com/google/devtools/build/lib/vfs/UnixFileSystem.java +++ b/src/main/java/com/google/devtools/build/lib/vfs/UnixFileSystem.java @@ -374,7 +374,10 @@ public class UnixFileSystem extends AbstractFileSystemWithCustomStat { throws IOException { SymlinkImplementation strategy = computeSymlinkImplementation(linkPath, targetFragment); switch (strategy) { - case HARDLINK: // TBD, fallthrough for now + case HARDLINK: + FilesystemUtils.link(targetFragment.toString(), linkPath.toString()); + break; + case JUNCTION: // Junctions are emulated on Linux with symlinks, fall through case SYMLINK: synchronized (linkPath) { @@ -492,6 +495,10 @@ public class UnixFileSystem extends AbstractFileSystemWithCustomStat { "Target is a non-writable file", linkPath, targetFragment); } + public SymlinkStrategy getSymlinkStrategy() { + return symlinkStrategy; + } + @Override protected PathFragment readSymbolicLink(Path path) throws IOException { // Note that the default implementation of readSymbolicLinkUnchecked calls this method and thus |