diff options
author | 2017-03-27 16:14:44 +0000 | |
---|---|---|
committer | 2017-03-28 19:48:52 +0000 | |
commit | e67b00767c9c578bf23fa77fda85a8beec0682c4 (patch) | |
tree | e7bcef0e49285a46744c7ffbd91556587c3e69bc /src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java | |
parent | 34efd79c3c932d635eff8c3cbedd1293995521c4 (diff) |
BEP: Unconditionally report ExtraActions
...irrespective of their success status. While a build typically
contains too many successful actions to report them all, extra actions
included in a build are worth reporting.
--
Change-Id: I6b20935895aa7b16836d6271f456176a7113317e
Reviewed-on: https://cr.bazel.build/9519
PiperOrigin-RevId: 151328633
MOS_MIGRATED_REVID=151328633
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java index aed5bd710e..6a4037a31f 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java @@ -68,9 +68,13 @@ public class ActionExecutedEvent implements BuildEvent { @Override public BuildEventId getEventId() { - Cause cause = - new ActionFailed(action.getPrimaryOutput().getPath(), action.getOwner().getLabel()); - return BuildEventId.fromCause(cause); + if (getException() != null) { + Cause cause = + new ActionFailed(action.getPrimaryOutput().getPath(), action.getOwner().getLabel()); + return BuildEventId.fromCause(cause); + } else { + return BuildEventId.actionCompleted(action.getPrimaryOutput().getPath()); + } } @Override @@ -82,7 +86,7 @@ public class ActionExecutedEvent implements BuildEvent { public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { BuildEventStreamProtos.ActionExecuted.Builder actionBuilder = BuildEventStreamProtos.ActionExecuted.newBuilder().setSuccess(getException() == null); - if (exception.getExitCode() != null) { + if (exception != null && exception.getExitCode() != null) { actionBuilder.setExitCode(exception.getExitCode().getNumericExitCode()); } if (stdout != null) { @@ -99,9 +103,15 @@ public class ActionExecutedEvent implements BuildEvent { .setUri(pathConverter.apply(stderr)) .build()); } - if (action.getOwner() != null) { + if (action.getOwner() != null && action.getOwner().getLabel() != null) { actionBuilder.setLabel(action.getOwner().getLabel().toString()); } + if (exception == null) { + actionBuilder.setPrimaryOutput( + BuildEventStreamProtos.File.newBuilder() + .setUri(pathConverter.apply(action.getPrimaryOutput().getPath())) + .build()); + } return GenericBuildEvent.protoChaining(this).setAction(actionBuilder.build()).build(); } } |