Search in sources :

Example 1 with OutputEvent

use of org.gradle.internal.logging.events.OutputEvent in project gradle by gradle.

the class WorkInProgressRenderer method renderNow.

private void renderNow() {
    if (queue.isEmpty()) {
        return;
    }
    // Skip processing of any operations that both start and complete in the queue
    Set<OperationIdentifier> completeEventOperationIds = toOperationIdSet(Iterables.filter(queue, ProgressCompleteEvent.class));
    Set<OperationIdentifier> operationIdsToSkip = new HashSet<OperationIdentifier>();
    for (OutputEvent event : queue) {
        if (event instanceof ProgressStartEvent) {
            progressArea.setVisible(true);
            ProgressStartEvent startEvent = (ProgressStartEvent) event;
            if (completeEventOperationIds.contains(startEvent.getProgressOperationId())) {
                operationIdsToSkip.add(startEvent.getProgressOperationId());
            // Don't attach to any labels
            } else {
                attach(operations.start(startEvent.getShortDescription(), startEvent.getStatus(), startEvent.getCategory(), startEvent.getProgressOperationId(), startEvent.getParentProgressOperationId()));
            }
        } else if (event instanceof ProgressCompleteEvent) {
            ProgressCompleteEvent completeEvent = (ProgressCompleteEvent) event;
            if (!operationIdsToSkip.contains(completeEvent.getProgressOperationId())) {
                detach(operations.complete(completeEvent.getProgressOperationId()));
            }
        } else if (event instanceof ProgressEvent) {
            ProgressEvent progressEvent = (ProgressEvent) event;
            if (!operationIdsToSkip.contains(progressEvent.getProgressOperationId())) {
                operations.progress(progressEvent.getStatus(), progressEvent.getProgressOperationId());
            }
        }
    }
    queue.clear();
    for (AssociationLabel associatedLabel : operationIdToAssignedLabels.values()) {
        associatedLabel.renderNow();
    }
    for (StyledLabel emptyLabel : unusedProgressLabels) {
        emptyLabel.setText(labelFormatter.format());
    }
}
Also used : OutputEvent(org.gradle.internal.logging.events.OutputEvent) EndOutputEvent(org.gradle.internal.logging.events.EndOutputEvent) ProgressStartEvent(org.gradle.internal.logging.events.ProgressStartEvent) OperationIdentifier(org.gradle.internal.operations.OperationIdentifier) ProgressCompleteEvent(org.gradle.internal.logging.events.ProgressCompleteEvent) ProgressEvent(org.gradle.internal.logging.events.ProgressEvent) HashSet(java.util.HashSet)

Example 2 with OutputEvent

use of org.gradle.internal.logging.events.OutputEvent in project gradle by gradle.

the class ThrottlingOutputEventListener method renderNow.

private void renderNow(long now) {
    if (queue.isEmpty()) {
        // Already rendered - don't update anything
        return;
    }
    for (OutputEvent event : queue) {
        listener.onOutput(event);
    }
    queue.clear();
    lastUpdate = now;
}
Also used : OutputEvent(org.gradle.internal.logging.events.OutputEvent) EndOutputEvent(org.gradle.internal.logging.events.EndOutputEvent) FlushOutputEvent(org.gradle.internal.logging.events.FlushOutputEvent)

Aggregations

EndOutputEvent (org.gradle.internal.logging.events.EndOutputEvent)2 OutputEvent (org.gradle.internal.logging.events.OutputEvent)2 HashSet (java.util.HashSet)1 FlushOutputEvent (org.gradle.internal.logging.events.FlushOutputEvent)1 ProgressCompleteEvent (org.gradle.internal.logging.events.ProgressCompleteEvent)1 ProgressEvent (org.gradle.internal.logging.events.ProgressEvent)1 ProgressStartEvent (org.gradle.internal.logging.events.ProgressStartEvent)1 OperationIdentifier (org.gradle.internal.operations.OperationIdentifier)1