Search in sources :

Example 1 with ProjectLibrary

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;
}
Also used : ProjectLibrary(org.gradle.plugins.ide.idea.model.ProjectLibrary)

Example 2 with 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);
    }
}
Also used : ProjectLibrary(org.gradle.plugins.ide.idea.model.ProjectLibrary)

Example 3 with ProjectLibrary

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;
}
Also used : ProjectLibrary(org.gradle.plugins.ide.idea.model.ProjectLibrary)

Example 4 with 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;
}
Also used : Project(org.gradle.api.Project) IdeaModule(org.gradle.plugins.ide.idea.model.IdeaModule) IdeaModel(org.gradle.plugins.ide.idea.model.IdeaModel) ProjectLibrary(org.gradle.plugins.ide.idea.model.ProjectLibrary) File(java.io.File)

Aggregations

ProjectLibrary (org.gradle.plugins.ide.idea.model.ProjectLibrary)4 File (java.io.File)1 Project (org.gradle.api.Project)1 IdeaModel (org.gradle.plugins.ide.idea.model.IdeaModel)1 IdeaModule (org.gradle.plugins.ide.idea.model.IdeaModule)1