Search in sources :

Example 6 with OperationIdentifier

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

the class LogEventSerializer method read.

@Override
public LogEvent read(Decoder decoder) throws Exception {
    long timestamp = decoder.readLong();
    String category = decoder.readString();
    LogLevel logLevel = logLevelSerializer.read(decoder);
    String message = decoder.readString();
    Throwable throwable = throwableSerializer.read(decoder);
    OperationIdentifier buildOperationId = decoder.readBoolean() ? new OperationIdentifier(decoder.readSmallLong()) : null;
    return new LogEvent(timestamp, category, logLevel, message, throwable, buildOperationId);
}
Also used : LogEvent(org.gradle.internal.logging.events.LogEvent) OperationIdentifier(org.gradle.internal.operations.OperationIdentifier) LogLevel(org.gradle.api.logging.LogLevel)

Example 7 with OperationIdentifier

use of org.gradle.internal.operations.OperationIdentifier 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);
}
Also used : OperationIdentifier(org.gradle.internal.operations.OperationIdentifier) ProgressEvent(org.gradle.internal.logging.events.ProgressEvent)

Example 8 with OperationIdentifier

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

the class ProgressStartEventSerializer method write.

@Override
public void write(Encoder encoder, ProgressStartEvent event) throws Exception {
    byte flags = 0;
    OperationIdentifier parentProgressOperationId = event.getParentProgressOperationId();
    if (parentProgressOperationId != null) {
        flags |= PARENT_PROGRESS_ID;
    }
    String shortDescription = event.getShortDescription();
    if (shortDescription != null) {
        flags |= SHORT_DESCRIPTION;
    }
    String loggingHeader = event.getLoggingHeader();
    if (loggingHeader != null) {
        flags |= LOGGING_HEADER;
    }
    OperationIdentifier buildOperationId = event.getBuildOperationId();
    if (buildOperationId != null) {
        flags |= BUILD_OPERATION_ID;
    }
    OperationIdentifier parentBuildOperationId = event.getParentBuildOperationId();
    if (parentBuildOperationId != null) {
        flags |= PARENT_BUILD_OPERATION_ID;
    }
    BuildOperationCategory buildOperationCategory = event.getBuildOperationCategory();
    if (buildOperationCategory == BuildOperationCategory.CONFIGURE_PROJECT) {
        flags |= BUILD_OPERATION_CATEGORY_PROJECT;
    } else if (buildOperationCategory == BuildOperationCategory.TASK) {
        flags |= BUILD_OPERATION_CATEGORY_TASK;
    } else if (buildOperationCategory != BuildOperationCategory.UNCATEGORIZED) {
        throw new IllegalArgumentException("Can't handle build operation category " + buildOperationCategory);
    }
    encoder.writeByte(flags);
    encoder.writeSmallLong(event.getProgressOperationId().getId());
    if (parentProgressOperationId != null) {
        encoder.writeSmallLong(parentProgressOperationId.getId());
    }
    encoder.writeLong(event.getTimestamp());
    encoder.writeString(event.getCategory());
    encoder.writeString(event.getDescription());
    if (shortDescription != null) {
        encoder.writeString(shortDescription);
    }
    if (loggingHeader != null) {
        encoder.writeString(loggingHeader);
    }
    encoder.writeString(event.getStatus());
    encoder.writeInt(event.getTotalProgress());
    encoder.writeBoolean(event.isBuildOperationStart());
    if (buildOperationId != null) {
        encoder.writeSmallLong(buildOperationId.getId());
    }
    if (parentBuildOperationId != null) {
        encoder.writeSmallLong(parentBuildOperationId.getId());
    }
}
Also used : OperationIdentifier(org.gradle.internal.operations.OperationIdentifier) BuildOperationCategory(org.gradle.internal.operations.BuildOperationCategory)

Example 9 with OperationIdentifier

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

the class ProgressStartEventSerializer method read.

@Override
public ProgressStartEvent read(Decoder decoder) throws Exception {
    byte flags = decoder.readByte();
    OperationIdentifier progressOperationId = new OperationIdentifier(decoder.readSmallLong());
    OperationIdentifier parentProgressOperationId = null;
    if ((flags & PARENT_PROGRESS_ID) != 0) {
        parentProgressOperationId = new OperationIdentifier(decoder.readSmallLong());
    }
    long timestamp = decoder.readLong();
    String category = decoder.readString();
    String description = decoder.readString();
    String shortDescription = null;
    if ((flags & SHORT_DESCRIPTION) != 0) {
        shortDescription = decoder.readString();
    }
    String loggingHeader = null;
    if ((flags & LOGGING_HEADER) != 0) {
        loggingHeader = decoder.readString();
    }
    String status = decoder.readString();
    int totalProgress = decoder.readInt();
    boolean buildOperationStart = decoder.readBoolean();
    OperationIdentifier buildOperationId = null;
    if ((flags & BUILD_OPERATION_ID) != 0) {
        buildOperationId = new OperationIdentifier(decoder.readSmallLong());
    }
    OperationIdentifier parentBuildOperationId = null;
    if ((flags & PARENT_BUILD_OPERATION_ID) != 0) {
        parentBuildOperationId = new OperationIdentifier(decoder.readSmallLong());
    }
    BuildOperationCategory buildOperationCategory;
    if ((flags & BUILD_OPERATION_CATEGORY_PROJECT) == BUILD_OPERATION_CATEGORY_PROJECT) {
        buildOperationCategory = BuildOperationCategory.CONFIGURE_PROJECT;
    } else if ((flags & BUILD_OPERATION_CATEGORY_TASK) == BUILD_OPERATION_CATEGORY_TASK) {
        buildOperationCategory = BuildOperationCategory.TASK;
    } else {
        buildOperationCategory = BuildOperationCategory.UNCATEGORIZED;
    }
    return new ProgressStartEvent(progressOperationId, parentProgressOperationId, timestamp, category, description, shortDescription, loggingHeader, status, totalProgress, buildOperationStart, buildOperationId, parentBuildOperationId, buildOperationCategory);
}
Also used : ProgressStartEvent(org.gradle.internal.logging.events.ProgressStartEvent) OperationIdentifier(org.gradle.internal.operations.OperationIdentifier) BuildOperationCategory(org.gradle.internal.operations.BuildOperationCategory)

Example 10 with OperationIdentifier

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

the class LoggingBackedStyledTextOutput method doEndLine.

@Override
protected void doEndLine(CharSequence endOfLine) {
    buffer.append(endOfLine);
    spans.add(new StyledTextOutputEvent.Span(this.style, buffer.toString()));
    buffer.setLength(0);
    OperationIdentifier buildOperationId = CurrentBuildOperationRef.instance().getId();
    listener.onOutput(new StyledTextOutputEvent(clock.getCurrentTime(), category, logLevel, buildOperationId, spans));
    spans = new ArrayList<StyledTextOutputEvent.Span>();
}
Also used : OperationIdentifier(org.gradle.internal.operations.OperationIdentifier) StyledTextOutputEvent(org.gradle.internal.logging.events.StyledTextOutputEvent)

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