Search in sources :

Example 1 with LocalOriginDependencyMetadata

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();
    }
}
Also used : LocalOriginDependencyMetadata(org.gradle.internal.component.model.LocalOriginDependencyMetadata)

Example 2 with LocalOriginDependencyMetadata

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);
}
Also used : ModuleDependencySpec(org.gradle.platform.base.ModuleDependencySpec) ProjectDependencySpec(org.gradle.platform.base.ProjectDependencySpec) LocalOriginDependencyMetadata(org.gradle.internal.component.model.LocalOriginDependencyMetadata)

Example 3 with LocalOriginDependencyMetadata

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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) HashMap(java.util.HashMap) ComponentArtifactMetadata(org.gradle.internal.component.model.ComponentArtifactMetadata) LocalOriginDependencyMetadata(org.gradle.internal.component.model.LocalOriginDependencyMetadata) HashMap(java.util.HashMap) Map(java.util.Map) DefaultVariantMetadata(org.gradle.internal.component.model.DefaultVariantMetadata)

Aggregations

LocalOriginDependencyMetadata (org.gradle.internal.component.model.LocalOriginDependencyMetadata)3 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 ComponentArtifactMetadata (org.gradle.internal.component.model.ComponentArtifactMetadata)1 DefaultVariantMetadata (org.gradle.internal.component.model.DefaultVariantMetadata)1 ModuleDependencySpec (org.gradle.platform.base.ModuleDependencySpec)1 ProjectDependencySpec (org.gradle.platform.base.ProjectDependencySpec)1