Search in sources :

Example 1 with PlayApplicationRunnerToken

use of org.gradle.play.internal.run.PlayApplicationRunnerToken in project gradle by gradle.

the class PlayRun method run.

@TaskAction
public void run() {
    ProgressLoggerFactory progressLoggerFactory = getServices().get(ProgressLoggerFactory.class);
    PlayApplicationDeploymentHandle deploymentHandle = registerOrFindDeploymentHandle(getPath());
    if (!deploymentHandle.isRunning()) {
        ProgressLogger progressLogger = progressLoggerFactory.newOperation(PlayRun.class).start("Start Play server", "Starting Play");
        try {
            int httpPort = getHttpPort();
            PlayRunSpec spec = new DefaultPlayRunSpec(runtimeClasspath, changingClasspath, applicationJar, assetsJar, assetsDirs, getProject().getProjectDir(), getForkOptions(), httpPort);
            PlayApplicationRunnerToken runnerToken = playToolProvider.get(PlayApplicationRunner.class).start(spec);
            deploymentHandle.start(runnerToken);
        } finally {
            progressLogger.completed();
        }
    }
    if (!getProject().getGradle().getStartParameter().isContinuous()) {
        ProgressLogger progressLogger = progressLoggerFactory.newOperation(PlayRun.class).start("Run Play App at http://localhost:" + httpPort + "/", "Running at http://localhost:" + httpPort + "/");
        try {
            waitForCtrlD();
        } finally {
            progressLogger.completed();
        }
    } else {
        LOGGER.warn("Running Play App ({}) at http://localhost:{}/", getPath(), httpPort);
    }
}
Also used : DefaultPlayRunSpec(org.gradle.play.internal.run.DefaultPlayRunSpec) PlayApplicationRunner(org.gradle.play.internal.run.PlayApplicationRunner) ProgressLoggerFactory(org.gradle.internal.logging.progress.ProgressLoggerFactory) PlayRunSpec(org.gradle.play.internal.run.PlayRunSpec) DefaultPlayRunSpec(org.gradle.play.internal.run.DefaultPlayRunSpec) ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger) PlayApplicationDeploymentHandle(org.gradle.play.internal.run.PlayApplicationDeploymentHandle) PlayApplicationRunnerToken(org.gradle.play.internal.run.PlayApplicationRunnerToken) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

TaskAction (org.gradle.api.tasks.TaskAction)1 ProgressLogger (org.gradle.internal.logging.progress.ProgressLogger)1 ProgressLoggerFactory (org.gradle.internal.logging.progress.ProgressLoggerFactory)1 DefaultPlayRunSpec (org.gradle.play.internal.run.DefaultPlayRunSpec)1 PlayApplicationDeploymentHandle (org.gradle.play.internal.run.PlayApplicationDeploymentHandle)1 PlayApplicationRunner (org.gradle.play.internal.run.PlayApplicationRunner)1 PlayApplicationRunnerToken (org.gradle.play.internal.run.PlayApplicationRunnerToken)1 PlayRunSpec (org.gradle.play.internal.run.PlayRunSpec)1