use of org.gradle.internal.logging.events.ProgressCompleteEvent 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);
}
use of org.gradle.internal.logging.events.ProgressCompleteEvent 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.ProgressCompleteEvent 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.ProgressCompleteEvent 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.ProgressCompleteEvent in project gradle by gradle.
the class BuildStatusRenderer method onOutput.
@Override
public void onOutput(OutputEvent event) {
if (event instanceof ProgressStartEvent) {
ProgressStartEvent startEvent = (ProgressStartEvent) event;
if (startEvent.isBuildOperationStart()) {
if (buildStartTimestamp == 0 && startEvent.getParentProgressOperationId() == null) {
// The very first event starts the Initializing phase
// TODO - should use BuildRequestMetaData to determine the build start time
buildStartTimestamp = startEvent.getTimestamp();
buildProgressOperationId = startEvent.getProgressOperationId();
phaseStarted(startEvent, Phase.Initializing);
} else if (startEvent.getBuildOperationCategory() == BuildOperationCategory.CONFIGURE_ROOT_BUILD) {
// Once the root build starts configuring, we are in Configuring phase
phaseStarted(startEvent, Phase.Configuring);
} else if (startEvent.getBuildOperationCategory() == BuildOperationCategory.CONFIGURE_BUILD && currentPhase == Phase.Configuring) {
// Any configuring event received from nested or buildSrc builds before the root build starts configuring is ignored
phaseHasMoreProgress(startEvent);
} else if (startEvent.getBuildOperationCategory() == BuildOperationCategory.CONFIGURE_PROJECT && currentPhase == Phase.Configuring) {
// Any configuring event received from nested or buildSrc builds before the root build starts configuring is ignored
currentPhaseChildren.add(startEvent.getProgressOperationId());
} else if (startEvent.getBuildOperationCategory() == BuildOperationCategory.RUN_MAIN_TASKS) {
phaseStarted(startEvent, Phase.Executing);
} else if (startEvent.getBuildOperationCategory() == BuildOperationCategory.RUN_WORK && currentPhase == Phase.Executing) {
// Any work execution happening in nested or buildSrc builds before the root build has started executing work is ignored
phaseHasMoreProgress(startEvent);
} else if (startEvent.getBuildOperationCategory().isTopLevelWorkItem() && currentPhase == Phase.Executing) {
// Any work execution happening in nested or buildSrc builds before the root build has started executing work is ignored
currentPhaseChildren.add(startEvent.getProgressOperationId());
}
}
} else if (event instanceof ProgressCompleteEvent) {
ProgressCompleteEvent completeEvent = (ProgressCompleteEvent) event;
if (completeEvent.getProgressOperationId().equals(buildProgressOperationId)) {
buildEnded();
} else if (currentPhaseChildren.remove(completeEvent.getProgressOperationId())) {
phaseProgressed(completeEvent);
}
}
listener.onOutput(event);
if (event instanceof UpdateNowEvent) {
currentTimePeriod = ((UpdateNowEvent) event).getTimestamp();
renderNow(currentTimePeriod);
} else if (event instanceof EndOutputEvent || event instanceof FlushOutputEvent) {
renderNow(currentTimePeriod);
}
}
Aggregations