use of org.gradle.internal.logging.events.ProgressEvent 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.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());
}
}
use of org.gradle.internal.logging.events.ProgressEvent in project gradle by gradle.
the class OutputEventTransformer method onOutput.
@Override
public void onOutput(OutputEvent event) {
if (event instanceof ProgressStartEvent) {
ProgressStartEvent startEvent = (ProgressStartEvent) event;
if (!startEvent.isBuildOperationStart()) {
forwarded.add(startEvent.getProgressOperationId());
OperationIdentifier parentProgressOperationId = startEvent.getParentProgressOperationId();
if (parentProgressOperationId != null) {
OperationIdentifier mappedId = effectiveProgressOperation.get(parentProgressOperationId);
if (mappedId != null) {
startEvent = startEvent.withParentProgressOperation(mappedId);
}
}
listener.onOutput(startEvent);
return;
}
if (startEvent.getParentProgressOperationId() == null || GUtil.isTrue(startEvent.getLoggingHeader()) || GUtil.isTrue(startEvent.getStatus()) || startEvent.getBuildOperationCategory() != BuildOperationCategory.UNCATEGORIZED) {
forwarded.add(startEvent.getProgressOperationId());
OperationIdentifier parentProgressOperationId = startEvent.getParentProgressOperationId();
if (parentProgressOperationId != null) {
OperationIdentifier mappedId = effectiveProgressOperation.get(parentProgressOperationId);
if (mappedId != null) {
startEvent = startEvent.withParentProgressOperation(mappedId);
}
}
listener.onOutput(startEvent);
} else {
// Ignore this progress operation, and map any reference to it to its parent (or whatever its parent is mapped to)
OperationIdentifier mappedParent = effectiveProgressOperation.get(startEvent.getParentProgressOperationId());
if (mappedParent == null) {
mappedParent = startEvent.getParentProgressOperationId();
}
effectiveProgressOperation.put(startEvent.getProgressOperationId(), mappedParent);
}
} else if (event instanceof ProgressCompleteEvent) {
ProgressCompleteEvent completeEvent = (ProgressCompleteEvent) event;
OperationIdentifier mappedEvent = effectiveProgressOperation.remove(completeEvent.getProgressOperationId());
if (mappedEvent == null && forwarded.remove(completeEvent.getProgressOperationId())) {
listener.onOutput(event);
}
} else if (event instanceof ProgressEvent) {
ProgressEvent progressEvent = (ProgressEvent) event;
if (forwarded.contains(progressEvent.getProgressOperationId())) {
listener.onOutput(event);
}
} else if (event instanceof RenderableOutputEvent) {
RenderableOutputEvent outputEvent = (RenderableOutputEvent) event;
OperationIdentifier operationId = outputEvent.getBuildOperationId();
if (operationId != null) {
OperationIdentifier mappedId = effectiveProgressOperation.get(operationId);
if (mappedId != null) {
outputEvent = outputEvent.withBuildOperationId(mappedId);
}
}
listener.onOutput(outputEvent);
} else {
listener.onOutput(event);
}
}
use of org.gradle.internal.logging.events.ProgressEvent in project gradle by gradle.
the class WorkInProgressRenderer method onOutput.
@Override
public void onOutput(OutputEvent event) {
if (event instanceof ProgressStartEvent) {
progressArea.setVisible(true);
ProgressStartEvent startEvent = (ProgressStartEvent) event;
ProgressOperation op = operations.start(startEvent.getShortDescription(), startEvent.getStatus(), startEvent.getCategory(), startEvent.getOperationId(), startEvent.getParentId());
attach(op);
} else if (event instanceof ProgressCompleteEvent) {
ProgressCompleteEvent completeEvent = (ProgressCompleteEvent) event;
detach(operations.complete(completeEvent.getOperationId()));
} else if (event instanceof ProgressEvent) {
ProgressEvent progressEvent = (ProgressEvent) event;
operations.progress(progressEvent.getStatus(), progressEvent.getOperationId());
} else if (event instanceof EndOutputEvent) {
progressArea.setVisible(false);
}
listener.onOutput(event);
}
use of org.gradle.internal.logging.events.ProgressEvent in project gradle by gradle.
the class ProgressEventSerializer method read.
@Override
public ProgressEvent read(Decoder decoder) throws Exception {
OperationIdentifier id = new OperationIdentifier(decoder.readSmallLong());
String status = decoder.readString();
boolean failing = decoder.readBoolean();
return new ProgressEvent(id, status, failing);
}
Aggregations