Search in sources :

Example 1 with ChromeTraceBuildListener

use of com.facebook.buck.event.listener.ChromeTraceBuildListener in project buck by facebook.

the class Main method addEventListeners.

@SuppressWarnings("PMD.PrematureDeclaration")
private ImmutableList<BuckEventListener> addEventListeners(BuckEventBus buckEventBus, ProjectFilesystem projectFilesystem, InvocationInfo invocationInfo, BuckConfig buckConfig, Optional<WebServer> webServer, Clock clock, AbstractConsoleEventBusListener consoleEventBusListener, Supplier<BuckEventListener> missingSymbolsListenerSupplier, CounterRegistry counterRegistry, Iterable<BuckEventListener> commandSpecificEventListeners) {
    ImmutableList.Builder<BuckEventListener> eventListenersBuilder = ImmutableList.<BuckEventListener>builder().add(new JavaUtilsLoggingBuildListener()).add(consoleEventBusListener).add(new LoggingBuildListener());
    if (buckConfig.isChromeTraceCreationEnabled()) {
        try {
            eventListenersBuilder.add(new ChromeTraceBuildListener(projectFilesystem, invocationInfo, clock, objectMapper, buckConfig.getMaxTraces(), buckConfig.getCompressTraces()));
        } catch (IOException e) {
            LOG.error("Unable to create ChromeTrace listener!");
        }
    } else {
        LOG.warn("::: ChromeTrace listener disabled");
    }
    if (webServer.isPresent()) {
        eventListenersBuilder.add(webServer.get().createListener());
    }
    loadListenersFromBuckConfig(eventListenersBuilder, projectFilesystem, buckConfig);
    if (buckConfig.isRuleKeyLoggerEnabled()) {
        eventListenersBuilder.add(new RuleKeyLoggerListener(projectFilesystem, invocationInfo, MostExecutors.newSingleThreadExecutor(new CommandThreadFactory(getClass().getName()))));
    }
    if (buckConfig.isMachineReadableLoggerEnabled()) {
        try {
            eventListenersBuilder.add(new MachineReadableLoggerListener(invocationInfo, projectFilesystem, MostExecutors.newSingleThreadExecutor(new CommandThreadFactory(getClass().getName()))));
        } catch (FileNotFoundException e) {
            LOG.warn("Unable to open stream for machine readable log file.");
        }
    }
    JavaBuckConfig javaBuckConfig = buckConfig.getView(JavaBuckConfig.class);
    if (!javaBuckConfig.getSkipCheckingMissingDeps()) {
        eventListenersBuilder.add(missingSymbolsListenerSupplier.get());
    }
    eventListenersBuilder.add(new LoadBalancerEventsListener(counterRegistry));
    eventListenersBuilder.add(new CacheRateStatsListener(buckEventBus));
    eventListenersBuilder.add(new WatchmanDiagnosticEventListener(buckEventBus));
    eventListenersBuilder.addAll(commandSpecificEventListeners);
    ImmutableList<BuckEventListener> eventListeners = eventListenersBuilder.build();
    eventListeners.forEach(buckEventBus::register);
    return eventListeners;
}
Also used : LoggingBuildListener(com.facebook.buck.event.listener.LoggingBuildListener) JavaUtilsLoggingBuildListener(com.facebook.buck.event.listener.JavaUtilsLoggingBuildListener) ImmutableList(com.google.common.collect.ImmutableList) CommandThreadFactory(com.facebook.buck.log.CommandThreadFactory) FileNotFoundException(java.io.FileNotFoundException) JavaUtilsLoggingBuildListener(com.facebook.buck.event.listener.JavaUtilsLoggingBuildListener) MachineReadableLoggerListener(com.facebook.buck.event.listener.MachineReadableLoggerListener) JavaBuckConfig(com.facebook.buck.jvm.java.JavaBuckConfig) BuckEventListener(com.facebook.buck.event.BuckEventListener) IOException(java.io.IOException) WatchmanDiagnosticEventListener(com.facebook.buck.io.WatchmanDiagnosticEventListener) ChromeTraceBuildListener(com.facebook.buck.event.listener.ChromeTraceBuildListener) CacheRateStatsListener(com.facebook.buck.event.listener.CacheRateStatsListener) RuleKeyLoggerListener(com.facebook.buck.event.listener.RuleKeyLoggerListener) LoadBalancerEventsListener(com.facebook.buck.event.listener.LoadBalancerEventsListener)

Aggregations

BuckEventListener (com.facebook.buck.event.BuckEventListener)1 CacheRateStatsListener (com.facebook.buck.event.listener.CacheRateStatsListener)1 ChromeTraceBuildListener (com.facebook.buck.event.listener.ChromeTraceBuildListener)1 JavaUtilsLoggingBuildListener (com.facebook.buck.event.listener.JavaUtilsLoggingBuildListener)1 LoadBalancerEventsListener (com.facebook.buck.event.listener.LoadBalancerEventsListener)1 LoggingBuildListener (com.facebook.buck.event.listener.LoggingBuildListener)1 MachineReadableLoggerListener (com.facebook.buck.event.listener.MachineReadableLoggerListener)1 RuleKeyLoggerListener (com.facebook.buck.event.listener.RuleKeyLoggerListener)1 WatchmanDiagnosticEventListener (com.facebook.buck.io.WatchmanDiagnosticEventListener)1 JavaBuckConfig (com.facebook.buck.jvm.java.JavaBuckConfig)1 CommandThreadFactory (com.facebook.buck.log.CommandThreadFactory)1 ImmutableList (com.google.common.collect.ImmutableList)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1