Support case-insensitive comparision in Path.java with WindowsFileSystem
Since file path is case-insensitive on Windows, we need to support this.
Also fixed .d file inclusions check in CppCompileAction.java on Windows
--
MOS_MIGRATED_REVID=121823250
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 4f43ea7..cf67d1e 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
@@ -57,6 +57,10 @@
// will throw UnsupportedOperationExceptions.
private final boolean readOnly;
+ // True if the file path is case-sensitive on all the FileSystem
+ // or False if they are all case-insensitive, otherwise error.
+ private final boolean isCaseSensitive;
+
/**
* Creates a new modifiable UnionFileSystem with prefix mappings
* specified by a map.
@@ -89,9 +93,13 @@
this.readOnly = readOnly;
this.pathDelegate = new StringTrie<>();
+ this.isCaseSensitive = rootFileSystem.isFilePathCaseSensitive();
for (Map.Entry<PathFragment, FileSystem> prefix : prefixMapping.entrySet()) {
FileSystem delegate = prefix.getValue();
+ Preconditions.checkArgument(
+ delegate.isFilePathCaseSensitive() == this.isCaseSensitive,
+ "The case sensitiveness of FileSystem are different in UnionFileSystem");
PathFragment prefixPath = prefix.getKey();
// Extra slash prevents within-directory mappings, which Path can't handle.
@@ -165,6 +173,11 @@
}
@Override
+ public boolean isFilePathCaseSensitive() {
+ return this.isCaseSensitive;
+ }
+
+ @Override
public String getFileSystemType(Path path) {
FileSystem delegate = getDelegate(path);
return delegate.getFileSystemType(path);