Search in sources :

Example 1 with BuildOperationListener

use of org.gradle.internal.operations.BuildOperationListener in project gradle by gradle.

the class SubscribableBuildActionRunner method run.

@Override
public void run(BuildAction action, BuildController buildController) {
    boolean subscribable = action instanceof SubscribableBuildAction;
    if (subscribable) {
        GradleInternal gradle = buildController.getGradle();
        SubscribableBuildAction subscribableBuildAction = (SubscribableBuildAction) action;
        registerListenersForClientSubscriptions(subscribableBuildAction.getClientSubscriptions(), gradle);
    }
    try {
        delegate.run(action, buildController);
    } finally {
        for (BuildOperationListener listener : listeners) {
            buildOperationListenerManager.removeListener(listener);
        }
        listeners.clear();
    }
}
Also used : GradleInternal(org.gradle.api.internal.GradleInternal) BuildOperationListener(org.gradle.internal.operations.BuildOperationListener)

Example 2 with BuildOperationListener

use of org.gradle.internal.operations.BuildOperationListener in project gradle by gradle.

the class ToolingApiSubscribableBuildActionRunnerRegistration method createListeners.

@Override
public Iterable<BuildOperationListener> createListeners(BuildClientSubscriptions clientSubscriptions, BuildEventConsumer consumer) {
    List<BuildOperationListener> listeners = new ArrayList<BuildOperationListener>();
    if (clientSubscriptions.isSendTestProgressEvents()) {
        listeners.add(new ClientForwardingTestOperationListener(consumer, clientSubscriptions));
    }
    if (clientSubscriptions.isSendBuildProgressEvents() || clientSubscriptions.isSendTaskProgressEvents()) {
        BuildOperationListener buildListener = NO_OP;
        if (clientSubscriptions.isSendBuildProgressEvents()) {
            buildListener = new TestIgnoringBuildOperationListener(new ClientForwardingBuildOperationListener(consumer));
        }
        listeners.add(new ClientForwardingTaskOperationListener(consumer, clientSubscriptions, buildListener));
    }
    return listeners;
}
Also used : BuildOperationListener(org.gradle.internal.operations.BuildOperationListener) ArrayList(java.util.ArrayList)

Aggregations

BuildOperationListener (org.gradle.internal.operations.BuildOperationListener)2 ArrayList (java.util.ArrayList)1 GradleInternal (org.gradle.api.internal.GradleInternal)1