diff options
author | Yun Peng <pcloudy@google.com> | 2016-05-09 11:08:25 +0000 |
---|---|---|
committer | Klaus Aehlig <aehlig@google.com> | 2016-05-09 13:05:55 +0000 |
commit | 352f7e7b5f3adae4128a6041bdfe1324c433ce28 (patch) | |
tree | 05855bb5d817c4cedbaa3043f54965a59f50ca9c /src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java | |
parent | 0e27fded9d74e86d7fee412995d75601ed3d4380 (diff) |
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
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java index ed4652ad3f..e40ddc8843 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java @@ -942,18 +942,19 @@ public class CppCompileAction extends AbstractAction // Determine prefixes of allowed absolute inclusions. CppConfiguration toolchain = cppConfiguration; - List<PathFragment> systemIncludePrefixes = new ArrayList<>(); + List<Path> systemIncludePrefixes = new ArrayList<>(); for (PathFragment includePath : toolchain.getBuiltInIncludeDirectories()) { if (includePath.isAbsolute()) { - systemIncludePrefixes.add(includePath); + systemIncludePrefixes.add(execRoot.getFileSystem().getPath(includePath)); } } // Check inclusions. IncludeProblems problems = new IncludeProblems(); Map<PathFragment, Artifact> allowedDerivedInputsMap = getAllowedDerivedInputsMap(); - for (PathFragment execPath : depSet.getDependencies()) { - if (execPath.isAbsolute()) { + for (Path execPath : depSet.getDependencies()) { + PathFragment execPathFragment = execPath.asFragment(); + if (execPathFragment.isAbsolute()) { // Absolute includes from system paths are ignored. if (FileSystemUtils.startsWithAny(execPath, systemIncludePrefixes)) { continue; @@ -962,16 +963,16 @@ public class CppCompileAction extends AbstractAction // non-system include paths here should never be absolute. If they // are, it's probably due to a non-hermetic #include, & we should stop // the build with an error. - if (execPath.startsWith(execRoot.asFragment())) { - execPath = execPath.relativeTo(execRoot.asFragment()); // funky but tolerable path + if (execPath.startsWith(execRoot)) { + execPathFragment = execPath.relativeTo(execRoot); // funky but tolerable path } else { - problems.add(execPath.getPathString()); + problems.add(execPathFragment.getPathString()); continue; } } - Artifact artifact = allowedDerivedInputsMap.get(execPath); + Artifact artifact = allowedDerivedInputsMap.get(execPathFragment); if (artifact == null) { - artifact = artifactResolver.resolveSourceArtifact(execPath); + artifact = artifactResolver.resolveSourceArtifact(execPathFragment); } if (artifact != null) { inputs.add(artifact); @@ -981,7 +982,7 @@ public class CppCompileAction extends AbstractAction } else { // Abort if we see files that we can't resolve, likely caused by // undeclared includes or illegal include constructs. - problems.add(execPath.getPathString()); + problems.add(execPathFragment.getPathString()); } } problems.assertProblemFree(this, getSourceFile()); |