boolean (@NotNull Collection<String> modules, Phase @NotNull ... phases) { final ExternalProjectsStateProvider stateProvider = ExternalProjectsManagerImpl.getInstance(myProject).getStateProvider(); final Queue<Pair<ProjectSystemId, ExternalSystemTaskExecutionSettings>> tasksQueue = new LinkedList<>(); Map<ProjectSystemId, Map<String, RunnerAndConfigurationSettings>> lazyConfigurationsMap = FactoryMap.create(key -> { final AbstractExternalSystemTaskConfigurationType configurationType = ExternalSystemUtil.findConfigurationType(key); if (configurationType == null) { return null; } return ContainerUtil.map2Map(RunManager.getInstance(myProject).getConfigurationSettingsList(configurationType), configurationSettings1 -> Pair.create(configurationSettings1.getName(), configurationSettings1)); }); for (final ExternalProjectsStateProvider.TasksActivation activation : stateProvider.getAllTasksActivation()) { final boolean hashPath = modules.contains(activation.projectPath); final Set<String> tasks = new LinkedHashSet<>(); for (Phase phase : phases) { List<String> activationTasks = activation.state.getTasks(phase); if (hashPath || (phase.isSyncPhase() && !activationTasks.isEmpty() && isShareSameRootPath(modules, activation))) { tasks.addAll(activationTasks); } } if (tasks.isEmpty()) { continue; } for (Iterator<String> iterator = tasks.iterator(); iterator.hasNext(); ) { String task = iterator.next(); if (task.length() > RUN_CONFIGURATION_TASK_PREFIX.length() && task.startsWith(RUN_CONFIGURATION_TASK_PREFIX)) { iterator.remove(); final String configurationName = task.substring(RUN_CONFIGURATION_TASK_PREFIX.length()); Map<String, RunnerAndConfigurationSettings> settings = lazyConfigurationsMap.get(activation.systemId); if (settings == null) { continue; } RunnerAndConfigurationSettings configurationSettings = settings.get(configurationName); if (configurationSettings == null) { continue; } final RunConfiguration runConfiguration = configurationSettings.getConfiguration(); if (configurationName.equals(configurationSettings.getName()) && runConfiguration instanceof ExternalSystemRunConfiguration) { tasksQueue.add(Pair.create(activation.systemId, ((ExternalSystemRunConfiguration)runConfiguration).getSettings())); } } } if (tasks.isEmpty()) { continue; } if (ExternalProjectsManager.getInstance(myProject).isIgnored(activation.systemId, activation.projectPath) && !"true".equals(System.getProperty("force.execute.activated.tasks", "false"))) { continue; } ExternalSystemTaskExecutionSettings executionSettings = new ExternalSystemTaskExecutionSettings(); executionSettings.setExternalSystemIdString(activation.systemId.toString()); executionSettings.setExternalProjectPath(activation.projectPath); executionSettings.getTaskNames().addAll(tasks); tasksQueue.add(Pair.create(activation.systemId, executionSettings)); } return runTasksQueue(tasksQueue); }