@Override
  public @Nullable ExecutionEnvironment createExecutionEnvironment(@NotNull Project project, ProjectTask @NotNull ... tasks) {
    ExecutionEnvironment environment = super.createExecutionEnvironment(project, tasks);
    if (environment != null) {
      return environment;
    }
    TasksExecutionSettingsBuilder executionSettingsBuilder = new TasksExecutionSettingsBuilder(project, tasks);
    Set<String> rootPaths = executionSettingsBuilder.getRootPaths();
    if (rootPaths.size() != 1) {
      return null;
    }
    String rootProjectPath = rootPaths.iterator().next();
    ExternalSystemTaskExecutionSettings settings = executionSettingsBuilder.build(rootProjectPath);

    environment =
      ExternalSystemUtil.createExecutionEnvironment(project, GradleConstants.SYSTEM_ID, settings, DefaultRunExecutor.EXECUTOR_ID);
    if (environment == null) {
      LOG.warn("Execution environment for " + GradleConstants.SYSTEM_ID + " is null");
      return null;
    }

    RunnerAndConfigurationSettings runnerAndConfigurationSettings = environment.getRunnerAndConfigurationSettings();
    assert runnerAndConfigurationSettings != null;
    ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration)runnerAndConfigurationSettings.getConfiguration();
    runConfiguration.putUserData(GradleTaskManager.VERSION_SPECIFIC_SCRIPTS_KEY,
                                 executionSettingsBuilder.getVersionedInitScripts(rootProjectPath));
    String initScript = join(executionSettingsBuilder.getInitScripts(rootProjectPath), System.lineSeparator());
    runConfiguration.putUserData(GradleTaskManager.INIT_SCRIPT_KEY, initScript);
    runConfiguration.putUserData(GradleTaskManager.INIT_SCRIPT_PREFIX_KEY, settings.getExecutionName());
    return environment;
  }
@Override
  public @Nullable ExecutionEnvironment createExecutionEnvironment(@NotNull Project project, ProjectTask @NotNull ... tasks)