public static ExternalSystemTaskLocation create(@NotNull Project project,
                                                  @NotNull ProjectSystemId systemId,
                                                  @Nullable String projectPath,
                                                  @NotNull ExternalTaskExecutionInfo taskInfo) {
    if (projectPath != null) {
      final VirtualFile file = VfsUtil.findFileByIoFile(new File(projectPath), false);
      if (file != null) {
        final PsiDirectory psiFile = PsiManager.getInstance(project).findDirectory(file);
        if (psiFile != null) {
          return new ExternalSystemTaskLocation(project, psiFile, taskInfo);
        }
      }
    }

    String name = systemId.getReadableName() + projectPath + StringUtil.join(taskInfo.getSettings().getTaskNames(), " ");
    // We create a dummy text file instead of re-using external system file in order to avoid clashing with other configuration producers.
    // For example gradle files are enhanced groovy scripts but we don't want to run them via regular IJ groovy script runners.
    // Gradle tooling api should be used for running gradle tasks instead. IJ execution sub-system operates on Location objects
    // which encapsulate PsiElement and groovy runners are automatically applied if that PsiElement IS-A GroovyFile.
    PsiFile psiFile = PsiFileFactory.getInstance(project).createFileFromText(name, PlainTextFileType.INSTANCE, "");
    return new ExternalSystemTaskLocation(project, psiFile, taskInfo);
  }
public static ExternalSystemTaskLocation create(@NotNull Project project,
                                                  @NotNull ProjectSystemId systemId,
                                                  @Nullable String projectPath,
                                                  @NotNull ExternalTaskExecutionInfo taskInfo)