aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
diff options
context:
space:
mode:
authorGravatar ulfjack <ulfjack@google.com>2017-06-19 14:17:52 +0200
committerGravatar Philipp Wollermann <philwo@google.com>2017-06-19 18:25:13 +0200
commit77c9f5ec751f4adf3a8095e2e2943ec59dc12d26 (patch)
treee26c02e39bbec73d4fdc47edbbfa7469fa0f291d /src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
parent34e22458c6058773b41958b75ef5e7459482c109 (diff)
Rewrite the Executor/ActionExecutionContext split
Move everything to ActionExecutionContext, and drop Executor whereever possible. This clarifies the API, makes it simpler to test, and simplifies the code. PiperOrigin-RevId: 159414816
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
index 31363c3cf1..d36af24a4a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
@@ -27,7 +27,6 @@ import com.google.devtools.build.lib.actions.ActionExecutionException;
import com.google.devtools.build.lib.actions.ActionOwner;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ExecException;
-import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.actions.ResourceSet;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
@@ -133,21 +132,22 @@ public class FakeCppCompileAction extends CppCompileAction {
public void execute(ActionExecutionContext actionExecutionContext)
throws ActionExecutionException, InterruptedException {
setModuleFileFlags();
- Executor executor = actionExecutionContext.getExecutor();
-
// First, do a normal compilation, to generate the ".d" file. The generated object file is built
// to a temporary location (tempOutputFile) and ignored afterwards.
LOG.info("Generating " + getDotdFile());
- CppCompileActionContext context = executor.getContext(actionContext);
+ CppCompileActionContext context = actionExecutionContext.getContext(actionContext);
CppCompileActionContext.Reply reply = null;
try {
reply = context.execWithReply(this, actionExecutionContext);
} catch (ExecException e) {
- throw e.toActionExecutionException("C++ compilation of rule '" + getOwner().getLabel() + "'",
- executor.getVerboseFailures(), this);
+ throw e.toActionExecutionException(
+ "C++ compilation of rule '" + getOwner().getLabel() + "'",
+ actionExecutionContext.getVerboseFailures(),
+ this);
}
- IncludeScanningContext scanningContext = executor.getContext(IncludeScanningContext.class);
- Path execRoot = executor.getExecRoot();
+ IncludeScanningContext scanningContext =
+ actionExecutionContext.getContext(IncludeScanningContext.class);
+ Path execRoot = actionExecutionContext.getExecRoot();
NestedSet<Artifact> discoveredInputs;
if (getDotdFile() == null) {
@@ -184,11 +184,11 @@ public class FakeCppCompileAction extends CppCompileAction {
validateInclusions(
discoveredInputs,
actionExecutionContext.getArtifactExpander(),
- executor.getEventHandler());
+ actionExecutionContext.getEventHandler());
} catch (ActionExecutionException e) {
// TODO(bazel-team): (2009) make this into an error, once most of the current warnings
// are fixed.
- executor.getEventHandler().handle(Event.warn(
+ actionExecutionContext.getEventHandler().handle(Event.warn(
getOwner().getLocation(),
e.getMessage() + ";\n this warning may eventually become an error"));
}