Search in sources :

Example 11 with ProgressLogger

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

the class DefaultDaemonConnector method startDaemon.

public DaemonClientConnection startDaemon(ExplainingSpec<DaemonContext> constraint) {
    ProgressLogger progressLogger = progressLoggerFactory.newOperation(DefaultDaemonConnector.class).start("Starting Gradle Daemon", "Starting Daemon");
    final DaemonStartupInfo startupInfo = daemonStarter.startDaemon();
    LOGGER.debug("Started Gradle daemon {}", startupInfo);
    CountdownTimer timer = Timers.startTimer(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 12 with ProgressLogger

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

the class AbstractJettyRunTask method startJettyInternal.

public void startJettyInternal() {
    ProgressLoggerFactory progressLoggerFactory = getServices().get(ProgressLoggerFactory.class);
    ProgressLogger progressLogger = progressLoggerFactory.newOperation(AbstractJettyRunTask.class).start("Start Jetty server", "Starting Jetty");
    try {
        setServer(createServer());
        applyJettyXml();
        JettyPluginServer plugin = getServer();
        Object[] configuredConnectors = getConnectors();
        plugin.setConnectors(configuredConnectors);
        Object[] connectors = plugin.getConnectors();
        if (connectors == null || connectors.length == 0) {
            configuredConnectors = new Object[] { plugin.createDefaultConnector(getHttpPort()) };
            plugin.setConnectors(configuredConnectors);
        }
        //set up a RequestLog if one is provided
        if (getRequestLog() != null) {
            getServer().setRequestLog(getRequestLog());
        }
        //set up the webapp and any context provided
        getServer().configureHandlers();
        configureWebApplication();
        getServer().addWebApplication(webAppConfig);
        // set up security realms
        Object[] configuredRealms = getUserRealms();
        for (int i = 0; (configuredRealms != null) && i < configuredRealms.length; i++) {
            LOGGER.debug(configuredRealms[i].getClass().getName() + ": " + configuredRealms[i].toString());
        }
        plugin.setUserRealms(configuredRealms);
        //do any other configuration required by the
        //particular Jetty version
        finishConfigurationBeforeStart();
        // start Jetty
        server.start();
        if (getStopPort() != null && getStopPort() > 0 && getStopKey() != null) {
            Monitor monitor = new Monitor(getStopPort(), getStopKey(), (Server) server.getProxiedObject());
            monitor.start();
        }
        if (daemon) {
            return;
        }
        // start the scanner thread (if necessary) on the main webapp
        configureScanner();
        startScanner();
        // start the new line scanner thread if necessary
        startConsoleScanner();
    } catch (Exception e) {
        throw new GradleException("Could not start the Jetty server.", e);
    } finally {
        progressLogger.completed();
    }
    progressLogger = progressLoggerFactory.newOperation(AbstractJettyRunTask.class).start("Run Jetty at http://localhost:" + getHttpPort() + "/" + getContextPath(), "Running at http://localhost:" + getHttpPort() + "/" + getContextPath());
    try {
        // keep the thread going if not in daemon mode
        server.join();
    } catch (Exception e) {
        throw new GradleException("Failed to wait for the Jetty server to stop.", e);
    } finally {
        progressLogger.completed();
    }
}
Also used : Monitor(org.gradle.api.plugins.jetty.internal.Monitor) ProgressLoggerFactory(org.gradle.internal.logging.progress.ProgressLoggerFactory) GradleException(org.gradle.api.GradleException) ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger) JettyPluginServer(org.gradle.api.plugins.jetty.internal.JettyPluginServer) GradleException(org.gradle.api.GradleException)

Example 13 with ProgressLogger

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

the class DependencyResolutionLogger method beforeResolve.

public void beforeResolve(ResolvableDependencies dependencies) {
    LinkedList<ProgressLogger> loggers = progressLoggers.get();
    progressLoggers.set(loggers);
    ProgressLogger logger = loggerFactory.newOperation(DependencyResolutionLogger.class);
    logger.start("Resolve " + dependencies, "Resolving " + dependencies);
    loggers.add(logger);
}
Also used : ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger)

Example 14 with ProgressLogger

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

the class RuntimeShadedJarCreator method create.

public void create(final File outputJar, final Iterable<? extends File> files) {
    LOGGER.info("Generating JAR file: " + outputJar.getAbsolutePath());
    ProgressLogger progressLogger = progressLoggerFactory.newOperation(RuntimeShadedJarCreator.class);
    progressLogger.setDescription("Gradle JARs generation");
    progressLogger.setLoggingHeader("Generating JAR file '" + outputJar.getName() + "'");
    progressLogger.started();
    try {
        createFatJar(outputJar, files, progressLogger);
    } finally {
        progressLogger.completed();
    }
}
Also used : ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger)

Example 15 with ProgressLogger

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

the class AbstractProgressLoggingHandler method startProgress.

private ProgressLogger startProgress(String description, Class loggingClass) {
    ProgressLogger progressLogger = progressLoggerFactory.newOperation(loggingClass != null ? loggingClass : getClass());
    progressLogger.setDescription(description);
    progressLogger.setLoggingHeader(description);
    progressLogger.started();
    return progressLogger;
}
Also used : ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger)

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