use of org.gradle.play.internal.run.PlayApplicationDeploymentHandle in project gradle by gradle.
the class PlayRun method registerOrFindDeploymentHandle.
private PlayApplicationDeploymentHandle registerOrFindDeploymentHandle(String deploymentId) {
DeploymentRegistry deploymentRegistry = getDeploymentRegistry();
PlayApplicationDeploymentHandle deploymentHandle = deploymentRegistry.get(PlayApplicationDeploymentHandle.class, deploymentId);
if (deploymentHandle == null) {
deploymentHandle = new PlayApplicationDeploymentHandle(deploymentId);
deploymentRegistry.register(deploymentId, deploymentHandle);
}
return deploymentHandle;
}
use of org.gradle.play.internal.run.PlayApplicationDeploymentHandle 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);
}
}
Aggregations