Search in sources :

Example 1 with TrueTimeProvider

use of org.gradle.internal.time.TrueTimeProvider in project gradle by gradle.

the class SynchronizedLogging method services.

private ThreadLoggingServices services() {
    ThreadLoggingServices threadServices = services.get();
    if (threadServices == null) {
        DefaultListenerManager manager = new DefaultListenerManager();
        DefaultProgressLoggerFactory progressLoggerFactory = new DefaultProgressLoggerFactory(manager.getBroadcaster(ProgressListener.class), new TrueTimeProvider());
        threadServices = new ThreadLoggingServices(manager, progressLoggerFactory);
        services.set(threadServices);
    }
    return threadServices;
}
Also used : DefaultProgressLoggerFactory(org.gradle.internal.logging.progress.DefaultProgressLoggerFactory) ProgressListener(org.gradle.internal.logging.progress.ProgressListener) DefaultListenerManager(org.gradle.internal.event.DefaultListenerManager) TrueTimeProvider(org.gradle.internal.time.TrueTimeProvider)

Example 2 with TrueTimeProvider

use of org.gradle.internal.time.TrueTimeProvider in project gradle by gradle.

the class DefaultTestExecuter method execute.

@Override
public void execute(final Test testTask, TestResultProcessor testResultProcessor) {
    final TestFramework testFramework = testTask.getTestFramework();
    final WorkerTestClassProcessorFactory testInstanceFactory = testFramework.getProcessorFactory();
    final BuildOperationWorkerRegistry.Operation currentOperation = buildOperationWorkerRegistry.getCurrent();
    final Set<File> classpath = ImmutableSet.copyOf(testTask.getClasspath());
    final Factory<TestClassProcessor> forkingProcessorFactory = new Factory<TestClassProcessor>() {

        public TestClassProcessor create() {
            return new ForkingTestClassProcessor(workerFactory, testInstanceFactory, testTask, classpath, testFramework.getWorkerConfigurationAction(), moduleRegistry, currentOperation);
        }
    };
    Factory<TestClassProcessor> reforkingProcessorFactory = new Factory<TestClassProcessor>() {

        public TestClassProcessor create() {
            return new RestartEveryNTestClassProcessor(forkingProcessorFactory, testTask.getForkEvery());
        }
    };
    TestClassProcessor processor = new MaxNParallelTestClassProcessor(getMaxParallelForks(testTask), reforkingProcessorFactory, actorFactory);
    final FileTree testClassFiles = testTask.getCandidateClassFiles();
    Runnable detector;
    if (testTask.isScanForTestClasses()) {
        TestFrameworkDetector testFrameworkDetector = testTask.getTestFramework().getDetector();
        testFrameworkDetector.setTestClassesDirectory(testTask.getTestClassesDir());
        testFrameworkDetector.setTestClasspath(classpath);
        detector = new DefaultTestClassScanner(testClassFiles, testFrameworkDetector, processor);
    } else {
        detector = new DefaultTestClassScanner(testClassFiles, null, processor);
    }
    final Object testTaskOperationId = buildOperationExecutor.getCurrentOperation().getParentId();
    new TestMainAction(detector, processor, testResultProcessor, new TrueTimeProvider(), testTaskOperationId, testTask.getPath(), "Gradle Test Run " + testTask.getIdentityPath()).run();
}
Also used : WorkerTestClassProcessorFactory(org.gradle.api.internal.tasks.testing.WorkerTestClassProcessorFactory) BuildOperationWorkerRegistry(org.gradle.internal.operations.BuildOperationWorkerRegistry) WorkerProcessFactory(org.gradle.process.internal.worker.WorkerProcessFactory) Factory(org.gradle.internal.Factory) WorkerTestClassProcessorFactory(org.gradle.api.internal.tasks.testing.WorkerTestClassProcessorFactory) ActorFactory(org.gradle.internal.actor.ActorFactory) TestMainAction(org.gradle.api.internal.tasks.testing.processors.TestMainAction) TestClassProcessor(org.gradle.api.internal.tasks.testing.TestClassProcessor) RestartEveryNTestClassProcessor(org.gradle.api.internal.tasks.testing.processors.RestartEveryNTestClassProcessor) ForkingTestClassProcessor(org.gradle.api.internal.tasks.testing.worker.ForkingTestClassProcessor) MaxNParallelTestClassProcessor(org.gradle.api.internal.tasks.testing.processors.MaxNParallelTestClassProcessor) RestartEveryNTestClassProcessor(org.gradle.api.internal.tasks.testing.processors.RestartEveryNTestClassProcessor) TestFramework(org.gradle.api.internal.tasks.testing.TestFramework) MaxNParallelTestClassProcessor(org.gradle.api.internal.tasks.testing.processors.MaxNParallelTestClassProcessor) TrueTimeProvider(org.gradle.internal.time.TrueTimeProvider) ForkingTestClassProcessor(org.gradle.api.internal.tasks.testing.worker.ForkingTestClassProcessor) FileTree(org.gradle.api.file.FileTree) File(java.io.File)

Example 3 with TrueTimeProvider

use of org.gradle.internal.time.TrueTimeProvider in project gradle by gradle.

the class OutputEventRenderer method addConsole.

public OutputEventRenderer addConsole(Console console, boolean stdout, boolean stderr, ConsoleMetaData consoleMetaData) {
    final OutputEventListener consoleChain = new ThrottlingOutputEventListener(new BuildStatusRenderer(new WorkInProgressRenderer(new ProgressLogEventGenerator(new StyledTextOutputBackedRenderer(console.getBuildOutputArea()), true), console.getBuildProgressArea(), new DefaultWorkInProgressFormatter(consoleMetaData)), console.getStatusBar(), console, consoleMetaData), new TrueTimeProvider());
    synchronized (lock) {
        if (stdout && stderr) {
            this.console = consoleChain;
            removeStandardOutputListener();
            removeStandardErrorListener();
        } else if (stdout) {
            this.console = onNonError(consoleChain);
            removeStandardOutputListener();
        } else {
            this.console = onError(consoleChain);
            removeStandardErrorListener();
        }
        consoleChain.onOutput(new LogLevelChangeEvent(logLevel));
        formatters.add(this.console);
    }
    return this;
}
Also used : LogLevelChangeEvent(org.gradle.internal.logging.events.LogLevelChangeEvent) BuildStatusRenderer(org.gradle.internal.logging.console.BuildStatusRenderer) ThrottlingOutputEventListener(org.gradle.internal.logging.console.ThrottlingOutputEventListener) StyledTextOutputBackedRenderer(org.gradle.internal.logging.console.StyledTextOutputBackedRenderer) TrueTimeProvider(org.gradle.internal.time.TrueTimeProvider) WorkInProgressRenderer(org.gradle.internal.logging.console.WorkInProgressRenderer) OutputEventListener(org.gradle.internal.logging.events.OutputEventListener) BatchOutputEventListener(org.gradle.internal.logging.events.BatchOutputEventListener) ThrottlingOutputEventListener(org.gradle.internal.logging.console.ThrottlingOutputEventListener) DefaultWorkInProgressFormatter(org.gradle.internal.logging.console.DefaultWorkInProgressFormatter)

Aggregations

TrueTimeProvider (org.gradle.internal.time.TrueTimeProvider)3 File (java.io.File)1 FileTree (org.gradle.api.file.FileTree)1 TestClassProcessor (org.gradle.api.internal.tasks.testing.TestClassProcessor)1 TestFramework (org.gradle.api.internal.tasks.testing.TestFramework)1 WorkerTestClassProcessorFactory (org.gradle.api.internal.tasks.testing.WorkerTestClassProcessorFactory)1 MaxNParallelTestClassProcessor (org.gradle.api.internal.tasks.testing.processors.MaxNParallelTestClassProcessor)1 RestartEveryNTestClassProcessor (org.gradle.api.internal.tasks.testing.processors.RestartEveryNTestClassProcessor)1 TestMainAction (org.gradle.api.internal.tasks.testing.processors.TestMainAction)1 ForkingTestClassProcessor (org.gradle.api.internal.tasks.testing.worker.ForkingTestClassProcessor)1 Factory (org.gradle.internal.Factory)1 ActorFactory (org.gradle.internal.actor.ActorFactory)1 DefaultListenerManager (org.gradle.internal.event.DefaultListenerManager)1 BuildStatusRenderer (org.gradle.internal.logging.console.BuildStatusRenderer)1 DefaultWorkInProgressFormatter (org.gradle.internal.logging.console.DefaultWorkInProgressFormatter)1 StyledTextOutputBackedRenderer (org.gradle.internal.logging.console.StyledTextOutputBackedRenderer)1 ThrottlingOutputEventListener (org.gradle.internal.logging.console.ThrottlingOutputEventListener)1 WorkInProgressRenderer (org.gradle.internal.logging.console.WorkInProgressRenderer)1 BatchOutputEventListener (org.gradle.internal.logging.events.BatchOutputEventListener)1 LogLevelChangeEvent (org.gradle.internal.logging.events.LogLevelChangeEvent)1