use of org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaSingleEntryLibraryDependency 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