Search in sources :

Example 1 with SourceFoldersCreator

use of org.gradle.plugins.ide.eclipse.model.internal.SourceFoldersCreator in project gradle by gradle.

the class LinkedResourcesCreator method links.

public Set<Link> links(final Project project) {
    SourceSetContainer sourceSets = project.getExtensions().getByType(JavaPluginExtension.class).getSourceSets();
    EclipseClasspath classpath = project.getExtensions().getByType(EclipseModel.class).getClasspath();
    File defaultOutputDir = classpath == null ? project.file(EclipsePluginConstants.DEFAULT_PROJECT_OUTPUT_PATH) : classpath.getDefaultOutputDir();
    List<SourceFolder> sourceFolders = new SourceFoldersCreator().getBasicExternalSourceFolders(sourceSets, new Function<File, String>() {

        @Override
        public String apply(File dir) {
            return project.relativePath(dir);
        }
    }, defaultOutputDir);
    Set<Link> links = Sets.newLinkedHashSetWithExpectedSize(sourceFolders.size());
    for (SourceFolder sourceFolder : sourceFolders) {
        links.add(new Link(sourceFolder.getName(), "2", sourceFolder.getAbsolutePath(), null));
    }
    return links;
}
Also used : SourceFoldersCreator(org.gradle.plugins.ide.eclipse.model.internal.SourceFoldersCreator) EclipseClasspath(org.gradle.plugins.ide.eclipse.model.EclipseClasspath) JavaPluginExtension(org.gradle.api.plugins.JavaPluginExtension) SourceSetContainer(org.gradle.api.tasks.SourceSetContainer) SourceFolder(org.gradle.plugins.ide.eclipse.model.SourceFolder) EclipseModel(org.gradle.plugins.ide.eclipse.model.EclipseModel) File(java.io.File) Link(org.gradle.plugins.ide.eclipse.model.Link)

Aggregations

File (java.io.File)1 JavaPluginExtension (org.gradle.api.plugins.JavaPluginExtension)1 SourceSetContainer (org.gradle.api.tasks.SourceSetContainer)1 EclipseClasspath (org.gradle.plugins.ide.eclipse.model.EclipseClasspath)1 EclipseModel (org.gradle.plugins.ide.eclipse.model.EclipseModel)1 Link (org.gradle.plugins.ide.eclipse.model.Link)1 SourceFolder (org.gradle.plugins.ide.eclipse.model.SourceFolder)1 SourceFoldersCreator (org.gradle.plugins.ide.eclipse.model.internal.SourceFoldersCreator)1