Search in sources :

Example 6 with ExternalTaskPojo

use of com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo in project intellij-community by JetBrains.

the class ExternalSystemExecuteTaskTask method doExecute.

@SuppressWarnings("unchecked")
@Override
protected void doExecute() throws Exception {
    final ExternalSystemFacadeManager manager = ServiceManager.getService(ExternalSystemFacadeManager.class);
    ExternalSystemExecutionSettings settings = ExternalSystemApiUtil.getExecutionSettings(getIdeProject(), getExternalProjectPath(), getExternalSystemId());
    KeyFMap keyFMap = getUserMap();
    for (Key key : keyFMap.getKeys()) {
        settings.putUserData(key, keyFMap.get(key));
    }
    RemoteExternalSystemFacade facade = manager.getFacade(getIdeProject(), getExternalProjectPath(), getExternalSystemId());
    RemoteExternalSystemTaskManager taskManager = facade.getTaskManager();
    List<String> taskNames = ContainerUtilRt.map2List(myTasksToExecute, ExternalTaskPojo::getName);
    final List<String> vmOptions = parseCmdParameters(myVmOptions);
    final List<String> arguments = parseCmdParameters(myArguments);
    settings.withVmOptions(vmOptions).withArguments(arguments);
    taskManager.executeTasks(getId(), taskNames, getExternalProjectPath(), settings, myJvmAgentSetup);
}
Also used : ExternalTaskPojo(com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo) KeyFMap(com.intellij.util.keyFMap.KeyFMap) RemoteExternalSystemTaskManager(com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemTaskManager) ExternalSystemFacadeManager(com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager) RemoteExternalSystemFacade(com.intellij.openapi.externalSystem.service.RemoteExternalSystemFacade) ExternalSystemExecutionSettings(com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings) Key(com.intellij.openapi.util.Key)

Example 7 with ExternalTaskPojo

use of com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo in project intellij-community by JetBrains.

the class ExternalSystemBeforeRunTaskProvider method canExecuteTask.

@Override
public boolean canExecuteTask(RunConfiguration configuration, ExternalSystemBeforeRunTask beforeRunTask) {
    final ExternalSystemTaskExecutionSettings executionSettings = beforeRunTask.getTaskExecutionSettings();
    final List<ExternalTaskPojo> tasks = ContainerUtilRt.newArrayList();
    for (String taskName : executionSettings.getTaskNames()) {
        tasks.add(new ExternalTaskPojo(taskName, executionSettings.getExternalProjectPath(), null));
    }
    if (tasks.isEmpty())
        return true;
    ExecutionEnvironment environment = ExternalSystemUtil.createExecutionEnvironment(myProject, mySystemId, executionSettings, DefaultRunExecutor.EXECUTOR_ID);
    if (environment == null)
        return false;
    return environment.getRunner().canRun(DefaultRunExecutor.EXECUTOR_ID, environment.getRunProfile());
}
Also used : ExternalTaskPojo(com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) ExternalSystemTaskExecutionSettings(com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)

Aggregations

ExternalTaskPojo (com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo)7 ExternalProjectPojo (com.intellij.openapi.externalSystem.model.project.ExternalProjectPojo)3 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)2 ExternalSystemTaskExecutionSettings (com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)2 ExternalTaskExecutionInfo (com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo)2 ProgramRunner (com.intellij.execution.runners.ProgramRunner)1 ExternalProjectBuildClasspathPojo (com.intellij.openapi.externalSystem.model.project.ExternalProjectBuildClasspathPojo)1 ModuleData (com.intellij.openapi.externalSystem.model.project.ModuleData)1 ProjectData (com.intellij.openapi.externalSystem.model.project.ProjectData)1 ExternalSystemExecutionSettings (com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings)1 TaskData (com.intellij.openapi.externalSystem.model.task.TaskData)1 ExternalSystemFacadeManager (com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager)1 RemoteExternalSystemFacade (com.intellij.openapi.externalSystem.service.RemoteExternalSystemFacade)1 RemoteExternalSystemTaskManager (com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemTaskManager)1 Key (com.intellij.openapi.util.Key)1 KeyFMap (com.intellij.util.keyFMap.KeyFMap)1