Search in sources :

Example 1 with DependencyMetadata

use of org.gradle.internal.component.model.DependencyMetadata in project gradle by gradle.

the class ClientModuleResolver method addClientModuleDependencies.

private void addClientModuleDependencies(ClientModule clientModule, MutableModuleComponentResolveMetadata clientModuleMetaData) {
    List<DependencyMetadata> dependencies = Lists.newArrayList();
    for (ModuleDependency moduleDependency : clientModule.getDependencies()) {
        DependencyMetadata dependencyMetadata = dependencyDescriptorFactory.createDependencyDescriptor(moduleDependency.getTargetConfiguration(), null, moduleDependency);
        dependencies.add(dependencyMetadata);
    }
    clientModuleMetaData.setDependencies(dependencies);
}
Also used : ModuleDependency(org.gradle.api.artifacts.ModuleDependency) DependencyMetadata(org.gradle.internal.component.model.DependencyMetadata)

Example 2 with DependencyMetadata

use of org.gradle.internal.component.model.DependencyMetadata in project gradle by gradle.

the class NodeState method visitDependencies.

/**
 * Iterate over the dependencies originating in this node, adding them either as a 'pending' dependency
 * or adding them to the `discoveredEdges` collection (and `this.outgoingEdges`)
 */
private void visitDependencies(ModuleExclusion resolutionFilter, PendingDependenciesHandler pendingDependenciesHandler, Collection<EdgeState> discoveredEdges) {
    PendingDependenciesHandler.Visitor pendingDepsVisitor = pendingDependenciesHandler.start();
    try {
        for (DependencyMetadata dependency : metaData.getDependencies()) {
            DependencyState dependencyState = new DependencyState(dependency, resolveState.getComponentSelectorConverter());
            if (isExcluded(resolutionFilter, dependencyState)) {
                continue;
            }
            dependencyState = maybeSubstitute(dependencyState);
            if (!pendingDepsVisitor.maybeAddAsPendingDependency(this, dependencyState)) {
                EdgeState dependencyEdge = new EdgeState(this, dependencyState, resolutionFilter, resolveState);
                outgoingEdges.add(dependencyEdge);
                discoveredEdges.add(dependencyEdge);
            }
        }
        previousTraversalExclusions = resolutionFilter;
    } finally {
        // If there are 'pending' dependencies that share a target with any of these outgoing edges,
        // then reset the state of the node that owns those dependencies.
        // This way, all edges of the node will be re-processed.
        pendingDepsVisitor.complete();
    }
}
Also used : DependencyMetadata(org.gradle.internal.component.model.DependencyMetadata) LocalFileDependencyMetadata(org.gradle.internal.component.local.model.LocalFileDependencyMetadata)

Example 3 with DependencyMetadata

use of org.gradle.internal.component.model.DependencyMetadata in project gradle by gradle.

the class NodeState method isExcluded.

private boolean isExcluded(ModuleExclusion selector, DependencyState dependencyState) {
    DependencyMetadata dependency = dependencyState.getDependency();
    if (!resolveState.getEdgeFilter().isSatisfiedBy(dependency)) {
        LOGGER.debug("{} is filtered.", dependency);
        return true;
    }
    if (selector == ModuleExclusions.excludeNone()) {
        return false;
    }
    ModuleIdentifier targetModuleId = dependencyState.getModuleIdentifier();
    if (selector.excludeModule(targetModuleId)) {
        LOGGER.debug("{} is excluded from {}.", targetModuleId, this);
        return true;
    }
    return false;
}
Also used : DependencyMetadata(org.gradle.internal.component.model.DependencyMetadata) LocalFileDependencyMetadata(org.gradle.internal.component.local.model.LocalFileDependencyMetadata) ModuleIdentifier(org.gradle.api.artifacts.ModuleIdentifier)

Example 4 with DependencyMetadata

use of org.gradle.internal.component.model.DependencyMetadata in project gradle by gradle.

the class NodeState method isExcluded.

private boolean isExcluded(ExcludeSpec excludeSpec, DependencyState dependencyState) {
    DependencyMetadata dependency = dependencyState.getDependency();
    if (!resolveState.getEdgeFilter().isSatisfiedBy(dependency)) {
        LOGGER.debug("{} is filtered.", dependency);
        return true;
    }
    if (excludeSpec == moduleExclusions.nothing()) {
        return false;
    }
    ModuleIdentifier targetModuleId = dependencyState.getModuleIdentifier();
    if (excludeSpec.excludes(targetModuleId)) {
        LOGGER.debug("{} is excluded from {} by {}.", targetModuleId, this, excludeSpec);
        return true;
    }
    return false;
}
Also used : LocalFileDependencyMetadata(org.gradle.internal.component.local.model.LocalFileDependencyMetadata) DependencyMetadata(org.gradle.internal.component.model.DependencyMetadata) ModuleIdentifier(org.gradle.api.artifacts.ModuleIdentifier)

Example 5 with DependencyMetadata

use of org.gradle.internal.component.model.DependencyMetadata in project gradle by gradle.

the class IncompatibleDependencyAttributesMessageBuilder method formatAttributeQuery.

private static String formatAttributeQuery(SelectorState state, Attribute<?> attribute) {
    DependencyMetadata dependencyMetadata = state.getDependencyMetadata();
    ComponentSelector selector = dependencyMetadata.getSelector();
    if (selector instanceof ModuleComponentSelector) {
        StringBuilder sb = new StringBuilder("wants '" + state.getRequested() + "' with attribute " + attribute.getName() + " = ");
        sb.append(selector.getAttributes().getAttribute(attribute));
        return sb.toString();
    } else {
        // that for a specific module resolve state, all selectors are of the same type
        return "doesn't provide any value for attribute " + attribute.getName();
    }
}
Also used : ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) DependencyMetadata(org.gradle.internal.component.model.DependencyMetadata)

Aggregations

DependencyMetadata (org.gradle.internal.component.model.DependencyMetadata)11 ConfigurationBoundExternalDependencyMetadata (org.gradle.internal.component.external.model.ConfigurationBoundExternalDependencyMetadata)3 ModuleDependencyMetadata (org.gradle.internal.component.external.model.ModuleDependencyMetadata)3 LocalFileDependencyMetadata (org.gradle.internal.component.local.model.LocalFileDependencyMetadata)3 ModuleIdentifier (org.gradle.api.artifacts.ModuleIdentifier)2 ComponentSelector (org.gradle.api.artifacts.component.ComponentSelector)2 ExternalDependencyDescriptor (org.gradle.internal.component.external.model.ExternalDependencyDescriptor)2 GradleDependencyMetadata (org.gradle.internal.component.external.model.GradleDependencyMetadata)2 RealisedConfigurationMetadata (org.gradle.internal.component.external.model.RealisedConfigurationMetadata)2 ImmutableList (com.google.common.collect.ImmutableList)1 ArrayList (java.util.ArrayList)1 ModuleDependency (org.gradle.api.artifacts.ModuleDependency)1 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)1 AttributeContainerInternal (org.gradle.api.internal.attributes.AttributeContainerInternal)1 AttributeMergingException (org.gradle.api.internal.attributes.AttributeMergingException)1 ImmutableAttributes (org.gradle.api.internal.attributes.ImmutableAttributes)1 ForcedDependencyMetadataWrapper (org.gradle.internal.component.external.model.ForcedDependencyMetadataWrapper)1 ModuleComponentResolveMetadata (org.gradle.internal.component.external.model.ModuleComponentResolveMetadata)1 MutableModuleComponentResolveMetadata (org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata)1 ConfigurationMetadata (org.gradle.internal.component.model.ConfigurationMetadata)1