Search in sources :

Example 1 with WbDependentModule

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

the class WtpComponentFactory method getEntriesFromLibraries.

private List<WbDependentModule> getEntriesFromLibraries(Set<Configuration> plusConfigurations, Set<Configuration> minusConfigurations, EclipseWtpComponent wtp, String deployPath) {
    IdeDependenciesExtractor extractor = new IdeDependenciesExtractor();
    //below is not perfect because we're skipping the unresolved dependencies completely
    //however, it should be better anyway. Sometime soon we will hopefully change the wtp component stuff
    Collection<IdeExtendedRepoFileDependency> externals = extractor.resolvedExternalDependencies(plusConfigurations, minusConfigurations);
    Collection<IdeLocalFileDependency> locals = extractor.extractLocalFileDependencies(plusConfigurations, minusConfigurations);
    Collection<File> libFiles = Lists.newArrayList();
    for (IdeExtendedRepoFileDependency dependency : externals) {
        libFiles.add(dependency.getFile());
    }
    for (IdeLocalFileDependency dependency : locals) {
        libFiles.add(dependency.getFile());
    }
    List<WbDependentModule> libraryEntries = Lists.newArrayList();
    for (File file : libFiles) {
        libraryEntries.add(createWbDependentModuleEntry(file, wtp.getFileReferenceFactory(), deployPath));
    }
    return libraryEntries;
}
Also used : IdeLocalFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency) IdeExtendedRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency) WbDependentModule(org.gradle.plugins.ide.eclipse.model.WbDependentModule) File(java.io.File) IdeDependenciesExtractor(org.gradle.plugins.ide.internal.IdeDependenciesExtractor)

Example 2 with WbDependentModule

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

the class WtpComponentFactory method createWbDependentModuleEntry.

private WbDependentModule createWbDependentModuleEntry(File file, FileReferenceFactory fileReferenceFactory, String deployPath) {
    FileReference ref = fileReferenceFactory.fromFile(file);
    String handleSnippet = ref.isRelativeToPathVariable() ? "var/" + ref.getPath() : "lib/" + ref.getPath();
    return new WbDependentModule(deployPath, "module:/classpath/" + handleSnippet);
}
Also used : FileReference(org.gradle.plugins.ide.eclipse.model.FileReference) WbDependentModule(org.gradle.plugins.ide.eclipse.model.WbDependentModule)

Example 3 with WbDependentModule

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

the class WtpComponentFactory method getEntriesFromProjectDependencies.

private List<WbDependentModule> getEntriesFromProjectDependencies(Project project, Set<Configuration> plusConfigurations, Set<Configuration> minusConfigurations, String deployPath) {
    IdeDependenciesExtractor extractor = new IdeDependenciesExtractor();
    Collection<IdeProjectDependency> dependencies = extractor.extractProjectDependencies(project, plusConfigurations, minusConfigurations);
    List<WbDependentModule> projectDependencies = Lists.newArrayList();
    for (IdeProjectDependency dependency : dependencies) {
        String moduleName = determineProjectName(dependency);
        projectDependencies.add(new WbDependentModule(deployPath, "module:/resource/" + moduleName + "/" + moduleName));
    }
    return projectDependencies;
}
Also used : IdeProjectDependency(org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency) WbDependentModule(org.gradle.plugins.ide.eclipse.model.WbDependentModule) IdeDependenciesExtractor(org.gradle.plugins.ide.internal.IdeDependenciesExtractor)

Aggregations

WbDependentModule (org.gradle.plugins.ide.eclipse.model.WbDependentModule)3 IdeDependenciesExtractor (org.gradle.plugins.ide.internal.IdeDependenciesExtractor)2 File (java.io.File)1 FileReference (org.gradle.plugins.ide.eclipse.model.FileReference)1 IdeExtendedRepoFileDependency (org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency)1 IdeLocalFileDependency (org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency)1 IdeProjectDependency (org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency)1