use of org.gradle.plugins.ide.idea.model.ProjectLibrary in project gradle by gradle.
the class IdeaScalaConfigurer method createScalaSdkLibrary.
private static ProjectLibrary createScalaSdkLibrary(String name, Iterable<File> jars) {
ProjectLibrary projectLibrary = new ProjectLibrary();
projectLibrary.setName(name);
projectLibrary.setType("Scala");
projectLibrary.setCompilerClasspath(Sets.newLinkedHashSet(jars));
return projectLibrary;
}
use of org.gradle.plugins.ide.idea.model.ProjectLibrary in project gradle by gradle.
the class IdeaScalaConfigurer method declareUniqueProjectLibraries.
private void declareUniqueProjectLibraries(Set<ProjectLibrary> projectLibraries) {
Set<ProjectLibrary> existingLibraries = rootProject.getExtensions().getByType(IdeaModel.class).getProject().getProjectLibraries();
Set<ProjectLibrary> newLibraries = Sets.difference(projectLibraries, existingLibraries);
for (ProjectLibrary newLibrary : newLibraries) {
String originalName = newLibrary.getName();
int suffix = 1;
while (containsLibraryWithSameName(existingLibraries, newLibrary.getName())) {
newLibrary.setName(originalName + "-" + (suffix++));
}
existingLibraries.add(newLibrary);
}
}
use of org.gradle.plugins.ide.idea.model.ProjectLibrary in project gradle by gradle.
the class IdeaScalaConfigurer method createProjectLibrary.
private static ProjectLibrary createProjectLibrary(String name, Iterable<File> jars) {
ProjectLibrary projectLibrary = new ProjectLibrary();
projectLibrary.setName(name);
projectLibrary.setClasses(Sets.newLinkedHashSet(jars));
return projectLibrary;
}
use of org.gradle.plugins.ide.idea.model.ProjectLibrary in project gradle by gradle.
the class IdeaScalaConfigurer method resolveScalaCompilerLibraries.
private static Map<String, ProjectLibrary> resolveScalaCompilerLibraries(Collection<Project> scalaProjects, boolean useScalaSdk) {
Map<String, ProjectLibrary> scalaCompilerLibraries = Maps.newHashMap();
for (Project scalaProject : scalaProjects) {
IdeaModule ideaModule = scalaProject.getExtensions().getByType(IdeaModel.class).getModule();
Iterable<File> files = getIdeaModuleLibraryDependenciesAsFiles(ideaModule);
ProjectLibrary library = createScalaSdkLibrary(scalaProject, files, useScalaSdk, ideaModule);
if (library != null) {
ProjectLibrary duplicate = Iterables.find(scalaCompilerLibraries.values(), Predicates.equalTo(library), null);
scalaCompilerLibraries.put(scalaProject.getPath(), duplicate == null ? library : duplicate);
}
}
return scalaCompilerLibraries;
}
Aggregations