use of com.google.devtools.build.lib.analysis.PseudoAction in project bazel by bazelbuild.
the class BuildViewTestCase method getPseudoActionViaExtraAction.
/**
* Retrieves an instance of {@code PseudoAction} that is shadowed by an extra action
* @param targetLabel Label of the target with an extra action
* @param actionListenerLabel Label of the action listener
*/
protected PseudoAction<?> getPseudoActionViaExtraAction(String targetLabel, String actionListenerLabel) throws Exception {
useConfiguration(String.format("--experimental_action_listener=%s", actionListenerLabel));
ConfiguredTarget target = getConfiguredTarget(targetLabel);
List<Action> actions = getExtraActionActions(target);
assertNotNull(actions);
assertThat(actions).hasSize(2);
ExtraAction extraAction = null;
for (Action action : actions) {
if (action instanceof ExtraAction) {
extraAction = (ExtraAction) action;
break;
}
}
assertNotNull(actions.toString(), extraAction);
Action pseudoAction = extraAction.getShadowedAction();
assertThat(pseudoAction).isInstanceOf(PseudoAction.class);
assertEquals(String.format("%s%s.extra_action_dummy", targetConfig.getGenfilesFragment(), convertLabelToPath(targetLabel)), pseudoAction.getPrimaryOutput().getExecPathString());
return (PseudoAction<?>) pseudoAction;
}
Aggregations