Search in sources :

Example 1 with UpdateNowEvent

use of org.gradle.internal.logging.events.UpdateNowEvent 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);
    }
}
Also used : UpdateNowEvent(org.gradle.internal.logging.events.UpdateNowEvent) ProgressStartEvent(org.gradle.internal.logging.events.ProgressStartEvent) FlushOutputEvent(org.gradle.internal.logging.events.FlushOutputEvent) ProgressCompleteEvent(org.gradle.internal.logging.events.ProgressCompleteEvent) EndOutputEvent(org.gradle.internal.logging.events.EndOutputEvent)

Aggregations

EndOutputEvent (org.gradle.internal.logging.events.EndOutputEvent)1 FlushOutputEvent (org.gradle.internal.logging.events.FlushOutputEvent)1 ProgressCompleteEvent (org.gradle.internal.logging.events.ProgressCompleteEvent)1 ProgressStartEvent (org.gradle.internal.logging.events.ProgressStartEvent)1 UpdateNowEvent (org.gradle.internal.logging.events.UpdateNowEvent)1