Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.launcher.daemon.protocol;
import org.gradle.api.logging.LogLevel;
import org.gradle.configuration.GradleLauncherMetaData;
import org.gradle.internal.classpath.ClassPath;
import org.gradle.internal.classpath.DefaultClassPath;
import org.gradle.internal.invocation.BuildAction;
import org.gradle.internal.logging.events.LogEvent;
import org.gradle.internal.logging.events.LogLevelChangeEvent;
import org.gradle.internal.logging.events.OutputEvent;
import org.gradle.internal.logging.events.ProgressCompleteEvent;
import org.gradle.internal.logging.events.ProgressEvent;
import org.gradle.internal.logging.events.ProgressStartEvent;
import org.gradle.internal.logging.events.StyledTextOutputEvent;
import org.gradle.internal.logging.events.UserInputRequestEvent;
import org.gradle.internal.logging.events.UserInputResumeEvent;
import org.gradle.internal.logging.serializer.LogEventSerializer;
import org.gradle.internal.logging.serializer.LogLevelChangeEventSerializer;
import org.gradle.internal.logging.serializer.ProgressCompleteEventSerializer;
import org.gradle.internal.logging.serializer.ProgressEventSerializer;
import org.gradle.internal.logging.serializer.ProgressStartEventSerializer;
import org.gradle.internal.logging.serializer.SpanSerializer;
import org.gradle.internal.logging.serializer.StyledTextOutputEventSerializer;
import org.gradle.internal.logging.serializer.UserInputRequestEventSerializer;
import org.gradle.internal.logging.serializer.UserInputResumeEventSerializer;
import org.gradle.internal.logging.text.StyledTextOutput;
import org.gradle.internal.serialize.BaseSerializerFactory;
import org.gradle.internal.serialize.Decoder;
import org.gradle.internal.serialize.DefaultSerializer;
import org.gradle.internal.serialize.DefaultSerializerRegistry;
import org.gradle.internal.serialize.Encoder;
import org.gradle.internal.serialize.ListSerializer;
import org.gradle.internal.serialize.Serializer;
import org.gradle.launcher.daemon.diagnostics.DaemonDiagnostics;
import org.gradle.launcher.exec.BuildActionParameters;
import org.gradle.launcher.exec.DefaultBuildActionParameters;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static org.gradle.internal.serialize.BaseSerializerFactory.FILE_SERIALIZER;
import static org.gradle.internal.serialize.BaseSerializerFactory.NO_NULL_STRING_MAP_SERIALIZER;
public class DaemonMessageSerializer {
public static Serializer create(Serializer buildActionSerializer) {
BaseSerializerFactory factory = new BaseSerializerFactory();
Serializer logLevelSerializer = factory.getSerializerFor(LogLevel.class);
Serializer throwableSerializer = factory.getSerializerFor(Throwable.class);
DefaultSerializerRegistry registry = new DefaultSerializerRegistry();
// Lifecycle messages
registry.register(Build.class, new BuildSerializer(buildActionSerializer));
registry.register(Cancel.class, new CancelSerializer());
registry.register(DaemonUnavailable.class, new DaemonUnavailableSerializer());
registry.register(BuildStarted.class, new BuildStartedSerializer());
registry.register(Failure.class, new FailureSerializer(throwableSerializer));
registry.register(Success.class, new SuccessSerializer());
registry.register(Finished.class, new FinishedSerializer());
// Build events
registry.register(BuildEvent.class, new BuildEventSerializer());
// Input events
registry.register(ForwardInput.class, new ForwardInputSerializer());
registry.register(CloseInput.class, new CloseInputSerializer());
// Output events
registry.register(LogEvent.class, new LogEventSerializer(logLevelSerializer, throwableSerializer));
registry.register(UserInputRequestEvent.class, new UserInputRequestEventSerializer());
registry.register(UserInputResumeEvent.class, new UserInputResumeEventSerializer());
registry.register(StyledTextOutputEvent.class, new StyledTextOutputEventSerializer(logLevelSerializer, new ListSerializer(new SpanSerializer(factory.getSerializerFor(StyledTextOutput.Style.class)))));
registry.register(ProgressStartEvent.class, new ProgressStartEventSerializer());
registry.register(ProgressCompleteEvent.class, new ProgressCompleteEventSerializer());
registry.register(ProgressEvent.class, new ProgressEventSerializer());
registry.register(LogLevelChangeEvent.class, new LogLevelChangeEventSerializer(logLevelSerializer));
registry.register(OutputMessage.class, new OutputMessageSerializer(registry.build(OutputEvent.class)));
// Default for everything else
registry.useJavaSerialization(Message.class);
return registry.build(Message.class);
}
private static class SuccessSerializer implements Serializer {
private final Serializer