@Inject public Test( ListenerManager listenerManager, StyledTextOutputFactory textOutputFactory, FileResolver fileResolver, Factory<WorkerProcessBuilder> processBuilderFactory, ActorFactory actorFactory, Instantiator instantiator, ProgressLoggerFactory progressLoggerFactory) { this.progressLoggerFactory = progressLoggerFactory; this.instantiator = instantiator; testListenerBroadcaster = listenerManager.createAnonymousBroadcaster(TestListener.class); testOutputListenerBroadcaster = listenerManager.createAnonymousBroadcaster(TestOutputListener.class); this.textOutputFactory = textOutputFactory; forkOptions = new DefaultJavaForkOptions(fileResolver); forkOptions.setEnableAssertions(true); testExecuter = new DefaultTestExecuter(processBuilderFactory, actorFactory); testLogging = instantiator.newInstance(DefaultTestLoggingContainer.class, instantiator); testReporter = new DefaultTestReport(); reports = instantiator.newInstance(DefaultTestTaskReports.class, this); reports.getJunitXml().setEnabled(true); reports.getHtml().setEnabled(true); filter = instantiator.newInstance(DefaultTestFilter.class); }
public DefaultGradleLauncherFactory(ServiceRegistry globalServices) { sharedServices = globalServices; tracker = new NestedBuildTracker(); // Register default loggers ListenerManager listenerManager = sharedServices.get(ListenerManager.class); listenerManager.addListener( new BuildProgressLogger(sharedServices.get(ProgressLoggerFactory.class))); listenerManager.useLogger( new DependencyResolutionLogger(sharedServices.get(ProgressLoggerFactory.class))); GradleLauncher.injectCustomFactory(this); }
protected ListenerManager createListenerManager(ListenerManager listenerManager) { return listenerManager.createChild(); }
public DefaultExceptionAnalyser(ListenerManager listenerManager) { listenerManager.addListener(this); }
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)); listenerManager.useLogger( new TaskExecutionLogger(serviceRegistry.get(ProgressLoggerFactory.class))); 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); return new DefaultGradleLauncher( gradle, serviceRegistry.get(InitScriptHandler.class), new SettingsHandler( new DefaultSettingsFinder(new BuildLayoutFactory()), serviceRegistry.get(SettingsProcessor.class), new BuildSourceBuilder( this, serviceRegistry.get(ClassLoaderRegistry.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)); }