public AtlasExtension(@NonNull final ProjectInternal project, @NonNull Instantiator instantiator, @NonNull NamedDomainObjectContainer<T> buildTypes, @NonNull NamedDomainObjectContainer<PatchConfig> patchConfigs, @NonNull NamedDomainObjectContainer<DexConfig>dexConfigs) { logger = Logging.getLogger(this.getClass()); this.project = project; this.patchConfigs = patchConfigs; this.dexConfigs = dexConfigs; this.buildTypes = buildTypes; this.multiDexConfigs = project.container(MultiDexConfig.class, new MultiDexConfigFactory( instantiator,project, project.getLogger())); tBuildConfig = (Z) instantiator.newInstance(TBuildConfig.class); manifestOptions = instantiator.newInstance(ManifestOptions.class); bundleConfig = instantiator.newInstance(BundleConfig.class); }
public TaskManager( Project project, AndroidBuilder androidBuilder, AndroidConfig extension, SdkHandler sdkHandler, DependencyManager dependencyManager, ToolingModelBuilderRegistry toolingRegistry) { this.project = project; this.androidBuilder = androidBuilder; this.sdkHandler = sdkHandler; this.extension = extension; this.toolingRegistry = toolingRegistry; this.dependencyManager = dependencyManager; logger = Logging.getLogger(this.getClass()); globalScope = new GlobalScope( project, androidBuilder, (String) project.getProperties().get("archivesBaseName"), extension, sdkHandler, toolingRegistry); }
/** * Maps a Logback log level and optional marker to a Gradle log level. * Returns null if there is no equivalent Gradle log level (such as for TRACE). */ @Nullable public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) { switch(level.toInt()) { case Level.TRACE_INT: return null; case Level.DEBUG_INT: return LogLevel.DEBUG; case Level.INFO_INT: if (marker == Logging.LIFECYCLE) { return LogLevel.LIFECYCLE; } if (marker == Logging.QUIET) { return LogLevel.QUIET; } return LogLevel.INFO; case Level.WARN_INT: return LogLevel.WARN; case Level.ERROR_INT: return LogLevel.ERROR; default: throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level"); } }
public void messageLogged(BuildEvent event) { final StringBuffer message = new StringBuffer(); if (event.getTask() != null) { String taskName = event.getTask().getTaskName(); message.append("[ant:").append(taskName).append("] "); } final String messageText = event.getMessage(); message.append(messageText); LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority()); if (event.getException() != null) { logger.log(level, message.toString(), event.getException()); } else { logger.log(level, message.toString()); } }
private LogLevel toLogLevel(Marker marker) { if (marker == null) { return LogLevel.INFO; } if (marker == Logging.LIFECYCLE) { return LogLevel.LIFECYCLE; } if (marker == Logging.QUIET) { return LogLevel.QUIET; } return LogLevel.INFO; }
protected AbstractGradleExecuter(GradleDistribution distribution, TestDirectoryProvider testDirectoryProvider, GradleVersion gradleVersion, IntegrationTestBuildContext buildContext) { this.distribution = distribution; this.testDirectoryProvider = testDirectoryProvider; this.gradleVersion = gradleVersion; logger = Logging.getLogger(getClass()); this.buildContext = buildContext; gradleUserHomeDir = buildContext.getGradleUserHomeDir(); daemonBaseDir = buildContext.getDaemonBaseDir(); }
private PlayAppLifecycleUpdate startServer() { try { run(); return PlayAppLifecycleUpdate.running(); } catch (Exception e) { Logging.getLogger(this.getClass()).error("Failed to run Play", e); return PlayAppLifecycleUpdate.failed(e); } }
public AtlasBaseTaskManager(AtlasBuilder androidBuilder, T androidExtension, Project project, AtlasExtension atlasExtension) { this.tAndroidBuilder = androidBuilder; this.androidExtension = androidExtension; this.project = project; this.tasks = new TaskContainerAdaptor(project.getTasks()); this.atlasExtension = atlasExtension; this.extraModelInfo = new ExtraModelInfo(project); this.logger = new LoggerWrapper(Logging.getLogger(AtlasBaseTaskManager.class)); //this.dependencyManager = new DependencyManager(androidExtension, project, atlasExtension); }
public DependencyManager( @NonNull Project project, @NonNull ExtraModelInfo extraModelInfo, @NonNull SdkHandler sdkHandler) { this.project = project; this.extraModelInfo = extraModelInfo; this.sdkHandler = sdkHandler; logger = new LoggerWrapper(Logging.getLogger(DependencyManager.class)); }
private DefaultGradleLauncher doNewInstance(StartParameter startParameter, GradleLauncher parent, BuildCancellationToken cancellationToken, BuildRequestMetaData requestMetaData, BuildEventConsumer buildEventConsumer, final BuildSessionScopeServices sessionScopeServices, List<?> servicesToStop) { BuildScopeServices serviceRegistry = BuildScopeServices.forSession(sessionScopeServices); serviceRegistry.add(BuildRequestMetaData.class, requestMetaData); serviceRegistry.add(BuildClientMetaData.class, requestMetaData.getClient()); serviceRegistry.add(BuildEventConsumer.class, buildEventConsumer); serviceRegistry.add(BuildCancellationToken.class, cancellationToken); NestedBuildFactoryImpl nestedBuildFactory = new NestedBuildFactoryImpl(sessionScopeServices); serviceRegistry.add(NestedBuildFactory.class, nestedBuildFactory); ListenerManager listenerManager = serviceRegistry.get(ListenerManager.class); LoggingManagerInternal loggingManager = serviceRegistry.newInstance(LoggingManagerInternal.class); loggingManager.setLevelInternal(startParameter.getLogLevel()); //this hooks up the ListenerManager and LoggingConfigurer so you can call Gradle.addListener() with a StandardOutputListener. loggingManager.addStandardOutputListener(listenerManager.getBroadcaster(StandardOutputListener.class)); loggingManager.addStandardErrorListener(listenerManager.getBroadcaster(StandardOutputListener.class)); LoggerProvider loggerProvider = (parent == null) ? buildProgressLogger : LoggerProvider.NO_OP; listenerManager.useLogger(new TaskExecutionLogger(serviceRegistry.get(ProgressLoggerFactory.class), loggerProvider)); if (parent == null) { listenerManager.useLogger(new BuildLogger(Logging.getLogger(BuildLogger.class), serviceRegistry.get(StyledTextOutputFactory.class), startParameter, requestMetaData)); } if (startParameter.isTaskOutputCacheEnabled()) { listenerManager.addListener(serviceRegistry.get(TaskExecutionStatisticsEventAdapter.class)); listenerManager.addListener(new CacheStatisticsReporter(serviceRegistry.get(StyledTextOutputFactory.class))); } listenerManager.addListener(serviceRegistry.get(ProfileEventAdapter.class)); if (startParameter.isProfile()) { listenerManager.addListener(new ReportGeneratingProfileListener()); } ScriptUsageLocationReporter usageLocationReporter = new ScriptUsageLocationReporter(); listenerManager.addListener(usageLocationReporter); ShowStacktrace showStacktrace = startParameter.getShowStacktrace(); switch (showStacktrace) { case ALWAYS: case ALWAYS_FULL: LoggingDeprecatedFeatureHandler.setTraceLoggingEnabled(true); break; default: LoggingDeprecatedFeatureHandler.setTraceLoggingEnabled(false); } DeprecationLogger.useLocationReporter(usageLocationReporter); SettingsLoaderFactory settingsLoaderFactory = serviceRegistry.get(SettingsLoaderFactory.class); SettingsLoader settingsLoader = parent != null ? settingsLoaderFactory.forNestedBuild() : settingsLoaderFactory.forTopLevelBuild(); GradleInternal parentBuild = parent == null ? null : parent.getGradle(); GradleInternal gradle = serviceRegistry.get(Instantiator.class).newInstance(DefaultGradle.class, parentBuild, startParameter, serviceRegistry.get(ServiceRegistryFactory.class)); DefaultGradleLauncher gradleLauncher = new DefaultGradleLauncher( gradle, serviceRegistry.get(InitScriptHandler.class), settingsLoader, serviceRegistry.get(BuildConfigurer.class), serviceRegistry.get(ExceptionAnalyser.class), loggingManager, gradle.getBuildListenerBroadcaster(), listenerManager.getBroadcaster(ModelConfigurationListener.class), listenerManager.getBroadcaster(BuildCompletionListener.class), serviceRegistry.get(BuildOperationExecutor.class), gradle.getServices().get(BuildConfigurationActionExecuter.class), gradle.getServices().get(BuildExecuter.class), serviceRegistry, globalListenerManager, servicesToStop ); nestedBuildFactory.setParent(gradleLauncher); return gradleLauncher; }
public DefaultBuildOperationLoggerFactory() { this(Logging.getLogger(DefaultBuildOperationLoggerFactory.class)); }
public DummyRewriter() { _log = Logging.getLogger(DummyRewriter.class.getSimpleName()); }
public PerformanceTrackingRewriter() { _log = Logging.getLogger(PerformanceTrackingRewriter.class.getSimpleName()); }
/** * Create a new plugin */ public AbstractProjectConfigPlugin() { this.logger = Logging.getLogger(getClass()); }
public DependencyManager(Project project, ExtraModelInfo extraModelInfo) { this.project = project; this.extraModelInfo = extraModelInfo; logger = new LoggerWrapper(Logging.getLogger(DependencyManager.class)); }
protected AbstractGradleExecuter(GradleDistribution distribution, TestDirectoryProvider testDirectoryProvider) { this.distribution = distribution; this.testDirectoryProvider = testDirectoryProvider; logger = Logging.getLogger(getClass()); }
public void log(String msg, int level) { logger.log(Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(level), msg); }
private DefaultGradleLauncher doNewInstance(StartParameter startParameter, BuildCancellationToken cancellationToken, BuildRequestMetaData requestMetaData) { final BuildScopeServices serviceRegistry = new BuildScopeServices(sharedServices, startParameter); serviceRegistry.add(BuildRequestMetaData.class, requestMetaData); serviceRegistry.add(BuildClientMetaData.class, requestMetaData.getClient()); serviceRegistry.add(BuildCancellationToken.class, cancellationToken); ListenerManager listenerManager = serviceRegistry.get(ListenerManager.class); LoggingManagerInternal loggingManager = serviceRegistry.newInstance(LoggingManagerInternal.class); loggingManager.setLevel(startParameter.getLogLevel()); //this hooks up the ListenerManager and LoggingConfigurer so you can call Gradle.addListener() with a StandardOutputListener. loggingManager.addStandardOutputListener(listenerManager.getBroadcaster(StandardOutputListener.class)); loggingManager.addStandardErrorListener(listenerManager.getBroadcaster(StandardOutputListener.class)); LoggerProvider loggerProvider = (tracker.getCurrentBuild() == null) ? buildProgressLogger : LoggerProvider.NO_OP; listenerManager.useLogger(new TaskExecutionLogger(serviceRegistry.get(ProgressLoggerFactory.class), loggerProvider)); if (tracker.getCurrentBuild() == null) { listenerManager.useLogger(new BuildLogger(Logging.getLogger(BuildLogger.class), serviceRegistry.get(StyledTextOutputFactory.class), startParameter, requestMetaData)); } listenerManager.addListener(tracker); listenerManager.addListener(serviceRegistry.get(ProfileEventAdapter.class)); if (startParameter.isProfile()) { listenerManager.addListener(new ReportGeneratingProfileListener()); } ScriptUsageLocationReporter usageLocationReporter = new ScriptUsageLocationReporter(); listenerManager.addListener(usageLocationReporter); DeprecationLogger.useLocationReporter(usageLocationReporter); GradleInternal gradle = serviceRegistry.get(Instantiator.class).newInstance(DefaultGradle.class, tracker.getCurrentBuild(), startParameter, serviceRegistry.get(ServiceRegistryFactory.class)); return new DefaultGradleLauncher( gradle, serviceRegistry.get(InitScriptHandler.class), new SettingsHandler( new DefaultSettingsFinder( new BuildLayoutFactory()), serviceRegistry.get(SettingsProcessor.class), new BuildSourceBuilder( this, cancellationToken, serviceRegistry.get(ClassLoaderScopeRegistry.class).getCoreAndPluginsScope(), serviceRegistry.get(CacheRepository.class)) ), serviceRegistry.get(BuildLoader.class), serviceRegistry.get(BuildConfigurer.class), gradle.getBuildListenerBroadcaster(), serviceRegistry.get(ExceptionAnalyser.class), loggingManager, listenerManager.getBroadcaster(ModelConfigurationListener.class), listenerManager.getBroadcaster(TasksCompletionListener.class), gradle.getServices().get(BuildExecuter.class), listenerManager.getBroadcaster(BuildCompletionListener.class), serviceRegistry ); }
private DefaultGradleLauncher doNewInstance(StartParameter startParameter, BuildRequestMetaData requestMetaData) { final BuildScopeServices serviceRegistry = new BuildScopeServices(sharedServices, startParameter); serviceRegistry.add(BuildRequestMetaData.class, requestMetaData); serviceRegistry.add(BuildClientMetaData.class, requestMetaData.getClient()); ListenerManager listenerManager = serviceRegistry.get(ListenerManager.class); LoggingManagerInternal loggingManager = serviceRegistry.newInstance(LoggingManagerInternal.class); loggingManager.setLevel(startParameter.getLogLevel()); //this hooks up the ListenerManager and LoggingConfigurer so you can call Gradle.addListener() with a StandardOutputListener. loggingManager.addStandardOutputListener(listenerManager.getBroadcaster(StandardOutputListener.class)); loggingManager.addStandardErrorListener(listenerManager.getBroadcaster(StandardOutputListener.class)); LoggerProvider loggerProvider = (tracker.getCurrentBuild() == null)? buildProgressLogger: LoggerProvider.NO_OP; listenerManager.useLogger(new TaskExecutionLogger(serviceRegistry.get(ProgressLoggerFactory.class), loggerProvider)); if (tracker.getCurrentBuild() == null) { listenerManager.useLogger(new BuildLogger(Logging.getLogger(BuildLogger.class), serviceRegistry.get(StyledTextOutputFactory.class), startParameter, requestMetaData)); } listenerManager.addListener(tracker); listenerManager.addListener(new BuildCleanupListener(serviceRegistry)); listenerManager.addListener(serviceRegistry.get(ProfileEventAdapter.class)); if (startParameter.isProfile()) { listenerManager.addListener(new ReportGeneratingProfileListener()); } ScriptUsageLocationReporter usageLocationReporter = new ScriptUsageLocationReporter(); listenerManager.addListener(usageLocationReporter); DeprecationLogger.useLocationReporter(usageLocationReporter); GradleInternal gradle = serviceRegistry.get(Instantiator.class).newInstance(DefaultGradle.class, tracker.getCurrentBuild(), startParameter, serviceRegistry.get(ServiceRegistryFactory.class)); return new DefaultGradleLauncher( gradle, serviceRegistry.get(InitScriptHandler.class), new SettingsHandler( new DefaultSettingsFinder( new BuildLayoutFactory()), serviceRegistry.get(SettingsProcessor.class), new BuildSourceBuilder( this, serviceRegistry.get(ClassLoaderScope.class), serviceRegistry.get(CacheRepository.class))), serviceRegistry.get(BuildLoader.class), serviceRegistry.get(BuildConfigurer.class), gradle.getBuildListenerBroadcaster(), serviceRegistry.get(ExceptionAnalyser.class), loggingManager, listenerManager.getBroadcaster(ModelConfigurationListener.class), listenerManager.getBroadcaster(TasksCompletionListener.class), gradle.getServices().get(BuildExecuter.class)); }
/** * Create a new workspace plugin */ @Inject public WorkspacePlugin() { this.logger = Logging.getLogger(getClass()); }