Search in sources :

Example 1 with OperationIdentifier

use of org.gradle.internal.operations.OperationIdentifier 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 OperationIdentifier

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

the class ProgressCompleteEventSerializer method read.

@Override
public ProgressCompleteEvent read(Decoder decoder) throws Exception {
    OperationIdentifier id = new OperationIdentifier(decoder.readSmallLong());
    long timestamp = decoder.readLong();
    String status = decoder.readString();
    boolean failed = decoder.readBoolean();
    return new ProgressCompleteEvent(id, timestamp, status, failed);
}
Also used : OperationIdentifier(org.gradle.internal.operations.OperationIdentifier) ProgressCompleteEvent(org.gradle.internal.logging.events.ProgressCompleteEvent)

Example 3 with OperationIdentifier

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

the class StyledTextOutputEventSerializer method read.

@Override
public StyledTextOutputEvent read(Decoder decoder) throws Exception {
    long timestamp = decoder.readLong();
    String category = decoder.readString();
    LogLevel logLevel = logLevelSerializer.read(decoder);
    OperationIdentifier buildOperationId = decoder.readBoolean() ? new OperationIdentifier(decoder.readSmallLong()) : null;
    List<StyledTextOutputEvent.Span> spans = spanSerializer.read(decoder);
    return new StyledTextOutputEvent(timestamp, category, logLevel, buildOperationId, spans);
}
Also used : OperationIdentifier(org.gradle.internal.operations.OperationIdentifier) StyledTextOutputEvent(org.gradle.internal.logging.events.StyledTextOutputEvent) LogLevel(org.gradle.api.logging.LogLevel)

Example 4 with OperationIdentifier

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

the class TestListenerBuildOperationAdapter method createTestBuildOperationDescriptor.

private BuildOperationDescriptor createTestBuildOperationDescriptor(TestDescriptor testDescriptor, TestStartEvent testStartEvent) {
    Details details = new Details(testDescriptor, testStartEvent.getStartTime());
    InProgressExecuteTestBuildOperation parentOperation = runningTests.get(testDescriptor.getParent());
    OperationIdentifier parentId = parentOperation == null ? CurrentBuildOperationRef.instance().getId() : parentOperation.descriptor.getId();
    return BuildOperationDescriptor.displayName(testDescriptor.getName()).details(details).build(newOperationIdentifier(), parentId);
}
Also used : OperationIdentifier(org.gradle.internal.operations.OperationIdentifier)

Example 5 with OperationIdentifier

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

the class ClientForwardingTaskOperationListener method started.

@Override
public void started(BuildOperationDescriptor buildOperation, OperationStartEvent startEvent) {
    OperationIdentifier parentId = buildOperation.getParentId();
    if (parentId != null && skipEvents.contains(parentId)) {
        skipEvents.add(buildOperation.getId());
        return;
    }
    if (buildOperation.getDetails() instanceof ExecuteTaskBuildOperationDetails) {
        if (clientSubscriptions.isSendTaskProgressEvents()) {
            Task task = ((ExecuteTaskBuildOperationDetails) buildOperation.getDetails()).getTask();
            eventConsumer.dispatch(new DefaultTaskStartedProgressEvent(startEvent.getStartTime(), toTaskDescriptor(buildOperation, (TaskInternal) task)));
        } else {
            // Discard this operation and all children
            skipEvents.add(buildOperation.getId());
        }
    } else {
        delegate.started(buildOperation, startEvent);
    }
}
Also used : Task(org.gradle.api.Task) ExecuteTaskBuildOperationDetails(org.gradle.api.execution.internal.ExecuteTaskBuildOperationDetails) DefaultTaskStartedProgressEvent(org.gradle.tooling.internal.provider.events.DefaultTaskStartedProgressEvent) OperationIdentifier(org.gradle.internal.operations.OperationIdentifier)

Aggregations

OperationIdentifier (org.gradle.internal.operations.OperationIdentifier)11 LogLevel (org.gradle.api.logging.LogLevel)2 LogEvent (org.gradle.internal.logging.events.LogEvent)2 ProgressCompleteEvent (org.gradle.internal.logging.events.ProgressCompleteEvent)2 ProgressEvent (org.gradle.internal.logging.events.ProgressEvent)2 ProgressStartEvent (org.gradle.internal.logging.events.ProgressStartEvent)2 StyledTextOutputEvent (org.gradle.internal.logging.events.StyledTextOutputEvent)2 BuildOperationCategory (org.gradle.internal.operations.BuildOperationCategory)2 HashSet (java.util.HashSet)1 Task (org.gradle.api.Task)1 ExecuteTaskBuildOperationDetails (org.gradle.api.execution.internal.ExecuteTaskBuildOperationDetails)1 EndOutputEvent (org.gradle.internal.logging.events.EndOutputEvent)1 OutputEvent (org.gradle.internal.logging.events.OutputEvent)1 OutputEventListener (org.gradle.internal.logging.events.OutputEventListener)1 DefaultTaskStartedProgressEvent (org.gradle.tooling.internal.provider.events.DefaultTaskStartedProgressEvent)1