Search in sources :

Example 1 with ExtraAction

use of com.google.devtools.build.lib.rules.extra.ExtraAction 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;
}
Also used : Action(com.google.devtools.build.lib.actions.Action) SourceManifestAction(com.google.devtools.build.lib.analysis.SourceManifestAction) ExtraAction(com.google.devtools.build.lib.rules.extra.ExtraAction) PseudoAction(com.google.devtools.build.lib.analysis.PseudoAction) SpawnAction(com.google.devtools.build.lib.analysis.actions.SpawnAction) SymlinkTreeAction(com.google.devtools.build.lib.analysis.actions.SymlinkTreeAction) WorkspaceStatusAction(com.google.devtools.build.lib.analysis.WorkspaceStatusAction) BaselineCoverageAction(com.google.devtools.build.lib.rules.test.BaselineCoverageAction) PseudoAction(com.google.devtools.build.lib.analysis.PseudoAction) ConfiguredTarget(com.google.devtools.build.lib.analysis.ConfiguredTarget) RuleConfiguredTarget(com.google.devtools.build.lib.analysis.RuleConfiguredTarget) FileConfiguredTarget(com.google.devtools.build.lib.analysis.FileConfiguredTarget) ExtraAction(com.google.devtools.build.lib.rules.extra.ExtraAction)

Aggregations

Action (com.google.devtools.build.lib.actions.Action)1 ConfiguredTarget (com.google.devtools.build.lib.analysis.ConfiguredTarget)1 FileConfiguredTarget (com.google.devtools.build.lib.analysis.FileConfiguredTarget)1 PseudoAction (com.google.devtools.build.lib.analysis.PseudoAction)1 RuleConfiguredTarget (com.google.devtools.build.lib.analysis.RuleConfiguredTarget)1 SourceManifestAction (com.google.devtools.build.lib.analysis.SourceManifestAction)1 WorkspaceStatusAction (com.google.devtools.build.lib.analysis.WorkspaceStatusAction)1 SpawnAction (com.google.devtools.build.lib.analysis.actions.SpawnAction)1 SymlinkTreeAction (com.google.devtools.build.lib.analysis.actions.SymlinkTreeAction)1 ExtraAction (com.google.devtools.build.lib.rules.extra.ExtraAction)1 BaselineCoverageAction (com.google.devtools.build.lib.rules.test.BaselineCoverageAction)1