From 352f7e7b5f3adae4128a6041bdfe1324c433ce28 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Mon, 9 May 2016 11:08:25 +0000 Subject: 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 --- .../build/lib/rules/cpp/CppCompileAction.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java') 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 systemIncludePrefixes = new ArrayList<>(); + List 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 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()); -- cgit v1.2.3