use of org.gradle.api.artifacts.component.ModuleComponentSelector in project gradle by gradle.
the class AbstractDependencyMetadataAdapter method attributes.
@Override
public T attributes(Action<? super AttributeContainer> configureAction) {
ModuleComponentSelector selector = getOriginalMetadata().getSelector();
AttributeContainerInternal attributes = attributesFactory.mutable((AttributeContainerInternal) selector.getAttributes());
configureAction.execute(attributes);
ModuleComponentSelector target = DefaultModuleComponentSelector.newSelector(selector.getModuleIdentifier(), selector.getVersionConstraint(), attributes.asImmutable(), selector.getRequestedCapabilities());
ModuleDependencyMetadata metadata = (ModuleDependencyMetadata) getOriginalMetadata().withTarget(target);
updateMetadata(metadata);
return Cast.uncheckedCast(this);
}
use of org.gradle.api.artifacts.component.ModuleComponentSelector in project gradle by gradle.
the class AttributeDesugaring method desugarSelector.
public ComponentSelector desugarSelector(ComponentSelector selector) {
if (selector instanceof ModuleComponentSelector) {
ModuleComponentSelector module = (ModuleComponentSelector) selector;
AttributeContainer moduleAttributes = module.getAttributes();
if (!moduleAttributes.isEmpty()) {
ImmutableAttributes attributes = ((AttributeContainerInternal) moduleAttributes).asImmutable();
return DefaultModuleComponentSelector.newSelector(module.getModuleIdentifier(), module.getVersionConstraint(), desugar(attributes), module.getRequestedCapabilities());
}
}
if (selector instanceof DefaultProjectComponentSelector) {
DefaultProjectComponentSelector project = (DefaultProjectComponentSelector) selector;
AttributeContainer projectAttributes = project.getAttributes();
if (!projectAttributes.isEmpty()) {
ImmutableAttributes attributes = ((AttributeContainerInternal) projectAttributes).asImmutable();
return new DefaultProjectComponentSelector(project.getBuildIdentifier(), project.getIdentityPath(), project.projectPath(), project.getProjectName(), desugar(attributes), project.getRequestedCapabilities());
}
}
return selector;
}
use of org.gradle.api.artifacts.component.ModuleComponentSelector in project gradle by gradle.
the class AbstractRealisedModuleResolveMetadataSerializationHelper method readDependencyMetadata.
protected GradleDependencyMetadata readDependencyMetadata(Decoder decoder) throws IOException {
ModuleComponentSelector selector = componentSelectorSerializer.read(decoder);
List<ExcludeMetadata> excludes = readMavenExcludes(decoder);
boolean constraint = decoder.readBoolean();
boolean endorsing = decoder.readBoolean();
boolean force = decoder.readBoolean();
String reason = decoder.readNullableString();
IvyArtifactName artifact = readNullableArtifact(decoder);
return new GradleDependencyMetadata(selector, excludes, constraint, endorsing, reason, force, artifact);
}
use of org.gradle.api.artifacts.component.ModuleComponentSelector in project gradle by gradle.
the class ModuleDependencyMetadataWrapper method withRequestedVersion.
@Override
public ModuleDependencyMetadata withRequestedVersion(VersionConstraint requestedVersion) {
ModuleComponentSelector selector = getSelector();
ModuleComponentSelector newSelector = DefaultModuleComponentSelector.newSelector(selector.getModuleIdentifier(), requestedVersion, selector.getAttributes(), selector.getRequestedCapabilities());
return new ModuleDependencyMetadataWrapper(delegate.withTarget(newSelector));
}
use of org.gradle.api.artifacts.component.ModuleComponentSelector in project gradle by gradle.
the class ConfigurationBoundExternalDependencyMetadata method withRequestedVersion.
@Override
public ModuleDependencyMetadata withRequestedVersion(VersionConstraint requestedVersion) {
ModuleComponentSelector selector = getSelector();
if (requestedVersion.equals(selector.getVersionConstraint())) {
return this;
}
ModuleComponentSelector newSelector = DefaultModuleComponentSelector.newSelector(selector.getModuleIdentifier(), requestedVersion, selector.getAttributes(), selector.getRequestedCapabilities());
return withRequested(newSelector);
}
Aggregations