use of org.gradle.internal.component.external.model.ConfigurationBoundExternalDependencyMetadata in project gradle by gradle.
the class RealisedMavenModuleResolveMetadataSerializationHelper method writeDependencies.
@Override
protected void writeDependencies(Encoder encoder, ConfigurationMetadata configuration, Map<ExternalDependencyDescriptor, Integer> deduplicationDependencyCache) throws IOException {
List<? extends DependencyMetadata> dependencies = configuration.getDependencies();
encoder.writeSmallInt(dependencies.size());
for (DependencyMetadata dependency : dependencies) {
if (dependency instanceof ForcedDependencyMetadataWrapper) {
ForcedDependencyMetadataWrapper wrapper = (ForcedDependencyMetadataWrapper) dependency;
dependency = wrapper.unwrap();
if (wrapper.isForce()) {
encoder.writeByte(FORCED_DEPENDENCY_METADATA);
}
}
if (dependency instanceof GradleDependencyMetadata) {
encoder.writeByte(GRADLE_DEPENDENCY_METADATA);
writeDependencyMetadata(encoder, (GradleDependencyMetadata) dependency);
} else if (dependency instanceof ConfigurationBoundExternalDependencyMetadata) {
ConfigurationBoundExternalDependencyMetadata dependencyMetadata = (ConfigurationBoundExternalDependencyMetadata) dependency;
ExternalDependencyDescriptor dependencyDescriptor = dependencyMetadata.getDependencyDescriptor();
if (dependencyDescriptor instanceof MavenDependencyDescriptor) {
encoder.writeByte(MAVEN_DEPENDENCY_METADATA);
writeMavenDependency(encoder, (MavenDependencyDescriptor) dependencyDescriptor, deduplicationDependencyCache);
} else {
throw new IllegalStateException("Unknown type of dependency descriptor: " + dependencyDescriptor.getClass());
}
encoder.writeNullableString(dependency.getReason());
}
}
}
use of org.gradle.internal.component.external.model.ConfigurationBoundExternalDependencyMetadata in project gradle by gradle.
the class RealisedMavenModuleResolveMetadata method contextualize.
static ModuleDependencyMetadata contextualize(ConfigurationMetadata config, ModuleComponentIdentifier componentId, MavenDependencyDescriptor incoming) {
ConfigurationBoundExternalDependencyMetadata dependency = new ConfigurationBoundExternalDependencyMetadata(config, componentId, incoming);
dependency.alwaysUseAttributeMatching();
return dependency;
}
use of org.gradle.internal.component.external.model.ConfigurationBoundExternalDependencyMetadata in project gradle by gradle.
the class DirectDependencyMetadataAdapter method getIvyArtifacts.
private List<IvyArtifactName> getIvyArtifacts() {
ModuleDependencyMetadata originalMetadata = getOriginalMetadata();
if (originalMetadata instanceof ConfigurationBoundExternalDependencyMetadata) {
ConfigurationBoundExternalDependencyMetadata externalMetadata = (ConfigurationBoundExternalDependencyMetadata) originalMetadata;
ExternalDependencyDescriptor descriptor = externalMetadata.getDependencyDescriptor();
if (descriptor instanceof MavenDependencyDescriptor) {
return fromMavenDescriptor((MavenDependencyDescriptor) descriptor);
}
if (descriptor instanceof IvyDependencyDescriptor) {
return fromIvyDescriptor((IvyDependencyDescriptor) descriptor);
}
} else if (originalMetadata instanceof GradleDependencyMetadata) {
return fromGradleMetadata((GradleDependencyMetadata) originalMetadata);
}
return Collections.emptyList();
}
use of org.gradle.internal.component.external.model.ConfigurationBoundExternalDependencyMetadata in project gradle by gradle.
the class RealisedIvyModuleResolveMetadata method withDependencies.
private IvyModuleResolveMetadata withDependencies(Map<IvyDependencyDescriptor, IvyDependencyDescriptor> transformed) {
ImmutableList<IvyDependencyDescriptor> transformedDescriptors = ImmutableList.copyOf(transformed.values());
Set<String> configurationNames = getConfigurationNames();
Map<String, ConfigurationMetadata> transformedConfigurations = Maps.newHashMapWithExpectedSize(configurationNames.size());
for (String name : configurationNames) {
RealisedConfigurationMetadata configuration = (RealisedConfigurationMetadata) getConfiguration(name);
List<? extends DependencyMetadata> dependencies = configuration.getDependencies();
ImmutableList.Builder<ModuleDependencyMetadata> transformedConfigurationDependencies = ImmutableList.builder();
for (DependencyMetadata dependency : dependencies) {
if (dependency instanceof ConfigurationBoundExternalDependencyMetadata) {
transformedConfigurationDependencies.add(((ConfigurationBoundExternalDependencyMetadata) dependency).withDescriptor(transformed.get(((ConfigurationBoundExternalDependencyMetadata) dependency).getDependencyDescriptor())));
} else {
transformedConfigurationDependencies.add((ModuleDependencyMetadata) dependency);
}
}
transformedConfigurations.put(name, configuration.withDependencies(transformedConfigurationDependencies.build()));
}
return new RealisedIvyModuleResolveMetadata(this, transformedDescriptors, transformedConfigurations);
}
use of org.gradle.internal.component.external.model.ConfigurationBoundExternalDependencyMetadata in project gradle by gradle.
the class RealisedIvyModuleResolveMetadataSerializationHelper method writeDependencies.
@Override
protected void writeDependencies(Encoder encoder, ConfigurationMetadata configuration, Map<ExternalDependencyDescriptor, Integer> deduplicationDependencyCache) throws IOException {
List<? extends DependencyMetadata> dependencies = configuration.getDependencies();
encoder.writeSmallInt(dependencies.size());
for (DependencyMetadata dependency : dependencies) {
if (dependency instanceof GradleDependencyMetadata) {
encoder.writeByte(GRADLE_DEPENDENCY_METADATA);
writeDependencyMetadata(encoder, (GradleDependencyMetadata) dependency);
} else if (dependency instanceof ConfigurationBoundExternalDependencyMetadata) {
ConfigurationBoundExternalDependencyMetadata dependencyMetadata = (ConfigurationBoundExternalDependencyMetadata) dependency;
ExternalDependencyDescriptor dependencyDescriptor = dependencyMetadata.getDependencyDescriptor();
if (dependencyDescriptor instanceof IvyDependencyDescriptor) {
encoder.writeByte(IVY_DEPENDENCY_METADATA);
boolean addedByRule = configuration instanceof RealisedConfigurationMetadata && ((RealisedConfigurationMetadata) configuration).isAddedByRule();
writeIvyDependency(encoder, (IvyDependencyDescriptor) dependencyDescriptor, configuration.getName(), addedByRule);
} else {
throw new IllegalStateException("Unknown type of dependency descriptor: " + dependencyDescriptor.getClass());
}
encoder.writeNullableString(dependency.getReason());
}
}
}
Aggregations