Search in sources :

Example 11 with ComponentIdentifier

use of org.gradle.api.artifacts.component.ComponentIdentifier in project gradle by gradle.

the class DefaultRootComponentMetadataBuilder method toRootComponentMetaData.

@Override
public ComponentResolveMetadata toRootComponentMetaData() {
    Module module = metaDataProvider.getModule();
    ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
    DefaultLocalComponentMetadata metaData = holder.tryCached(componentIdentifier);
    if (metaData != null) {
        return metaData;
    }
    ModuleVersionIdentifier moduleVersionIdentifier = moduleIdentifierFactory.moduleWithVersion(module.getGroup(), module.getName(), module.getVersion());
    ProjectInternal project = projectFinder.findProject(module.getProjectPath());
    AttributesSchemaInternal schema = project == null ? null : (AttributesSchemaInternal) project.getDependencies().getAttributesSchema();
    metaData = new DefaultLocalComponentMetadata(moduleVersionIdentifier, componentIdentifier, module.getStatus(), schema);
    localComponentMetadataBuilder.addConfigurations(metaData, configurationsProvider.getAll());
    holder.cachedValue = metaData;
    return metaData;
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) DefaultLocalComponentMetadata(org.gradle.internal.component.local.model.DefaultLocalComponentMetadata) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) Module(org.gradle.api.internal.artifacts.Module) AttributesSchemaInternal(org.gradle.api.internal.attributes.AttributesSchemaInternal)

Example 12 with ComponentIdentifier

use of org.gradle.api.artifacts.component.ComponentIdentifier in project gradle by gradle.

the class ShortCircuitEmptyConfigurationResolver method emptyGraph.

private void emptyGraph(ConfigurationInternal configuration, ResolverResults results) {
    Module module = configuration.getModule();
    ModuleVersionIdentifier id = moduleIdentifierFactory.moduleWithVersion(module);
    ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
    ResolutionResult emptyResult = DefaultResolutionResultBuilder.empty(id, componentIdentifier);
    ResolvedLocalComponentsResult emptyProjectResult = new ResolvedLocalComponentsResultGraphVisitor(thisBuild.getCurrentBuild());
    results.graphResolved(emptyResult, emptyProjectResult, new EmptyResults());
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) ResolutionResult(org.gradle.api.artifacts.result.ResolutionResult) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) Module(org.gradle.api.internal.artifacts.Module) ResolvedLocalComponentsResult(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResult) ResolvedLocalComponentsResultGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor)

Example 13 with ComponentIdentifier

use of org.gradle.api.artifacts.component.ComponentIdentifier in project gradle by gradle.

the class DefaultConfiguration method toRootComponentMetaData.

public ComponentResolveMetadata toRootComponentMetaData() {
    Module module = getModule();
    ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
    ModuleVersionIdentifier moduleVersionIdentifier = moduleIdentifierFactory.moduleWithVersion(module.getGroup(), module.getName(), module.getVersion());
    ProjectInternal project = projectFinder.findProject(module.getProjectPath());
    AttributesSchemaInternal schema = project == null ? null : (AttributesSchemaInternal) project.getDependencies().getAttributesSchema();
    DefaultLocalComponentMetadata metaData = new DefaultLocalComponentMetadata(moduleVersionIdentifier, componentIdentifier, module.getStatus(), schema);
    configurationComponentMetaDataBuilder.addConfigurations(metaData, configurationsProvider.getAll());
    return metaData;
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) DefaultLocalComponentMetadata(org.gradle.internal.component.local.model.DefaultLocalComponentMetadata) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) Module(org.gradle.api.internal.artifacts.Module) AttributesSchemaInternal(org.gradle.api.internal.attributes.AttributesSchemaInternal)

Example 14 with ComponentIdentifier

use of org.gradle.api.artifacts.component.ComponentIdentifier in project gradle by gradle.

the class JsonProjectDependencyRenderer method populateModulesWithChildDependencies.

private void populateModulesWithChildDependencies(RenderableDependency dependency, Set<ComponentIdentifier> visited, Set<ModuleIdentifier> modules) {
    for (RenderableDependency childDependency : dependency.getChildren()) {
        ModuleIdentifier moduleId = getModuleIdentifier(childDependency);
        if (moduleId == null) {
            continue;
        }
        modules.add(moduleId);
        boolean alreadyVisited = !visited.add((ComponentIdentifier) childDependency.getId());
        if (!alreadyVisited) {
            populateModulesWithChildDependencies(childDependency, visited, modules);
        }
    }
}
Also used : RenderableDependency(org.gradle.api.tasks.diagnostics.internal.graph.nodes.RenderableDependency) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) ModuleIdentifier(org.gradle.api.artifacts.ModuleIdentifier) DefaultModuleIdentifier(org.gradle.api.internal.artifacts.DefaultModuleIdentifier)

Example 15 with ComponentIdentifier

use of org.gradle.api.artifacts.component.ComponentIdentifier 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

ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)18 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)8 ProjectComponentIdentifier (org.gradle.api.artifacts.component.ProjectComponentIdentifier)7 File (java.io.File)5 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)5 DependencyResult (org.gradle.api.artifacts.result.DependencyResult)4 ResolvedDependencyResult (org.gradle.api.artifacts.result.ResolvedDependencyResult)4 UnresolvedDependencyResult (org.gradle.api.artifacts.result.UnresolvedDependencyResult)4 Module (org.gradle.api.internal.artifacts.Module)4 ResolvedArtifact (org.gradle.api.artifacts.ResolvedArtifact)3 ResolvedComponentResult (org.gradle.api.artifacts.result.ResolvedComponentResult)3 DefaultModuleComponentIdentifier (org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier)3 DefaultLocalComponentMetadata (org.gradle.internal.component.local.model.DefaultLocalComponentMetadata)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 ModuleIdentifier (org.gradle.api.artifacts.ModuleIdentifier)2 ComponentArtifactIdentifier (org.gradle.api.artifacts.component.ComponentArtifactIdentifier)2 ComponentSelector (org.gradle.api.artifacts.component.ComponentSelector)2 ResolutionResult (org.gradle.api.artifacts.result.ResolutionResult)2 DefaultModuleIdentifier (org.gradle.api.internal.artifacts.DefaultModuleIdentifier)2