private static void cleanupSharedSourceDirs(
    @NotNull Map<String, DefaultExternalSourceSet> externalSourceSets,
    @NotNull String sourceSetName,
    @Nullable String sourceSetNameToIgnore
  ) {
    DefaultExternalSourceSet sourceSet = externalSourceSets.get(sourceSetName);
    if (sourceSet == null) return;

    for (Map.Entry<String, DefaultExternalSourceSet> sourceSetEntry : externalSourceSets.entrySet()) {
      if (Objects.equals(sourceSetEntry.getKey(), sourceSetName)) continue;
      if (Objects.equals(sourceSetEntry.getKey(), sourceSetNameToIgnore)) continue;

      DefaultExternalSourceSet customSourceSet = sourceSetEntry.getValue();
      for (ExternalSystemSourceType sourceType : ExternalSystemSourceType.values()) {
        DefaultExternalSourceDirectorySet customSourceDirectorySet = customSourceSet.getSources().get(sourceType);
        if (customSourceDirectorySet != null) {
          for (Map.Entry<ExternalSystemSourceType, DefaultExternalSourceDirectorySet> sourceDirEntry : sourceSet.getSources().entrySet()) {
            customSourceDirectorySet.getSrcDirs().removeAll(sourceDirEntry.getValue().getSrcDirs());
          }
        }
      }
    }
  }
private static void cleanupSharedSourceDirs(
    @NotNull Map<String, DefaultExternalSourceSet> externalSourceSets,
    @NotNull String sourceSetName,
    @Nullable String sourceSetNameToIgnore
  )