aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/SymlinkTreeAction.java9
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/BinTools.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java124
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/Path.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/UnionFileSystem.java40
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java2
11 files changed, 100 insertions, 111 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/SymlinkTreeAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/SymlinkTreeAction.java
index d510c28e86..5dafb6bf52 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/SymlinkTreeAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/SymlinkTreeAction.java
@@ -24,6 +24,7 @@ import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.util.Fingerprint;
import com.google.devtools.build.lib.util.Preconditions;
+import com.google.devtools.build.lib.vfs.Path;
import javax.annotation.Nullable;
/**
@@ -75,9 +76,11 @@ public final class SymlinkTreeAction extends AbstractAction {
Artifact inputManifest, Artifact artifactMiddleman) {
ImmutableList.Builder<Artifact> result = ImmutableList.<Artifact>builder()
.add(inputManifest);
- if (artifactMiddleman != null
- && !artifactMiddleman.getPath().getFileSystem().supportsSymbolicLinksNatively()) {
- result.add(artifactMiddleman);
+ if (artifactMiddleman != null) {
+ Path path = artifactMiddleman.getPath();
+ if (!path.getFileSystem().supportsSymbolicLinksNatively(path)) {
+ result.add(artifactMiddleman);
+ }
}
return result.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BinTools.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BinTools.java
index 0ae25b65e9..deb987b771 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/BinTools.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BinTools.java
@@ -25,7 +25,6 @@ import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.Symlinks;
-
import java.io.IOException;
/**
@@ -175,7 +174,7 @@ public final class BinTools {
}
private void linkTool(Path sourcePath, Path linkPath) throws ExecException {
- if (linkPath.getFileSystem().supportsSymbolicLinksNatively()) {
+ if (linkPath.getFileSystem().supportsSymbolicLinksNatively(linkPath)) {
try {
if (!linkPath.isSymbolicLink()) {
// ensureSymbolicLink() does not handle the case where there is already
diff --git a/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java b/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java
index 91268fe90d..e7cff2bac6 100644
--- a/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java
@@ -24,7 +24,6 @@ import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.AbstractFileSystemWithCustomStat;
import com.google.devtools.build.lib.vfs.Dirent;
import com.google.devtools.build.lib.vfs.FileStatus;
-import com.google.devtools.build.lib.vfs.FileSystem.HashFunction;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.io.IOException;
@@ -283,17 +282,17 @@ public class UnixFileSystem extends AbstractFileSystemWithCustomStat {
}
@Override
- public boolean supportsModifications() {
+ public boolean supportsModifications(Path path) {
return true;
}
@Override
- public boolean supportsSymbolicLinksNatively() {
+ public boolean supportsSymbolicLinksNatively(Path path) {
return true;
}
@Override
- public boolean supportsHardLinksNatively() {
+ public boolean supportsHardLinksNatively(Path path) {
return true;
}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java
index 13a7360532..ee4bff1785 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java
@@ -163,36 +163,37 @@ public abstract class FileSystem {
}
/**
- * Returns whether or not the FileSystem supports modifications of files and
- * file entries.
+ * Returns whether or not the FileSystem supports modifications of files and file entries.
*
* <p>Returns true if FileSystem supports the following:
+ *
* <ul>
- * <li>{@link #setWritable(Path, boolean)}</li>
- * <li>{@link #setExecutable(Path, boolean)}</li>
+ * <li>{@link #setWritable(Path, boolean)}
+ * <li>{@link #setExecutable(Path, boolean)}
* </ul>
*
- * The above calls will result in an {@link UnsupportedOperationException} on
- * a FileSystem where this method returns {@code false}.
+ * The above calls will result in an {@link UnsupportedOperationException} on a FileSystem where
+ * this method returns {@code false}.
*/
- public abstract boolean supportsModifications();
+ public abstract boolean supportsModifications(Path path);
/**
* Returns whether or not the FileSystem supports symbolic links.
*
* <p>Returns true if FileSystem supports the following:
+ *
* <ul>
- * <li>{@link #createSymbolicLink(Path, PathFragment)}</li>
- * <li>{@link #getFileSize(Path, boolean)} where {@code followSymlinks=false}</li>
- * <li>{@link #getLastModifiedTime(Path, boolean)} where {@code followSymlinks=false}</li>
- * <li>{@link #readSymbolicLink(Path)} where the link points to a non-existent file</li>
+ * <li>{@link #createSymbolicLink(Path, PathFragment)}
+ * <li>{@link #getFileSize(Path, boolean)} where {@code followSymlinks=false}
+ * <li>{@link #getLastModifiedTime(Path, boolean)} where {@code followSymlinks=false}
+ * <li>{@link #readSymbolicLink(Path)} where the link points to a non-existent file
* </ul>
*
- * The above calls may result in an {@link UnsupportedOperationException} on
- * a FileSystem where this method returns {@code false}. The implementation can try to emulate
- * these calls at its own discretion.
+ * The above calls may result in an {@link UnsupportedOperationException} on a FileSystem where
+ * this method returns {@code false}. The implementation can try to emulate these calls at its own
+ * discretion.
*/
- public abstract boolean supportsSymbolicLinksNatively();
+ public abstract boolean supportsSymbolicLinksNatively(Path path);
/**
* Returns whether or not the FileSystem supports hard links.
@@ -200,14 +201,14 @@ public abstract class FileSystem {
* <p>Returns true if FileSystem supports the following:
*
* <ul>
- * <li>{@link #createFSDependentHardLink(Path, Path)}
+ * <li>{@link #createFSDependentHardLink(Path, Path)}
* </ul>
*
* The above calls may result in an {@link UnsupportedOperationException} on a FileSystem where
* this method returns {@code false}. The implementation can try to emulate these calls at its own
* discretion.
*/
- protected abstract boolean supportsHardLinksNatively();
+ protected abstract boolean supportsHardLinksNatively(Path path);
/***
* Returns true if file path is case-sensitive on this file system. Default is true.
@@ -260,12 +261,12 @@ public abstract class FileSystem {
protected abstract boolean createDirectory(Path path) throws IOException;
/**
- * Returns the size in bytes of the file denoted by {@code path}. See
- * {@link Path#getFileSize(Symlinks)} for specification.
+ * Returns the size in bytes of the file denoted by {@code path}. See {@link
+ * Path#getFileSize(Symlinks)} for specification.
*
- * <p>Note: for <@link FileSystem>s where {@link #supportsSymbolicLinksNatively()}
- * returns false, this method will throw an
- * {@link UnsupportedOperationException} if {@code followSymLinks=false}.
+ * <p>Note: for <@link FileSystem>s where {@link #supportsSymbolicLinksNatively(Path)} returns
+ * false, this method will throw an {@link UnsupportedOperationException} if {@code
+ * followSymLinks=false}.
*/
protected abstract long getFileSize(Path path, boolean followSymlinks) throws IOException;
@@ -276,16 +277,14 @@ public abstract class FileSystem {
protected abstract boolean delete(Path path) throws IOException;
/**
- * Returns the last modification time of the file denoted by {@code path}.
- * See {@link Path#getLastModifiedTime(Symlinks)} for specification.
+ * Returns the last modification time of the file denoted by {@code path}. See {@link
+ * Path#getLastModifiedTime(Symlinks)} for specification.
*
- * Note: for {@link FileSystem}s where {@link #supportsSymbolicLinksNatively()} returns
- * false, this method will throw an {@link UnsupportedOperationException} if
- * {@code followSymLinks=false}.
+ * <p>Note: for {@link FileSystem}s where {@link #supportsSymbolicLinksNatively(Path)} returns
+ * false, this method will throw an {@link UnsupportedOperationException} if {@code
+ * followSymLinks=false}.
*/
- protected abstract long getLastModifiedTime(Path path,
- boolean followSymlinks)
- throws IOException;
+ protected abstract long getLastModifiedTime(Path path, boolean followSymlinks) throws IOException;
/**
* Sets the last modification time of the file denoted by {@code path}. See
@@ -576,24 +575,20 @@ public abstract class FileSystem {
protected abstract boolean isSpecialFile(Path path, boolean followSymlinks);
/**
- * Creates a symbolic link. See {@link Path#createSymbolicLink(Path)} for
- * specification.
+ * Creates a symbolic link. See {@link Path#createSymbolicLink(Path)} for specification.
*
- * <p>Note: for {@link FileSystem}s where {@link #supportsSymbolicLinksNatively()}
- * returns false, this method will throw an
- * {@link UnsupportedOperationException}
+ * <p>Note: for {@link FileSystem}s where {@link #supportsSymbolicLinksNatively(Path)} returns
+ * false, this method will throw an {@link UnsupportedOperationException}
*/
protected abstract void createSymbolicLink(Path linkPath, PathFragment targetFragment)
throws IOException;
/**
- * Returns the target of a symbolic link. See {@link Path#readSymbolicLink}
- * for specification.
+ * Returns the target of a symbolic link. See {@link Path#readSymbolicLink} for specification.
*
- * <p>Note: for {@link FileSystem}s where {@link #supportsSymbolicLinksNatively()}
- * returns false, this method will throw an
- * {@link UnsupportedOperationException} if the link points to a non-existent
- * file.
+ * <p>Note: for {@link FileSystem}s where {@link #supportsSymbolicLinksNatively(Path)} returns
+ * false, this method will throw an {@link UnsupportedOperationException} if the link points to a
+ * non-existent file.
*
* @throws NotASymlinkException if the current path is not a symbolic link
* @throws IOException if the contents of the link could not be read for any reason.
@@ -668,17 +663,15 @@ public abstract class FileSystem {
protected abstract boolean isReadable(Path path) throws IOException;
/**
- * Sets the file to readable (if the argument is true) or non-readable (if the
- * argument is false)
+ * Sets the file to readable (if the argument is true) or non-readable (if the argument is false)
*
- * <p>Note: for {@link FileSystem}s where {@link #supportsModifications()}
- * returns false or which do not support unreadable files, this method will
- * throw an {@link UnsupportedOperationException}.
+ * <p>Note: for {@link FileSystem}s where {@link #supportsModifications(Path)} returns false or
+ * which do not support unreadable files, this method will throw an {@link
+ * UnsupportedOperationException}.
*
* @throws IOException if there was an error reading or writing the file's metadata
*/
- protected abstract void setReadable(Path path, boolean readable)
- throws IOException;
+ protected abstract void setReadable(Path path, boolean readable) throws IOException;
/**
* Returns true iff the file represented by {@code path} is writable.
@@ -688,17 +681,14 @@ public abstract class FileSystem {
protected abstract boolean isWritable(Path path) throws IOException;
/**
- * Sets the file to writable (if the argument is true) or non-writable (if the
- * argument is false)
+ * Sets the file to writable (if the argument is true) or non-writable (if the argument is false)
*
- * <p>Note: for {@link FileSystem}s where {@link #supportsModifications()}
- * returns false, this method will throw an
- * {@link UnsupportedOperationException}.
+ * <p>Note: for {@link FileSystem}s where {@link #supportsModifications(Path)} returns false, this
+ * method will throw an {@link UnsupportedOperationException}.
*
* @throws IOException if there was an error reading or writing the file's metadata
*/
- protected abstract void setWritable(Path path, boolean writable)
- throws IOException;
+ protected abstract void setWritable(Path path, boolean writable) throws IOException;
/**
* Returns true iff the file represented by the path is executable.
@@ -708,27 +698,25 @@ public abstract class FileSystem {
protected abstract boolean isExecutable(Path path) throws IOException;
/**
- * Sets the file to executable, if the argument is true. It is currently not
- * supported to unset the executable status of a file, so {code
- * executable=false} yields an {@link UnsupportedOperationException}.
+ * Sets the file to executable, if the argument is true. It is currently not supported to unset
+ * the executable status of a file, so {code executable=false} yields an {@link
+ * UnsupportedOperationException}.
*
- * <p>Note: for {@link FileSystem}s where {@link #supportsModifications()}
- * returns false, this method will throw an
- * {@link UnsupportedOperationException}.
+ * <p>Note: for {@link FileSystem}s where {@link #supportsModifications(Path)} returns false, this
+ * method will throw an {@link UnsupportedOperationException}.
*
* @throws IOException if there was an error reading or writing the file's metadata
*/
protected abstract void setExecutable(Path path, boolean executable) throws IOException;
/**
- * Sets the file permissions. If permission changes on this {@link FileSystem}
- * are slow (e.g. one syscall per change), this method should aim to be faster
- * than setting each permission individually. If this {@link FileSystem} does
- * not support group or others permissions, those bits will be ignored.
+ * Sets the file permissions. If permission changes on this {@link FileSystem} are slow (e.g. one
+ * syscall per change), this method should aim to be faster than setting each permission
+ * individually. If this {@link FileSystem} does not support group or others permissions, those
+ * bits will be ignored.
*
- * <p>Note: for {@link FileSystem}s where {@link #supportsModifications()}
- * returns false, this method will throw an
- * {@link UnsupportedOperationException}.
+ * <p>Note: for {@link FileSystem}s where {@link #supportsModifications(Path)} returns false, this
+ * method will throw an {@link UnsupportedOperationException}.
*
* @throws IOException if there was an error reading or writing the file's metadata
*/
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
index 777b089ea7..9ce2922584 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
@@ -179,17 +179,17 @@ public class JavaIoFileSystem extends AbstractFileSystemWithCustomStat {
}
@Override
- public boolean supportsModifications() {
+ public boolean supportsModifications(Path path) {
return true;
}
@Override
- public boolean supportsSymbolicLinksNatively() {
+ public boolean supportsSymbolicLinksNatively(Path path) {
return true;
}
@Override
- public boolean supportsHardLinksNatively() {
+ public boolean supportsHardLinksNatively(Path path) {
return true;
}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/Path.java b/src/main/java/com/google/devtools/build/lib/vfs/Path.java
index 5c3c7bf0e4..b5eabcf1bf 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/Path.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/Path.java
@@ -895,7 +895,7 @@ public class Path implements Comparable<Path>, Serializable {
* Returns the target of the current path, which must be a symbolic link. The link contents are
* returned exactly, and may contain an absolute or relative path. Analogous to readlink(2).
*
- * <p>Note: for {@link FileSystem}s where {@link FileSystem#supportsSymbolicLinksNatively()}
+ * <p>Note: for {@link FileSystem}s where {@link FileSystem#supportsSymbolicLinksNatively(Path)}
* returns false, this method will throw an {@link UnsupportedOperationException} if the link
* points to a non-existent file.
*
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java
index 5f58eb532e..3f17588b8f 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java
@@ -66,17 +66,17 @@ public abstract class ReadonlyFileSystem extends AbstractFileSystem {
}
@Override
- public boolean supportsModifications() {
+ public boolean supportsModifications(Path path) {
return false;
}
@Override
- public boolean supportsSymbolicLinksNatively() {
+ public boolean supportsSymbolicLinksNatively(Path path) {
return false;
}
@Override
- public boolean supportsHardLinksNatively() {
+ public boolean supportsHardLinksNatively(Path path) {
return false;
}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java
index f72019b7c3..1f34d99fb1 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java
@@ -51,17 +51,17 @@ public abstract class ReadonlyFileSystemWithCustomStat extends AbstractFileSyste
}
@Override
- public boolean supportsModifications() {
+ public boolean supportsModifications(Path path) {
return false;
}
@Override
- public boolean supportsSymbolicLinksNatively() {
+ public boolean supportsSymbolicLinksNatively(Path path) {
return false;
}
@Override
- public boolean supportsHardLinksNatively() {
+ public boolean supportsHardLinksNatively(Path path) {
return false;
}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/UnionFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/UnionFileSystem.java
index de65cf7e18..4a0148e90e 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/UnionFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/UnionFileSystem.java
@@ -144,25 +144,25 @@ public class UnionFileSystem extends FileSystem {
return delegate.resolveOneLink(adjustPath(path, delegate));
}
- private void checkModifiable() {
- if (!supportsModifications()) {
+ private void checkModifiable(Path path) {
+ if (!supportsModifications(path)) {
throw new UnsupportedOperationException(
String.format("Modifications to this %s are disabled.", getClass().getSimpleName()));
}
}
@Override
- public boolean supportsModifications() {
+ public boolean supportsModifications(Path path) {
return !readOnly;
}
@Override
- public boolean supportsSymbolicLinksNatively() {
+ public boolean supportsSymbolicLinksNatively(Path path) {
return true;
}
@Override
- public boolean supportsHardLinksNatively() {
+ public boolean supportsHardLinksNatively(Path path) {
return true;
}
@@ -185,7 +185,7 @@ public class UnionFileSystem extends FileSystem {
@Override
protected boolean createDirectory(Path path) throws IOException {
- checkModifiable();
+ checkModifiable(path);
// When creating the exact directory that is mapped,
// create it on both the parent's delegate and the path's delegate.
// This is necessary both for the parent to see the directory and for the
@@ -217,7 +217,7 @@ public class UnionFileSystem extends FileSystem {
@Override
protected boolean delete(Path path) throws IOException {
- checkModifiable();
+ checkModifiable(path);
FileSystem delegate = getDelegate(path);
return delegate.delete(adjustPath(path, delegate));
}
@@ -230,7 +230,7 @@ public class UnionFileSystem extends FileSystem {
@Override
protected void setLastModifiedTime(Path path, long newTime) throws IOException {
- checkModifiable();
+ checkModifiable(path);
FileSystem delegate = getDelegate(path);
delegate.setLastModifiedTime(adjustPath(path, delegate), newTime);
}
@@ -262,8 +262,8 @@ public class UnionFileSystem extends FileSystem {
@Override
protected void createSymbolicLink(Path linkPath, PathFragment targetFragment) throws IOException {
- checkModifiable();
- if (!supportsSymbolicLinksNatively()) {
+ checkModifiable(linkPath);
+ if (!supportsSymbolicLinksNatively(linkPath)) {
throw new UnsupportedOperationException(
"Attempted to create a symlink, but symlink support is disabled.");
}
@@ -333,14 +333,14 @@ public class UnionFileSystem extends FileSystem {
@Override
protected void setReadable(Path path, boolean readable) throws IOException {
- checkModifiable();
+ checkModifiable(path);
FileSystem delegate = getDelegate(path);
delegate.setReadable(adjustPath(path, delegate), readable);
}
@Override
protected boolean isWritable(Path path) throws IOException {
- if (!supportsModifications()) {
+ if (!supportsModifications(path)) {
return false;
}
FileSystem delegate = getDelegate(path);
@@ -349,7 +349,7 @@ public class UnionFileSystem extends FileSystem {
@Override
protected void setWritable(Path path, boolean writable) throws IOException {
- checkModifiable();
+ checkModifiable(path);
FileSystem delegate = getDelegate(path);
delegate.setWritable(adjustPath(path, delegate), writable);
}
@@ -362,7 +362,7 @@ public class UnionFileSystem extends FileSystem {
@Override
protected void setExecutable(Path path, boolean executable) throws IOException {
- checkModifiable();
+ checkModifiable(path);
FileSystem delegate = getDelegate(path);
delegate.setExecutable(adjustPath(path, delegate), executable);
}
@@ -387,16 +387,15 @@ public class UnionFileSystem extends FileSystem {
@Override
protected OutputStream getOutputStream(Path path, boolean append) throws IOException {
- checkModifiable();
+ checkModifiable(path);
FileSystem delegate = getDelegate(path);
return delegate.getOutputStream(adjustPath(path, delegate), append);
}
@Override
protected void renameTo(Path sourcePath, Path targetPath) throws IOException {
- checkModifiable();
FileSystem sourceDelegate = getDelegate(sourcePath);
- if (!sourceDelegate.supportsModifications()) {
+ if (!sourceDelegate.supportsModifications(sourcePath)) {
throw new UnsupportedOperationException(
String.format(
"The filesystem for the source path %s does not support modifications.",
@@ -405,7 +404,7 @@ public class UnionFileSystem extends FileSystem {
sourcePath = adjustPath(sourcePath, sourceDelegate);
FileSystem targetDelegate = getDelegate(targetPath);
- if (!targetDelegate.supportsModifications()) {
+ if (!targetDelegate.supportsModifications(targetPath)) {
throw new UnsupportedOperationException(
String.format(
"The filesystem for the target path %s does not support modifications.",
@@ -427,12 +426,13 @@ public class UnionFileSystem extends FileSystem {
@Override
protected void createFSDependentHardLink(Path linkPath, Path originalPath) throws IOException {
- checkModifiable();
+ checkModifiable(linkPath);
FileSystem originalDelegate = getDelegate(originalPath);
FileSystem linkDelegate = getDelegate(linkPath);
- if (!originalDelegate.equals(linkDelegate) || !linkDelegate.supportsHardLinksNatively()) {
+ if (!originalDelegate.equals(linkDelegate)
+ || !linkDelegate.supportsHardLinksNatively(linkPath)) {
throw new UnsupportedOperationException(
"Attempted to create a hard link, but hard link support is disabled.");
}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
index dffdd256ef..b3e59d18b0 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
@@ -643,17 +643,17 @@ public class InMemoryFileSystem extends ScopeEscapableFileSystem {
}
@Override
- public boolean supportsModifications() {
+ public boolean supportsModifications(Path path) {
return true;
}
@Override
- public boolean supportsSymbolicLinksNatively() {
+ public boolean supportsSymbolicLinksNatively(Path path) {
return true;
}
@Override
- public boolean supportsHardLinksNatively() {
+ public boolean supportsHardLinksNatively(Path path) {
return true;
}
diff --git a/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java b/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java
index 83707d24d4..9b0b91427b 100644
--- a/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java
@@ -345,7 +345,7 @@ public class WindowsFileSystem extends JavaIoFileSystem {
}
@Override
- public boolean supportsSymbolicLinksNatively() {
+ public boolean supportsSymbolicLinksNatively(Path path) {
return false;
}