Search in sources :

Example 6 with IdeExtendedRepoFileDependency

use of org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency in project gradle by gradle.

the class EclipseDependenciesCreator method createLibraryDependencies.

private List<AbstractClasspathEntry> createLibraryDependencies() {
    ArrayList<AbstractClasspathEntry> libraries = Lists.newArrayList();
    boolean downloadSources = classpath.isDownloadSources();
    boolean downloadJavadoc = classpath.isDownloadJavadoc();
    Collection<IdeExtendedRepoFileDependency> repoFileDependencies = dependenciesExtractor.extractRepoFileDependencies(classpath.getProject().getDependencies(), classpath.getPlusConfigurations(), classpath.getMinusConfigurations(), downloadSources, downloadJavadoc);
    for (IdeExtendedRepoFileDependency dependency : repoFileDependencies) {
        libraries.add(createLibraryEntry(dependency.getFile(), dependency.getSourceFile(), dependency.getJavadocFile(), classpath, dependency.getId()));
    }
    Collection<IdeLocalFileDependency> localFileDependencies = dependenciesExtractor.extractLocalFileDependencies(classpath.getPlusConfigurations(), classpath.getMinusConfigurations());
    for (IdeLocalFileDependency it : localFileDependencies) {
        libraries.add(createLibraryEntry(it.getFile(), null, null, classpath, null));
    }
    return libraries;
}
Also used : IdeLocalFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency) IdeExtendedRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency) AbstractClasspathEntry(org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry)

Example 7 with IdeExtendedRepoFileDependency

use of org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency in project gradle by gradle.

the class IdeDependenciesExtractor method extractRepoFileDependencies.

public Collection<IdeExtendedRepoFileDependency> extractRepoFileDependencies(DependencyHandler dependencyHandler, Collection<Configuration> plusConfigurations, Collection<Configuration> minusConfigurations, boolean downloadSources, boolean downloadJavadoc) {
    // can have multiple IDE dependencies with same component identifier (see GRADLE-1622)
    Multimap<ComponentIdentifier, IdeExtendedRepoFileDependency> resolvedDependenciesComponentMap = LinkedHashMultimap.create();
    for (IdeExtendedRepoFileDependency dep : resolvedExternalDependencies(plusConfigurations, minusConfigurations)) {
        resolvedDependenciesComponentMap.put(toComponentIdentifier(dep.getId()), dep);
    }
    List<Class<? extends Artifact>> artifactTypes = new ArrayList<Class<? extends Artifact>>(2);
    if (downloadSources) {
        artifactTypes.add(SourcesArtifact.class);
    }
    if (downloadJavadoc) {
        artifactTypes.add(JavadocArtifact.class);
    }
    downloadAuxiliaryArtifacts(dependencyHandler, resolvedDependenciesComponentMap, artifactTypes);
    Collection<UnresolvedIdeRepoFileDependency> unresolvedDependencies = unresolvedExternalDependencies(plusConfigurations, minusConfigurations);
    Collection<IdeExtendedRepoFileDependency> resolvedDependencies = resolvedDependenciesComponentMap.values();
    Collection<IdeExtendedRepoFileDependency> resolvedAndUnresolved = new ArrayList<IdeExtendedRepoFileDependency>(unresolvedDependencies.size() + resolvedDependencies.size());
    resolvedAndUnresolved.addAll(resolvedDependencies);
    resolvedAndUnresolved.addAll(unresolvedDependencies);
    return resolvedAndUnresolved;
}
Also used : IdeExtendedRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency) UnresolvedIdeRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.UnresolvedIdeRepoFileDependency) ArrayList(java.util.ArrayList) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) JavadocArtifact(org.gradle.language.java.artifact.JavadocArtifact) SourcesArtifact(org.gradle.language.base.artifact.SourcesArtifact) Artifact(org.gradle.api.component.Artifact)

Aggregations

IdeExtendedRepoFileDependency (org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency)7 IdeLocalFileDependency (org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency)4 File (java.io.File)2 ArrayList (java.util.ArrayList)2 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)2 Artifact (org.gradle.api.component.Artifact)2 SourcesArtifact (org.gradle.language.base.artifact.SourcesArtifact)2 JavadocArtifact (org.gradle.language.java.artifact.JavadocArtifact)2 IdeDependenciesExtractor (org.gradle.plugins.ide.internal.IdeDependenciesExtractor)2 UnresolvedIdeRepoFileDependency (org.gradle.plugins.ide.internal.resolver.model.UnresolvedIdeRepoFileDependency)2 Configuration (org.gradle.api.artifacts.Configuration)1 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 ResolvedArtifact (org.gradle.api.artifacts.ResolvedArtifact)1 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 ProjectComponentIdentifier (org.gradle.api.artifacts.component.ProjectComponentIdentifier)1 ArtifactResolutionQuery (org.gradle.api.artifacts.query.ArtifactResolutionQuery)1 ArtifactResult (org.gradle.api.artifacts.result.ArtifactResult)1 ComponentArtifactsResult (org.gradle.api.artifacts.result.ComponentArtifactsResult)1 ResolutionResult (org.gradle.api.artifacts.result.ResolutionResult)1 ResolvedArtifactResult (org.gradle.api.artifacts.result.ResolvedArtifactResult)1