Run configuration hides existing before launch tasks

During adding our framework support, we're adding a default deployment run configuration containing Before Launch tasks to build the artifact. Here is the relevant code:

RunManager runManager = RunManager.getInstance(module.getProject());
AppEngineFlexibleCloudType serverType =
ServerType.EP_NAME.findExtension(AppEngineFlexibleCloudType.class);
DeployToServerConfigurationType configurationType
= DeployToServerConfigurationTypesRegistrar.getDeployConfigurationType(serverType);

RunnerAndConfigurationSettings settings = runManager.createRunConfiguration(
GctBundle.getString("appengine.flex.deployment.name") + " " + module.getName(),
configurationType.getFactory());

// Sets the GAE Flex server, if any exists, in the run config.
DeployToServerRunConfiguration<?, AppEngineDeploymentConfiguration> runConfiguration =
(DeployToServerRunConfiguration<?, AppEngineDeploymentConfiguration>)
settings.getConfiguration();
RemoteServer<AppEngineFlexibleServerConfiguration> server =
ContainerUtil.getFirstItem(RemoteServersManager.getInstance().getServers(serverType));
if (server != null) {
runConfiguration.setServerName(server.getName());
}

// Sets the first found Flex deployable, if any exists, in the run config.
AppEngineProjectService projectService = AppEngineProjectService.getInstance();
for (Artifact artifact : ArtifactUtil.getArtifactsContainingModuleOutput(module)) {
if (projectService.isAppEngineFlexArtifactType(artifact)) {
ArtifactDeploymentSource deploymentSource = AppEngineUtil.createArtifactDeploymentSource(
module.getProject(), artifact, AppEngineEnvironment.APP_ENGINE_FLEX);
runConfiguration.setDeploymentSource(deploymentSource);
AppEngineArtifactDeploymentSourceType sourceType =
(AppEngineArtifactDeploymentSourceType) deploymentSource.getType();
sourceType.setBuildBeforeRunTask(runConfiguration, deploymentSource);
break;
}
}
...

runManager.addConfiguration(settings, false /* shared */);

 

Immediately before adding the configuration at the bottom, I use the debugger to run "RunManagerEx.getInstance(module.getProject()).getBeforeRunTasks(runConfiguration)" and a list with one task is returned. However, when the settings editor is rendered, none appears.

I strongly suspect that this is the desired behaviour. Can anyone have a look, or let me know if there is any workaround I can use? Thanks!

0
3 comments
Avatar
Permanently deleted user

Do you use RunManagerEx.setBeforeRunTasks() method?

0
Avatar
Permanently deleted user

Thanks Vassiliy. I understand that sourceType.setBuildBeforeRunTask() would be a more appropriate method to be called here, but I adapted my code to use RunManagerEx.setBeforeRunTasks(). It also doesn't work as expected.

runManager.setBeforeRunTasks(runConfiguration, ImmutableList.of(new BuildArtifactsBeforeRunTask(module.getProject())), true);

No before launch tasks are added to my run configuration.

0
Avatar
Permanently deleted user

Friendly ping! Any ideas about what's going on here?

We'd like to ship an important new version of our plugin, and no before launch task to build the artifact on the default deployment run configuration is really nasty...

0

Please sign in to leave a comment.