Search in sources :

Example 21 with ModuleComponentIdentifier

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

the class ComponentState method tryResolveVirtualPlatform.

private boolean tryResolveVirtualPlatform() {
    if (module.isVirtualPlatform()) {
        for (ComponentState version : module.getAllVersions()) {
            if (version != this) {
                ComponentResolveMetadata metadata = version.getMetadata();
                if (metadata instanceof LenientPlatformResolveMetadata) {
                    LenientPlatformResolveMetadata lenient = (LenientPlatformResolveMetadata) metadata;
                    this.metadata = lenient.withVersion((ModuleComponentIdentifier) componentIdentifier, id);
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) ComponentResolveMetadata(org.gradle.internal.component.model.ComponentResolveMetadata)

Example 22 with ModuleComponentIdentifier

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

the class DependencyLockingArtifactVisitor method createLockingFailures.

private static Set<UnresolvedDependency> createLockingFailures(Map<ModuleIdentifier, ModuleComponentIdentifier> modulesToBeLocked, Set<ModuleComponentIdentifier> extraModules, Map<ModuleComponentIdentifier, String> forcedModules) {
    Set<UnresolvedDependency> completedFailures = Sets.newHashSetWithExpectedSize(modulesToBeLocked.values().size() + extraModules.size());
    for (ModuleComponentIdentifier presentInLock : modulesToBeLocked.values()) {
        completedFailures.add(new DefaultUnresolvedDependency(DefaultModuleVersionSelector.newSelector(presentInLock.getModuleIdentifier(), presentInLock.getVersion()), new LockOutOfDateException("Did not resolve '" + presentInLock.getDisplayName() + "' which is part of the dependency lock state")));
    }
    for (ModuleComponentIdentifier extraModule : extraModules) {
        completedFailures.add(new DefaultUnresolvedDependency(DefaultModuleVersionSelector.newSelector(extraModule.getModuleIdentifier(), extraModule.getVersion()), new LockOutOfDateException("Resolved '" + extraModule.getDisplayName() + "' which is not part of the dependency lock state")));
    }
    for (Map.Entry<ModuleComponentIdentifier, String> entry : forcedModules.entrySet()) {
        ModuleComponentIdentifier forcedModule = entry.getKey();
        completedFailures.add(new DefaultUnresolvedDependency(DefaultModuleVersionSelector.newSelector(forcedModule.getModuleIdentifier(), forcedModule.getVersion()), new LockOutOfDateException("Did not resolve '" + forcedModule.getDisplayName() + "' which has been forced / substituted to a different version: '" + entry.getValue() + "'")));
    }
    return completedFailures;
}
Also used : UnresolvedDependency(org.gradle.api.artifacts.UnresolvedDependency) DefaultUnresolvedDependency(org.gradle.api.internal.artifacts.ivyservice.DefaultUnresolvedDependency) DefaultUnresolvedDependency(org.gradle.api.internal.artifacts.ivyservice.DefaultUnresolvedDependency) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) Map(java.util.Map)

Example 23 with ModuleComponentIdentifier

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

the class DependencyLockingArtifactVisitor method startArtifacts.

@Override
public void startArtifacts(RootGraphNode root) {
    RootConfigurationMetadata metadata = root.getMetadata();
    dependencyLockingState = metadata.getDependencyLockingState();
    if (dependencyLockingState.mustValidateLockState()) {
        Set<ModuleComponentIdentifier> lockedModules = dependencyLockingState.getLockedDependencies();
        modulesToBeLocked = Maps.newHashMapWithExpectedSize(lockedModules.size());
        for (ModuleComponentIdentifier lockedModule : lockedModules) {
            modulesToBeLocked.put(lockedModule.getModuleIdentifier(), lockedModule);
        }
        allResolvedModules = Sets.newHashSetWithExpectedSize(this.modulesToBeLocked.size());
        extraModules = Sets.newHashSet();
        forcedModules = Maps.newHashMap();
    } else {
        modulesToBeLocked = Collections.emptyMap();
        allResolvedModules = Sets.newHashSet();
    }
}
Also used : ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) RootConfigurationMetadata(org.gradle.internal.component.local.model.RootConfigurationMetadata)

Example 24 with ModuleComponentIdentifier

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

the class AbstractRenderableDependencyResult method getName.

@Override
public String getName() {
    ComponentSelector requested = getRequested();
    ComponentIdentifier selected = getActual();
    if (exactMatch(requested, selected)) {
        return getSimpleName();
    }
    if (requested instanceof ModuleComponentSelector && selected instanceof ModuleComponentIdentifier) {
        ModuleComponentSelector requestedModuleComponentSelector = (ModuleComponentSelector) requested;
        ModuleComponentIdentifier selectedModuleComponentedIdentifier = (ModuleComponentIdentifier) selected;
        if (requestedModuleComponentSelector.getModuleIdentifier().equals(selectedModuleComponentedIdentifier.getModuleIdentifier())) {
            return getSimpleName() + " -> " + selectedModuleComponentedIdentifier.getVersion();
        }
    }
    return getSimpleName() + " -> " + selected.getDisplayName();
}
Also used : ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier)

Example 25 with ModuleComponentIdentifier

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

the class DependencyResolverIvyPublisher method publish.

@Override
public void publish(IvyNormalizedPublication publication, IvyArtifactRepository repository) {
    IvyResolver publisher = ((DefaultIvyArtifactRepository) repository).createPublisher();
    IvyPublicationIdentity projectIdentity = publication.getProjectIdentity();
    ModuleComponentIdentifier moduleVersionIdentifier = DefaultModuleComponentIdentifier.newId(DefaultModuleIdentifier.newId(projectIdentity.getOrganisation(), projectIdentity.getModule()), projectIdentity.getRevision());
    for (IvyArtifact artifact : publication.getAllArtifacts()) {
        ModuleComponentArtifactMetadata artifactMetadata = new DefaultModuleComponentArtifactMetadata(moduleVersionIdentifier, createIvyArtifact(artifact));
        publish(publisher, artifact, artifactMetadata);
    }
}
Also used : DefaultIvyArtifactRepository(org.gradle.api.internal.artifacts.repositories.DefaultIvyArtifactRepository) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) DefaultModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata) IvyResolver(org.gradle.api.internal.artifacts.repositories.resolver.IvyResolver) ModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata) DefaultModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata) IvyArtifact(org.gradle.api.publish.ivy.IvyArtifact)

Aggregations

ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)47 DefaultModuleComponentIdentifier (org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier)13 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)4 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)4 MavenUniqueSnapshotComponentIdentifier (org.gradle.api.internal.artifacts.repositories.resolver.MavenUniqueSnapshotComponentIdentifier)4 File (java.io.File)3 IOException (java.io.IOException)3 Map (java.util.Map)3 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)3 ComponentSelectionWithCurrent (com.github.benmanes.gradle.versions.updates.resolutionstrategy.ComponentSelectionWithCurrent)2 InputStream (java.io.InputStream)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)2 ComponentSelection (org.gradle.api.artifacts.ComponentSelection)2 ComponentSelector (org.gradle.api.artifacts.component.ComponentSelector)2 LibraryBinaryIdentifier (org.gradle.api.artifacts.component.LibraryBinaryIdentifier)2 DefaultComponentSelection (org.gradle.api.internal.artifacts.DefaultComponentSelection)2 DefaultProjectComponentIdentifier (org.gradle.api.internal.artifacts.DefaultProjectComponentIdentifier)2 NamespaceId (org.gradle.api.internal.artifacts.ivyservice.NamespaceId)2