private boolean runTasksQueue(final Queue<? extends Pair<ProjectSystemId, ExternalSystemTaskExecutionSettings>> tasksQueue) {
    final Pair<ProjectSystemId, ExternalSystemTaskExecutionSettings> pair = tasksQueue.poll();
    if (pair == null) {
      return true;
    }
    String tasks = String.join(", ", pair.second.getTaskNames());
    LOG.info(String.format("Started execution of %s", tasks));

    final ProjectSystemId systemId = pair.first;
    final ExternalSystemTaskExecutionSettings executionSettings = pair.getSecond();

    final Semaphore targetDone = new Semaphore();
    targetDone.down();
    final Ref<Boolean> result = new Ref<>(false);
    ExternalSystemUtil.runTask(executionSettings, DefaultRunExecutor.EXECUTOR_ID, myProject, systemId,
                               new TaskCallback() {
                                 @Override
                                 public void onSuccess() {
                                   result.set(runTasksQueue(tasksQueue));
                                   targetDone.up();
                                 }

                                 @Override
                                 public void onFailure() {
                                   targetDone.up();
                                 }
                               },
                               ProgressExecutionMode.IN_BACKGROUND_ASYNC, false);
    targetDone.waitFor();
    LOG.info(String.format("Finished execution of %s", tasks));
    return result.get();
  }
private boolean runTasksQueue(final Queue<? extends Pair<ProjectSystemId, ExternalSystemTaskExecutionSettings>> tasksQueue)