aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2018-02-14 15:47:55 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-14 15:49:50 -0800
commitb97150dab5b3284eb8c1a573289077c03fc0bb2e (patch)
tree23db1d10c4d13a70f5da91f14fda8214cc9ade6b /src/main/java
parentcc7c8980b591e39f1fed42b1d5e8231d58a2948a (diff)
Pull out useful parts of discoverInputs into findAdditionalInputs so that it can also be called by getInputFilesForExtraAction rather than duplicating the logic.
RELNOTES: None PiperOrigin-RevId: 185757663
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java44
1 files changed, 22 insertions, 22 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 273974b978..12cc3938fd 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
@@ -480,15 +480,13 @@ public class CppCompileAction extends AbstractAction
return Iterables.concat(getInputs(), prunableInputs);
}
- @Nullable
- @Override
- public Iterable<Artifact> discoverInputs(ActionExecutionContext actionExecutionContext)
+ /**
+ * Returns the results of include scanning or, when that is null, all prunable inputs and header
+ * modules.
+ */
+ private Iterable<Artifact> findAdditionalInputs(ActionExecutionContext actionExecutionContext)
throws ActionExecutionException, InterruptedException {
Iterable<Artifact> initialResult;
-
- actionExecutionContext
- .getEventBus()
- .post(ActionStatusMessage.analysisStrategy(this));
try {
initialResult =
actionExecutionContext
@@ -512,9 +510,21 @@ public class CppCompileAction extends AbstractAction
result.addTransitive(context.getTransitiveModules(usePic));
}
result.addTransitive(prunableInputs);
- additionalInputs = result.build();
- return additionalInputs;
+ return result.build();
+ } else {
+ return initialResult;
}
+ }
+
+ @Nullable
+ @Override
+ public Iterable<Artifact> discoverInputs(ActionExecutionContext actionExecutionContext)
+ throws ActionExecutionException, InterruptedException {
+ actionExecutionContext
+ .getEventBus()
+ .post(ActionStatusMessage.analysisStrategy(this));
+
+ Iterable<Artifact> initialResult = findAdditionalInputs(actionExecutionContext);
if (shouldPruneModules) {
Set<Artifact> initialResultSet = Sets.newLinkedHashSet(initialResult);
@@ -1324,20 +1334,10 @@ public class CppCompileAction extends AbstractAction
public Iterable<Artifact> getInputFilesForExtraAction(
ActionExecutionContext actionExecutionContext)
throws ActionExecutionException, InterruptedException {
- Iterable<Artifact> scannedIncludes;
- try {
- scannedIncludes = actionExecutionContext.getContext(CppIncludeScanningContext.class)
- .findAdditionalInputs(this, actionExecutionContext, includeProcessing);
- } catch (ExecException e) {
- throw e.toActionExecutionException(this);
- }
-
- if (scannedIncludes == null) {
- return ImmutableList.of();
- }
-
+ Iterable<Artifact> discoveredInputs = findAdditionalInputs(actionExecutionContext);
return Sets.<Artifact>difference(
- ImmutableSet.<Artifact>copyOf(scannedIncludes), ImmutableSet.<Artifact>copyOf(getInputs()));
+ ImmutableSet.<Artifact>copyOf(discoveredInputs),
+ ImmutableSet.<Artifact>copyOf(getInputs()));
}
@Override