Search in sources :

Example 1 with OutgoingVariant

use of org.gradle.api.internal.artifacts.configurations.OutgoingVariant in project gradle by gradle.

the class JvmLocalLibraryMetaDataAdapter method createResolvedMetaData.

private DefaultLibraryLocalComponentMetadata createResolvedMetaData(BinarySpecInternal selectedBinary, String projectPath, EnumMap<UsageKind, Iterable<DependencySpec>> dependenciesPerUsage, EnumMap<UsageKind, List<PublishArtifact>> artifacts) {
    DefaultLibraryLocalComponentMetadata metadata = newResolvedLibraryMetadata(selectedBinary.getId(), toStringMap(dependenciesPerUsage), projectPath);
    for (Map.Entry<UsageKind, List<PublishArtifact>> entry : artifacts.entrySet()) {
        UsageKind usage = entry.getKey();
        final List<PublishArtifact> publishArtifacts = entry.getValue();
        metadata.addArtifacts(usage.getConfigurationName(), publishArtifacts);
        metadata.addVariant(usage.getConfigurationName(), new OutgoingVariant() {

            @Override
            public AttributeContainerInternal getAttributes() {
                return ImmutableAttributes.EMPTY;
            }

            @Override
            public Set<? extends PublishArtifact> getArtifacts() {
                return new LinkedHashSet<PublishArtifact>(publishArtifacts);
            }

            @Override
            public Set<? extends OutgoingVariant> getChildren() {
                return ImmutableSet.of();
            }
        });
    }
    return metadata;
}
Also used : OutgoingVariant(org.gradle.api.internal.artifacts.configurations.OutgoingVariant) LinkedHashSet(java.util.LinkedHashSet) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) DefaultLibraryLocalComponentMetadata(org.gradle.language.base.internal.model.DefaultLibraryLocalComponentMetadata) LinkedList(java.util.LinkedList) List(java.util.List) PublishArtifact(org.gradle.api.artifacts.PublishArtifact) DefaultPublishArtifact(org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact) HashMap(java.util.HashMap) Map(java.util.Map) EnumMap(java.util.EnumMap) AttributeContainerInternal(org.gradle.api.internal.attributes.AttributeContainerInternal)

Example 2 with OutgoingVariant

use of org.gradle.api.internal.artifacts.configurations.OutgoingVariant in project gradle by gradle.

the class DefaultConfigurationComponentMetaDataBuilder method addConfigurations.

public void addConfigurations(BuildableLocalComponentMetadata metaData, Collection<? extends ConfigurationInternal> configurations) {
    for (ConfigurationInternal configuration : configurations) {
        addConfiguration(metaData, configuration);
        dependenciesConverter.addDependencyDescriptors(metaData, configuration);
        OutgoingVariant outgoingVariant = configuration.convertToOutgoingVariant();
        metaData.addArtifacts(configuration.getName(), outgoingVariant.getArtifacts());
        for (OutgoingVariant variant : outgoingVariant.getChildren()) {
            metaData.addVariant(configuration.getName(), variant);
        }
    }
}
Also used : OutgoingVariant(org.gradle.api.internal.artifacts.configurations.OutgoingVariant) ConfigurationInternal(org.gradle.api.internal.artifacts.configurations.ConfigurationInternal)

Aggregations

OutgoingVariant (org.gradle.api.internal.artifacts.configurations.OutgoingVariant)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 EnumMap (java.util.EnumMap)1 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 PublishArtifact (org.gradle.api.artifacts.PublishArtifact)1 ConfigurationInternal (org.gradle.api.internal.artifacts.configurations.ConfigurationInternal)1 DefaultPublishArtifact (org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact)1 AttributeContainerInternal (org.gradle.api.internal.attributes.AttributeContainerInternal)1 DefaultLibraryLocalComponentMetadata (org.gradle.language.base.internal.model.DefaultLibraryLocalComponentMetadata)1