aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2016-02-16 09:08:10 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-02-16 09:42:02 +0000
commite5b14ff94b1cd0f858c74995a0e13607551ef7c9 (patch)
tree04bbd9e1b0743145871992e8e5ef13b64b97d9dc /src
parentbc66523bbea2c5901b709f4d80d0a90d5b681293 (diff)
Store IncludeResolver results, and legalize the files in .d file checking.
This fixes a corner case that can only happen internally - in Bazel, this is always a no-op. -- MOS_MIGRATED_REVID=114730311
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java11
1 files changed, 11 insertions, 0 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 cb740b5279..868332c972 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
@@ -179,6 +179,8 @@ public class CppCompileAction extends AbstractAction implements IncludeScannable
*/
private Collection<Artifact> additionalInputs = null;
+ private ImmutableList<Artifact> resolvedInputs = ImmutableList.<Artifact>of();
+
/**
* Creates a new action to compile C/C++ source files.
*
@@ -368,6 +370,11 @@ public class CppCompileAction extends AbstractAction implements IncludeScannable
return result;
}
+ @VisibleForTesting
+ public void setResolvedInputsForTesting(ImmutableList<Artifact> resolvedInputs) {
+ this.resolvedInputs = resolvedInputs;
+ }
+
@Override
public boolean discoversInputs() {
return true;
@@ -404,6 +411,9 @@ public class CppCompileAction extends AbstractAction implements IncludeScannable
for (Artifact artifact : getInputs()) {
result.addAll(includeResolver.getInputsForIncludedFile(artifact, artifactResolver));
}
+ // TODO(ulfjack): This only works if include scanning is enabled; the cleanup is in progress,
+ // and this needs to be fixed before we can even consider disabling it.
+ resolvedInputs = ImmutableList.copyOf(result);
if (result.isEmpty()) {
result = initialResult;
} else {
@@ -699,6 +709,7 @@ public class CppCompileAction extends AbstractAction implements IncludeScannable
}
allowedIncludes.add(input);
}
+ allowedIncludes.addAll(resolvedInputs);
if (optionalSourceFile != null) {
allowedIncludes.add(optionalSourceFile);