Search in sources :

Example 1 with Dependency

use of org.gradle.plugins.ide.idea.model.Dependency in project gradle by gradle.

the class IdeaDependenciesProvider method getProjectDependencies.

private Set<Dependency> getProjectDependencies(IdeaModule ideaModule, GeneratedIdeaScope scope) {
    Collection<Configuration> plusConfigurations = getPlusConfigurations(ideaModule, scope);
    Collection<Configuration> minusConfigurations = getMinusConfigurations(ideaModule, scope);
    Collection<IdeProjectDependency> extractedDependencies = dependenciesExtractor.extractProjectDependencies(ideaModule.getProject(), plusConfigurations, minusConfigurations);
    Set<Dependency> dependencies = Sets.newLinkedHashSet();
    for (IdeProjectDependency ideProjectDependency : extractedDependencies) {
        dependencies.add(moduleDependencyBuilder.create(ideProjectDependency, scope.name()));
    }
    return dependencies;
}
Also used : IdeProjectDependency(org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency) Configuration(org.gradle.api.artifacts.Configuration) UnresolvedIdeRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.UnresolvedIdeRepoFileDependency) IdeLocalFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency) IdeProjectDependency(org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency) Dependency(org.gradle.plugins.ide.idea.model.Dependency) IdeExtendedRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency)

Example 2 with Dependency

use of org.gradle.plugins.ide.idea.model.Dependency in project gradle by gradle.

the class IdeaDependenciesProvider method getExternalDependencies.

private Set<Dependency> getExternalDependencies(IdeaModule ideaModule, GeneratedIdeaScope scope) {
    if (ideaModule.isOffline()) {
        return Collections.emptySet();
    }
    Collection<Configuration> plusConfigurations = getPlusConfigurations(ideaModule, scope);
    Collection<Configuration> minusConfigurations = getMinusConfigurations(ideaModule, scope);
    Set<Dependency> dependencies = Sets.newLinkedHashSet();
    Collection<IdeExtendedRepoFileDependency> ideRepoFileDependencies = dependenciesExtractor.extractRepoFileDependencies(ideaModule.getProject().getDependencies(), plusConfigurations, minusConfigurations, ideaModule.isDownloadSources(), ideaModule.isDownloadJavadoc());
    for (IdeExtendedRepoFileDependency dependency : ideRepoFileDependencies) {
        dependencies.add(toLibraryDependency(dependency, ideaModule, scope));
    }
    return dependencies;
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) IdeExtendedRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency) UnresolvedIdeRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.UnresolvedIdeRepoFileDependency) IdeLocalFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency) IdeProjectDependency(org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency) Dependency(org.gradle.plugins.ide.idea.model.Dependency) IdeExtendedRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency)

Example 3 with Dependency

use of org.gradle.plugins.ide.idea.model.Dependency in project gradle by gradle.

the class IdeaDependenciesProvider method getFileDependencies.

private Set<Dependency> getFileDependencies(IdeaModule ideaModule, GeneratedIdeaScope scope) {
    Collection<Configuration> plusConfigurations = getPlusConfigurations(ideaModule, scope);
    Collection<Configuration> minusConfigurations = getMinusConfigurations(ideaModule, scope);
    Set<Dependency> dependencies = Sets.newLinkedHashSet();
    Collection<IdeLocalFileDependency> ideLocalFileDependencies = dependenciesExtractor.extractLocalFileDependencies(plusConfigurations, minusConfigurations);
    for (IdeLocalFileDependency fileDependency : ideLocalFileDependencies) {
        dependencies.add(toLibraryDependency(fileDependency, ideaModule, scope));
    }
    return dependencies;
}
Also used : IdeLocalFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency) Configuration(org.gradle.api.artifacts.Configuration) UnresolvedIdeRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.UnresolvedIdeRepoFileDependency) IdeLocalFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency) IdeProjectDependency(org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency) Dependency(org.gradle.plugins.ide.idea.model.Dependency) IdeExtendedRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency)

Example 4 with Dependency

use of org.gradle.plugins.ide.idea.model.Dependency 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);
}
Also used : DefaultIdeaSingleEntryLibraryDependency(org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaSingleEntryLibraryDependency) SingleEntryModuleLibrary(org.gradle.plugins.ide.idea.model.SingleEntryModuleLibrary) DefaultIdeaModule(org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaModule) DefaultGradleModuleVersion(org.gradle.tooling.internal.gradle.DefaultGradleModuleVersion) DefaultIdeaModuleDependency(org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaModuleDependency) ModuleDependency(org.gradle.plugins.ide.idea.model.ModuleDependency) DefaultIdeaDependencyScope(org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaDependencyScope) DefaultIdeaModuleDependency(org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaModuleDependency) DefaultIdeaModuleDependency(org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaModuleDependency) Dependency(org.gradle.plugins.ide.idea.model.Dependency) DefaultIdeaSingleEntryLibraryDependency(org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaSingleEntryLibraryDependency) ModuleDependency(org.gradle.plugins.ide.idea.model.ModuleDependency) DefaultIdeaDependency(org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaDependency) DefaultIdeaDependency(org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaDependency) LinkedList(java.util.LinkedList)

Example 5 with Dependency

use of org.gradle.plugins.ide.idea.model.Dependency in project gradle by gradle.

the class IdeaScalaConfigurer method getIdeaModuleLibraryDependenciesAsFiles.

private static Iterable<File> getIdeaModuleLibraryDependenciesAsFiles(IdeaModule ideaModule) {
    // could make resolveDependencies() cache its result for later use by GenerateIdeaModule
    Set<Dependency> dependencies = ideaModule.resolveDependencies();
    List<File> files = Lists.newArrayList();
    for (ModuleLibrary moduleLibrary : Iterables.filter(dependencies, ModuleLibrary.class)) {
        for (FilePath filePath : Iterables.filter(moduleLibrary.getClasses(), FilePath.class)) {
            files.add(filePath.getFile());
        }
    }
    return files;
}
Also used : FilePath(org.gradle.plugins.ide.idea.model.FilePath) ModuleLibrary(org.gradle.plugins.ide.idea.model.ModuleLibrary) Dependency(org.gradle.plugins.ide.idea.model.Dependency) File(java.io.File)

Aggregations

Dependency (org.gradle.plugins.ide.idea.model.Dependency)5 Configuration (org.gradle.api.artifacts.Configuration)3 IdeExtendedRepoFileDependency (org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency)3 IdeLocalFileDependency (org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency)3 IdeProjectDependency (org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency)3 UnresolvedIdeRepoFileDependency (org.gradle.plugins.ide.internal.resolver.model.UnresolvedIdeRepoFileDependency)3 File (java.io.File)1 LinkedList (java.util.LinkedList)1 FilePath (org.gradle.plugins.ide.idea.model.FilePath)1 ModuleDependency (org.gradle.plugins.ide.idea.model.ModuleDependency)1 ModuleLibrary (org.gradle.plugins.ide.idea.model.ModuleLibrary)1 SingleEntryModuleLibrary (org.gradle.plugins.ide.idea.model.SingleEntryModuleLibrary)1 DefaultIdeaDependency (org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaDependency)1 DefaultIdeaDependencyScope (org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaDependencyScope)1 DefaultIdeaModule (org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaModule)1 DefaultIdeaModuleDependency (org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaModuleDependency)1 DefaultIdeaSingleEntryLibraryDependency (org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaSingleEntryLibraryDependency)1 DefaultGradleModuleVersion (org.gradle.tooling.internal.gradle.DefaultGradleModuleVersion)1