Search in sources :

Example 6 with AttributeContainerInternal

use of org.gradle.api.internal.attributes.AttributeContainerInternal in project gradle by gradle.

the class DefaultDependenciesToModuleDescriptorConverter method addDependencies.

private void addDependencies(BuildableLocalComponentMetadata metaData, ConfigurationInternal configuration) {
    AttributeContainerInternal attributes = configuration.getAttributes();
    for (Dependency dependency : configuration.getDependencies()) {
        if (dependency instanceof ModuleDependency) {
            ModuleDependency moduleDependency = (ModuleDependency) dependency;
            metaData.addDependency(dependencyDescriptorFactory.createDependencyDescriptor(configuration.getName(), attributes, moduleDependency));
        } else if (dependency instanceof FileCollectionDependency) {
            final FileCollectionDependency fileDependency = (FileCollectionDependency) dependency;
            metaData.addFiles(configuration.getName(), new DefaultLocalFileDependencyMetadata(fileDependency));
        } else {
            throw new IllegalArgumentException("Cannot convert dependency " + dependency + " to local component dependency metadata.");
        }
    }
}
Also used : ModuleDependency(org.gradle.api.artifacts.ModuleDependency) FileCollectionDependency(org.gradle.api.artifacts.FileCollectionDependency) Dependency(org.gradle.api.artifacts.Dependency) ModuleDependency(org.gradle.api.artifacts.ModuleDependency) FileCollectionDependency(org.gradle.api.artifacts.FileCollectionDependency) AttributeContainerInternal(org.gradle.api.internal.attributes.AttributeContainerInternal)

Aggregations

AttributeContainerInternal (org.gradle.api.internal.attributes.AttributeContainerInternal)6 ImmutableSet (com.google.common.collect.ImmutableSet)2 File (java.io.File)2 LinkedHashSet (java.util.LinkedHashSet)2 EnumMap (java.util.EnumMap)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Dependency (org.gradle.api.artifacts.Dependency)1 FileCollectionDependency (org.gradle.api.artifacts.FileCollectionDependency)1 ModuleDependency (org.gradle.api.artifacts.ModuleDependency)1 PublishArtifact (org.gradle.api.artifacts.PublishArtifact)1 ResolvedArtifact (org.gradle.api.artifacts.ResolvedArtifact)1 ComponentArtifactIdentifier (org.gradle.api.artifacts.component.ComponentArtifactIdentifier)1 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 AttributesSchema (org.gradle.api.attributes.AttributesSchema)1 DefaultResolvedArtifact (org.gradle.api.internal.artifacts.DefaultResolvedArtifact)1 OutgoingVariant (org.gradle.api.internal.artifacts.configurations.OutgoingVariant)1