Search in sources :

Example 21 with ProgressLogger

use of org.gradle.internal.logging.progress.ProgressLogger in project gradle by gradle.

the class TestWorkerProgressListener method started.

@Override
public void started(TestDescriptorInternal testDescriptor, TestStartEvent startEvent) {
    boolean testClassDescriptor = isDefaultTestClassDescriptor(testDescriptor);
    if (testClassDescriptor) {
        String description = createProgressLoggerDescription(testDescriptor);
        if (!testWorkerProgressLoggers.containsKey(description)) {
            ProgressLogger progressLogger = factory.newOperation(TestWorkerProgressListener.class, parentProgressLogger);
            progressLogger.start(description, description);
            testWorkerProgressLoggers.put(description, progressLogger);
        }
    }
}
Also used : ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger)

Example 22 with ProgressLogger

use of org.gradle.internal.logging.progress.ProgressLogger in project gradle by gradle.

the class CompareGradleBuilds method compare.

@SuppressWarnings("UnusedDeclaration")
@TaskAction
void compare() {
    GradleBuildInvocationSpec sourceBuild = getSourceBuild();
    GradleBuildInvocationSpec targetBuild = getTargetBuild();
    if (sourceBuild.equals(targetBuild)) {
        getLogger().warn("The source build and target build are identical. Set '{}.targetBuild.gradleVersion' if you want to compare with a different Gradle version.", getName());
    }
    ComparableGradleBuildExecuter sourceBuildExecuter = new ComparableGradleBuildExecuter(sourceBuild);
    ComparableGradleBuildExecuter targetBuildExecuter = new ComparableGradleBuildExecuter(targetBuild);
    Logger logger = getLogger();
    ProgressLogger progressLogger = getProgressLoggerFactory().newOperation(getClass());
    progressLogger.setDescription("Gradle Build Comparison");
    progressLogger.setShortDescription(getName());
    GradleBuildComparison comparison = new GradleBuildComparison(sourceBuildExecuter, targetBuildExecuter, logger, progressLogger, getProject().getGradle());
    comparison.registerType(GeneratedArchiveBuildOutcome.class, new GeneratedArchiveBuildOutcomeComparator(), new GeneratedArchiveBuildOutcomeComparisonResultHtmlRenderer(), new GeneratedArchiveBuildOutcomeHtmlRenderer());
    comparison.registerType(UnknownBuildOutcome.class, new UnknownBuildOutcomeComparator(), new UnknownBuildOutcomeComparisonResultHtmlRenderer(), new UnknownBuildOutcomeHtmlRenderer());
    File fileStoreTmpBase = getFileResolver().resolve(String.format(TMP_FILESTORAGE_PREFIX + "-%s-%s", getName(), System.currentTimeMillis()));
    MovableFileStore<String> fileStore = new Files(fileStoreTmpBase);
    Map<String, String> hostAttributes = new LinkedHashMap<String, String>(4);
    hostAttributes.put("Project", getProject().getRootDir().getAbsolutePath());
    hostAttributes.put("Task", getPath());
    hostAttributes.put("Gradle version", GradleVersion.current().getVersion());
    hostAttributes.put("Executed at", new SimpleDateFormat().format(new Date()));
    BuildComparisonResult result = comparison.compare(fileStore, getReportDir(), hostAttributes);
    communicateResult(result);
}
Also used : UnknownBuildOutcomeComparator(org.gradle.api.plugins.buildcomparison.outcome.internal.unknown.UnknownBuildOutcomeComparator) ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger) Logger(org.gradle.api.logging.Logger) ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger) GeneratedArchiveBuildOutcomeComparator(org.gradle.api.plugins.buildcomparison.outcome.internal.archive.GeneratedArchiveBuildOutcomeComparator) Date(java.util.Date) LinkedHashMap(java.util.LinkedHashMap) BuildComparisonResult(org.gradle.api.plugins.buildcomparison.compare.internal.BuildComparisonResult) DefaultGradleBuildInvocationSpec(org.gradle.api.plugins.buildcomparison.gradle.internal.DefaultGradleBuildInvocationSpec) GeneratedArchiveBuildOutcomeComparisonResultHtmlRenderer(org.gradle.api.plugins.buildcomparison.outcome.internal.archive.GeneratedArchiveBuildOutcomeComparisonResultHtmlRenderer) ComparableGradleBuildExecuter(org.gradle.api.plugins.buildcomparison.gradle.internal.ComparableGradleBuildExecuter) UnknownBuildOutcomeHtmlRenderer(org.gradle.api.plugins.buildcomparison.outcome.internal.unknown.UnknownBuildOutcomeHtmlRenderer) GeneratedArchiveBuildOutcomeHtmlRenderer(org.gradle.api.plugins.buildcomparison.outcome.internal.archive.GeneratedArchiveBuildOutcomeHtmlRenderer) UnknownBuildOutcomeComparisonResultHtmlRenderer(org.gradle.api.plugins.buildcomparison.outcome.internal.unknown.UnknownBuildOutcomeComparisonResultHtmlRenderer) File(java.io.File) SimpleDateFormat(java.text.SimpleDateFormat) GradleBuildComparison(org.gradle.api.plugins.buildcomparison.gradle.internal.GradleBuildComparison) TaskAction(org.gradle.api.tasks.TaskAction)

Example 23 with ProgressLogger

use of org.gradle.internal.logging.progress.ProgressLogger in project gradle by gradle.

the class DefaultDaemonConnector method doStartDaemon.

private DaemonClientConnection doStartDaemon(ExplainingSpec<DaemonContext> constraint, boolean singleRun) {
    ProgressLogger progressLogger = progressLoggerFactory.newOperation(DefaultDaemonConnector.class).start("Starting Gradle Daemon", "Starting Daemon");
    final DaemonStartupInfo startupInfo = daemonStarter.startDaemon(singleRun);
    LOGGER.debug("Started Gradle daemon {}", startupInfo);
    CountdownTimer timer = Time.startCountdownTimer(connectTimeout);
    try {
        do {
            DaemonClientConnection daemonConnection = connectToDaemonWithId(startupInfo, constraint);
            if (daemonConnection != null) {
                startListener.daemonStarted(daemonConnection.getDaemon());
                return daemonConnection;
            }
            try {
                sleep(200L);
            } catch (InterruptedException e) {
                throw UncheckedException.throwAsUncheckedException(e);
            }
        } while (!timer.hasExpired());
    } finally {
        progressLogger.completed();
    }
    throw new DaemonConnectionException("Timeout waiting to connect to the Gradle daemon.\n" + startupInfo.describe());
}
Also used : CountdownTimer(org.gradle.internal.time.CountdownTimer) DaemonStartupInfo(org.gradle.launcher.daemon.diagnostics.DaemonStartupInfo) ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger)

Example 24 with ProgressLogger

use of org.gradle.internal.logging.progress.ProgressLogger in project gradle by gradle.

the class DefaultDaemonConnector method connectToDaemon.

private DaemonClientConnection connectToDaemon(DaemonConnectDetails daemon, DaemonClientConnection.StaleAddressDetector staleAddressDetector) throws ConnectException {
    ProgressLogger progressLogger = progressLoggerFactory.newOperation(DefaultDaemonConnector.class).start("Connecting to Gradle Daemon", "Connecting to Daemon");
    RemoteConnection<Message> connection;
    try {
        connection = connector.connect(daemon.getAddress()).create(Serializers.stateful(serializer));
    } catch (ConnectException e) {
        staleAddressDetector.maybeStaleAddress(e);
        throw e;
    } finally {
        progressLogger.completed();
    }
    return new DaemonClientConnection(connection, daemon, staleAddressDetector);
}
Also used : Message(org.gradle.launcher.daemon.protocol.Message) ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger) ConnectException(org.gradle.internal.remote.internal.ConnectException)

Aggregations

ProgressLogger (org.gradle.internal.logging.progress.ProgressLogger)24 TaskAction (org.gradle.api.tasks.TaskAction)3 File (java.io.File)2 CountdownTimer (org.gradle.internal.time.CountdownTimer)2 DaemonStartupInfo (org.gradle.launcher.daemon.diagnostics.DaemonStartupInfo)2 OutputStream (java.io.OutputStream)1 ConnectException (java.net.ConnectException)1 Socket (java.net.Socket)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 GradleException (org.gradle.api.GradleException)1 InvalidUserDataException (org.gradle.api.InvalidUserDataException)1 FailFastTestListenerInternal (org.gradle.api.internal.tasks.testing.FailFastTestListenerInternal)1 NoMatchingTestsReporter (org.gradle.api.internal.tasks.testing.NoMatchingTestsReporter)1 TestExecuter (org.gradle.api.internal.tasks.testing.TestExecuter)1 TestExecutionSpec (org.gradle.api.internal.tasks.testing.TestExecutionSpec)1 TestResultProcessor (org.gradle.api.internal.tasks.testing.TestResultProcessor)1 TestClassResult (org.gradle.api.internal.tasks.testing.junit.result.TestClassResult)1