private static void cleanupSharedIdeaSourceDirs(
    @NotNull DefaultExternalSourceSet externalSourceSet, // mutable
    @NotNull GradleSourceSetResolutionContext sourceSetResolutionContext
  ) {
    if (SourceSet.MAIN_SOURCE_SET_NAME.equals(externalSourceSet.getName())) return;
    if (SourceSet.TEST_SOURCE_SET_NAME.equals(externalSourceSet.getName())) return;

    for (DefaultExternalSourceDirectorySet sourceDirectorySet : externalSourceSet.getSources().values()) {
      sourceSetResolutionContext.ideaSourceDirs.removeAll(sourceDirectorySet.getSrcDirs());
      sourceSetResolutionContext.ideaResourceDirs.removeAll(sourceDirectorySet.getSrcDirs());
      sourceSetResolutionContext.ideaTestSourceDirs.removeAll(sourceDirectorySet.getSrcDirs());
      sourceSetResolutionContext.ideaTestResourceDirs.removeAll(sourceDirectorySet.getSrcDirs());
    }
  }
private static void cleanupSharedIdeaSourceDirs(
    @NotNull DefaultExternalSourceSet externalSourceSet, // mutable
    @NotNull GradleSourceSetResolutionContext sourceSetResolutionContext
  )