use of org.gradle.plugins.ide.idea.model.SingleEntryModuleLibrary in project gradle by gradle.
the class IdeaDependenciesProvider method toLibraryDependency.
private SingleEntryModuleLibrary toLibraryDependency(IdeExtendedRepoFileDependency dependency, IdeaModule ideaModule, GeneratedIdeaScope scope) {
Set<FilePath> javadoc = Sets.newLinkedHashSet();
for (File javaDocFile : dependency.getJavadocFiles()) {
javadoc.add(toPath(ideaModule, javaDocFile));
}
Set<FilePath> source = Sets.newLinkedHashSet();
for (File sourceFile : dependency.getSourceFiles()) {
source.add(toPath(ideaModule, sourceFile));
}
SingleEntryModuleLibrary library = new SingleEntryModuleLibrary(toPath(ideaModule, dependency.getFile()), javadoc, source, scope.name());
library.setModuleVersion(dependency.getId());
return library;
}
use of org.gradle.plugins.ide.idea.model.SingleEntryModuleLibrary in project gradle by gradle.
the class IdeaModelBuilder method buildDependencies.
private void buildDependencies(Map<String, DefaultIdeaModule> modules, IdeaModule ideaModule) {
ideaModule.setOffline(offlineDependencyResolution);
Set<Dependency> resolved = ideaModule.resolveDependencies();
List<DefaultIdeaDependency> dependencies = new LinkedList<DefaultIdeaDependency>();
for (Dependency dependency : resolved) {
if (dependency instanceof SingleEntryModuleLibrary) {
SingleEntryModuleLibrary d = (SingleEntryModuleLibrary) dependency;
DefaultIdeaSingleEntryLibraryDependency defaultDependency = new DefaultIdeaSingleEntryLibraryDependency().setFile(d.getLibraryFile()).setSource(d.getSourceFile()).setJavadoc(d.getJavadocFile()).setScope(new DefaultIdeaDependencyScope(d.getScope())).setExported(d.isExported());
if (d.getModuleVersion() != null) {
defaultDependency.setGradleModuleVersion(new DefaultGradleModuleVersion(d.getModuleVersion()));
}
dependencies.add(defaultDependency);
} else if (dependency instanceof ModuleDependency) {
ModuleDependency moduleDependency = (ModuleDependency) dependency;
DefaultIdeaModuleDependency ideaModuleDependency = new DefaultIdeaModuleDependency(moduleDependency.getName()).setExported(moduleDependency.isExported()).setScope(new DefaultIdeaDependencyScope(moduleDependency.getScope()));
// Find IdeaModule model for dependency within same build: may be null
DefaultIdeaModule targetModule = modules.get(moduleDependency.getName());
ideaModuleDependency.setDependencyModule(targetModule);
dependencies.add(ideaModuleDependency);
}
}
modules.get(ideaModule.getName()).setDependencies(dependencies);
}
Aggregations