use of org.gradle.internal.component.model.LocalOriginDependencyMetadata in project gradle by gradle.
the class IvyXmlModuleDescriptorWriter method printDependencies.
private void printDependencies(IvyModulePublishMetadata metadata, SimpleXmlWriter writer) throws IOException {
Collection<LocalOriginDependencyMetadata> dependencies = metadata.getDependencies();
if (dependencies.size() > 0) {
writer.startElement("dependencies");
for (LocalOriginDependencyMetadata dd : dependencies) {
printDependency(metadata, dd, writer);
}
printAllExcludes(metadata, writer);
writer.endElement();
}
}
use of org.gradle.internal.component.model.LocalOriginDependencyMetadata in project gradle by gradle.
the class DefaultLibraryLocalComponentMetadata method addDependency.
private void addDependency(DependencySpec dependency, String defaultProject, String usageConfigurationName) {
LocalOriginDependencyMetadata metadata = dependency instanceof ModuleDependencySpec ? moduleDependencyMetadata((ModuleDependencySpec) dependency, usageConfigurationName) : dependency instanceof ProjectDependencySpec ? projectDependencyMetadata((ProjectDependencySpec) dependency, defaultProject, usageConfigurationName) : binaryDependencyMetadata((LibraryBinaryDependencySpec) dependency, usageConfigurationName);
addDependency(metadata);
}
use of org.gradle.internal.component.model.LocalOriginDependencyMetadata in project gradle by gradle.
the class DefaultLocalComponentMetadata method copy.
/**
* Creates a copy of this metadata, transforming the artifacts and dependencies of this component.
*/
public DefaultLocalComponentMetadata copy(ComponentIdentifier componentIdentifier, Transformer<LocalComponentArtifactMetadata, LocalComponentArtifactMetadata> artifacts, Transformer<LocalOriginDependencyMetadata, LocalOriginDependencyMetadata> dependencies) {
DefaultLocalComponentMetadata copy = new DefaultLocalComponentMetadata(id, componentIdentifier, status, attributesSchema);
for (DefaultLocalConfigurationMetadata configuration : allConfigurations.values()) {
copy.addConfiguration(configuration.getName(), configuration.description, configuration.extendsFrom, configuration.hierarchy, configuration.visible, configuration.transitive, configuration.attributes, configuration.canBeConsumed, configuration.canBeResolved);
}
// Artifacts
// Keep track of transformed artifacts as a given artifact may appear in multiple variants
Map<LocalComponentArtifactMetadata, LocalComponentArtifactMetadata> transformedArtifacts = new HashMap<LocalComponentArtifactMetadata, LocalComponentArtifactMetadata>();
for (Map.Entry<String, LocalComponentArtifactMetadata> entry : allArtifacts.entries()) {
LocalComponentArtifactMetadata oldArtifact = entry.getValue();
LocalComponentArtifactMetadata newArtifact = copyArtifact(oldArtifact, artifacts, transformedArtifacts);
copy.allArtifacts.put(entry.getKey(), newArtifact);
}
// Variants
for (Map.Entry<String, DefaultVariantMetadata> entry : allVariants.entries()) {
DefaultVariantMetadata oldVariant = entry.getValue();
Set<LocalComponentArtifactMetadata> newArtifacts = new LinkedHashSet<LocalComponentArtifactMetadata>(oldVariant.getArtifacts().size());
for (ComponentArtifactMetadata oldArtifact : oldVariant.getArtifacts()) {
newArtifacts.add(copyArtifact((LocalComponentArtifactMetadata) oldArtifact, artifacts, transformedArtifacts));
}
copy.allVariants.put(entry.getKey(), new DefaultVariantMetadata(oldVariant.getAttributes(), newArtifacts));
}
// Dependencies
for (LocalOriginDependencyMetadata oldDependency : allDependencies) {
copy.allDependencies.add(dependencies.transform(oldDependency));
}
// Exclude rules
copy.allExcludes.addAll(allExcludes);
return copy;
}
Aggregations