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;
}
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;
}
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();
}
}
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();
}
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);
}
}
Aggregations