Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
remove more afterEvaluate blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
chanseokoh committed Feb 18, 2021
1 parent 1ca1a13 commit 29190de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ private void createStageTask() {
task -> {
task.setGroup(APP_ENGINE_APP_YAML_TASK_GROUP);
task.setDescription("Stage an App Engine app.yaml based project for deployment");
task.dependsOn(BasePlugin.ASSEMBLE_TASK_NAME);
task.setStagingConfig(appengineExtension.getStage());
task.dependsOn(BasePlugin.ASSEMBLE_TASK_NAME);
});

tasks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ public class AppEngineStandardPlugin implements Plugin<Project> {
private CloudSdkOperations cloudSdkOperations;
private AppEngineStandardExtension appengineExtension;
private AppEngineCorePluginConfiguration appEngineCorePluginConfiguration;
private RunExtension runExtension;
private StageStandardExtension stageExtension;
private File explodedWarDir;

@Override
Expand All @@ -83,15 +81,14 @@ public void apply(Project project) {
}

private void configureExtensions() {

// create the run extension and set defaults.
runExtension = appengineExtension.getRun();
RunExtension runExtension = appengineExtension.getRun();
runExtension.setStartSuccessTimeout(20);
runExtension.setServices(explodedWarDir);
runExtension.setServerVersion("1");

// create the stage extension and set defaults.
stageExtension = appengineExtension.getStage();
StageStandardExtension stageExtension = appengineExtension.getStage();
File defaultStagedAppDir = new File(project.getBuildDir(), STAGED_APP_DIR_NAME);
stageExtension.setSourceDirectory(explodedWarDir);
stageExtension.setStagingDirectory(defaultStagedAppDir);
Expand Down Expand Up @@ -177,16 +174,12 @@ private void createStageTask() {
task.setGroup(APP_ENGINE_STANDARD_TASK_GROUP);
task.setDescription(
"Stage an App Engine standard environment application for deployment");
task.setStageStandardExtension(appengineExtension.getStage());
task.dependsOn(BasePlugin.ASSEMBLE_TASK_NAME);
});

project.afterEvaluate(
project ->
stage.configure(
task -> {
task.setAppCfg(cloudSdkOperations.getAppcfg());
task.setStageStandardExtension(stageExtension);
}));
project -> stage.configure(task -> task.setAppCfg(cloudSdkOperations.getAppcfg())));

// All deployment tasks depend on the stage task.
Arrays.asList(
Expand All @@ -209,6 +202,7 @@ private void createRunTasks() {
runTask -> {
runTask.setGroup(APP_ENGINE_STANDARD_TASK_GROUP);
runTask.setDescription("Run an App Engine standard environment application locally");
runTask.setRunConfig(appengineExtension.getRun());
runTask.dependsOn(tasks.named(BasePlugin.ASSEMBLE_TASK_NAME));
});

Expand All @@ -221,6 +215,9 @@ private void createRunTasks() {
startTask.setDescription(
"Run an App Engine standard environment application locally in the "
+ "background");
startTask.setRunConfig(appengineExtension.getRun());
startTask.setDevAppServerLoggingDir(
new File(project.getBuildDir(), DEV_APP_SERVER_OUTPUT_DIR_NAME));
startTask.dependsOn(tasks.named(BasePlugin.ASSEMBLE_TASK_NAME));
});

Expand All @@ -232,27 +229,14 @@ private void createRunTasks() {
stopTask.setGroup(APP_ENGINE_STANDARD_TASK_GROUP);
stopTask.setDescription(
"Stop a locally running App Engine standard environment application");
stopTask.setRunConfig(appengineExtension.getRun());
});

project.afterEvaluate(
project -> {
run.configure(
task -> {
task.setRunConfig(runExtension);
task.setDevServers(cloudSdkOperations.getDevServers());
});
start.configure(
task -> {
task.setRunConfig(runExtension);
task.setDevServers(cloudSdkOperations.getDevServers());
task.setDevAppServerLoggingDir(
new File(project.getBuildDir(), DEV_APP_SERVER_OUTPUT_DIR_NAME));
});
stop.configure(
task -> {
task.setRunConfig(runExtension);
task.setDevServers(cloudSdkOperations.getDevServers());
});
run.configure(task -> task.setDevServers(cloudSdkOperations.getDevServers()));
start.configure(task -> task.setDevServers(cloudSdkOperations.getDevServers()));
stop.configure(task -> task.setDevServers(cloudSdkOperations.getDevServers()));
});
}
}

0 comments on commit 29190de

Please sign in to comment.