private static void addUnprocessedIdeaSourceDirs(
    @NotNull Map<String, DefaultExternalSourceSet> externalSourceSets, // mutable
    @NotNull SourceSetContainer sourceSets,
    @NotNull GradleSourceSetResolutionContext sourceSetResolutionContext,
    @NotNull String sourceSetName
  ) {
    Collection<File> ideaSourceDirs = SourceSet.TEST_SOURCE_SET_NAME.equals(sourceSetName)
                                      ? sourceSetResolutionContext.ideaTestSourceDirs
                                      : sourceSetResolutionContext.ideaSourceDirs;
    ExternalSystemSourceType sourceType = SourceSet.TEST_SOURCE_SET_NAME.equals(sourceSetName)
                                          ? ExternalSystemSourceType.TEST
                                          : ExternalSystemSourceType.SOURCE;

    SourceSet sourceSet = sourceSets.findByName(sourceSetName);
    if (sourceSet == null) return;
    DefaultExternalSourceSet externalSourceSet = externalSourceSets.get(sourceSetName);
    if (externalSourceSet == null) return;
    ExternalSourceDirectorySet sourceDirectorySet = externalSourceSet.getSources().get(sourceType);
    if (sourceDirectorySet == null) return;

    Set<File> sourceDirs = new LinkedHashSet<>(ideaSourceDirs);
    sourceDirs.removeAll(sourceSet.getResources().getSrcDirs());
    sourceDirs.removeAll(sourceSetResolutionContext.ideaGeneratedSourceDirs);
    sourceDirectorySet.getSrcDirs().addAll(sourceDirs);
  }
private static void addUnprocessedIdeaSourceDirs(
    @NotNull Map<String, DefaultExternalSourceSet> externalSourceSets, // mutable
    @NotNull SourceSetContainer sourceSets,
    @NotNull GradleSourceSetResolutionContext sourceSetResolutionContext,
    @NotNull String sourceSetName
  )