Search in sources :

Example 16 with ComponentResolveMetadata

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

the class DependencyLockingArtifactVisitor method visitNode.

@Override
public void visitNode(DependencyGraphNode node) {
    boolean changing = false;
    ComponentIdentifier identifier = node.getOwner().getComponentId();
    ComponentResolveMetadata metadata = node.getOwner().getMetadata();
    if (metadata != null && metadata.isChanging()) {
        changing = true;
    }
    if (!node.isRoot() && identifier instanceof ModuleComponentIdentifier) {
        ModuleComponentIdentifier id = (ModuleComponentIdentifier) identifier;
        if (identifier instanceof MavenUniqueSnapshotComponentIdentifier) {
            id = ((MavenUniqueSnapshotComponentIdentifier) id).getSnapshotComponent();
        }
        if (!id.getVersion().isEmpty()) {
            if (allResolvedModules.add(id)) {
                if (changing) {
                    addChangingModule(id);
                }
                if (dependencyLockingState.mustValidateLockState()) {
                    ModuleComponentIdentifier lockedId = modulesToBeLocked.remove(id.getModuleIdentifier());
                    if (lockedId == null) {
                        if (!dependencyLockingState.getIgnoredEntryFilter().isSatisfiedBy(id)) {
                            extraModules.add(id);
                        }
                    } else if (!lockedId.getVersion().equals(id.getVersion()) && !isNodeRejected(node)) {
                        // Need to check that versions do match, mismatch indicates a force was used
                        forcedModules.put(lockedId, id.getVersion());
                    }
                }
            }
        }
    }
}
Also used : MavenUniqueSnapshotComponentIdentifier(org.gradle.api.internal.artifacts.repositories.resolver.MavenUniqueSnapshotComponentIdentifier) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) MavenUniqueSnapshotComponentIdentifier(org.gradle.api.internal.artifacts.repositories.resolver.MavenUniqueSnapshotComponentIdentifier) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) ComponentResolveMetadata(org.gradle.internal.component.model.ComponentResolveMetadata)

Aggregations

ComponentResolveMetadata (org.gradle.internal.component.model.ComponentResolveMetadata)16 ImmutableAttributes (org.gradle.api.internal.attributes.ImmutableAttributes)3 ConfigurationMetadata (org.gradle.internal.component.model.ConfigurationMetadata)3 ModuleVersionResolveException (org.gradle.internal.resolve.ModuleVersionResolveException)3 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)2 ProjectComponentIdentifier (org.gradle.api.artifacts.component.ProjectComponentIdentifier)2 Version (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.Version)2 ExcludeSpec (org.gradle.api.internal.artifacts.ivyservice.resolveengine.excludes.specs.ExcludeSpec)2 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 Nullable (javax.annotation.Nullable)1 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 ComponentSelector (org.gradle.api.artifacts.component.ComponentSelector)1 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)1 DefaultModuleVersionIdentifier (org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier)1 DefaultConflictResolverDetails (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.conflicts.DefaultConflictResolverDetails)1 MavenUniqueSnapshotComponentIdentifier (org.gradle.api.internal.artifacts.repositories.resolver.MavenUniqueSnapshotComponentIdentifier)1 DefaultComponentArtifactsResult (org.gradle.api.internal.artifacts.result.DefaultComponentArtifactsResult)1 AttributeMergingException (org.gradle.api.internal.attributes.AttributeMergingException)1