void (@NotNull List<ResourceRootConfiguration> container, final @Nullable ExternalSourceDirectorySet directorySet, final @Nullable ExternalSourceDirectorySet sourcesDirectorySet, @Nullable PathMapper pathMapper) { if (directorySet == null) return; for (File file : directorySet.getSrcDirs()) { final String dir = file.getPath(); final ResourceRootConfiguration rootConfiguration = new ResourceRootConfiguration(); rootConfiguration.directory = toRemote(pathMapper, FileUtil.toSystemIndependentName(dir)); final String target = directorySet.getOutputDir().getPath(); rootConfiguration.targetPath = toRemote(pathMapper, FileUtil.toSystemIndependentName(target)); rootConfiguration.includes.clear(); for (String include : directorySet.getPatterns().getIncludes()) { rootConfiguration.includes.add(include.trim()); } rootConfiguration.excludes.clear(); for (String exclude : directorySet.getPatterns().getExcludes()) { rootConfiguration.excludes.add(exclude.trim()); } if (sourcesDirectorySet != null && sourcesDirectorySet.getSrcDirs().contains(file)) { rootConfiguration.excludes.add("**/*.java"); rootConfiguration.excludes.add("**/*.scala"); rootConfiguration.excludes.add("**/*.groovy"); rootConfiguration.excludes.add("**/*.kt"); } rootConfiguration.isFiltered = !directorySet.getFilters().isEmpty(); rootConfiguration.filters.clear(); for (ExternalFilter filter : directorySet.getFilters()) { final ResourceRootFilter resourceRootFilter = new ResourceRootFilter(); resourceRootFilter.filterType = filter.getFilterType(); resourceRootFilter.properties = filter.getPropertiesAsJsonMap(); rootConfiguration.filters.add(resourceRootFilter); } container.add(rootConfiguration); } }