private static SingleExecutionOutputProcessor outputProcessor(
final TaskOutputProcessor processor,
SingleExecutionOutputProcessor processorFactory) {
final SingleExecutionOutputProcessor nullSafeProcessorFactory = processorFactory != null
? processorFactory
: NoOpSingleExecutionOutputProcessor.INSTANCE;
if (processor == null) {
return nullSafeProcessorFactory;
}
return new SingleExecutionOutputProcessor() {
@Override
public TaskOutputProcessor startExecution(Project project) {
return mergedOutputProcessor(
processor,
nullSafeProcessorFactory.startExecution(project));
}
};
}