Collection<ExternalDependency> (@NotNull final Set<File> files, @NotNull final Map<File, Integer> classPathOrder, @Nullable final String scope) { final List<ExternalDependency> result = new ArrayList<>(); if (files.isEmpty()) { return result; } final DefaultFileCollectionDependency fileCollectionDependency = new DefaultFileCollectionDependency(files); fileCollectionDependency.setScope(scope); fileCollectionDependency.setClasspathOrder(getOrder(classPathOrder, files)); result.add(fileCollectionDependency); GradleSourceSetCachedFinder sourceSetFinder = GradleSourceSetCachedFinder.getInstance(myContext); for (File file : files) { SourceSet outputDirSourceSet = sourceSetFinder.findByArtifact(file.getPath()); if (outputDirSourceSet != null) { result.addAll( collectSourceSetOutputDirsAsSingleEntryLibraries(outputDirSourceSet, classPathOrder, scope)); } } return result; }