Search in sources :

Example 1 with DefaultLibraryLocalComponentMetadata

use of org.gradle.language.base.internal.model.DefaultLibraryLocalComponentMetadata 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) {
    final 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 DisplayName asDescribable() {
                return Describables.of(metadata.getId());
            }

            @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 : LinkedHashSet(java.util.LinkedHashSet) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) DefaultLibraryLocalComponentMetadata(org.gradle.language.base.internal.model.DefaultLibraryLocalComponentMetadata) AttributeContainerInternal(org.gradle.api.internal.attributes.AttributeContainerInternal) OutgoingVariant(org.gradle.api.internal.artifacts.configurations.OutgoingVariant) DisplayName(org.gradle.internal.DisplayName) 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)

Aggregations

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 OutgoingVariant (org.gradle.api.internal.artifacts.configurations.OutgoingVariant)1 DefaultPublishArtifact (org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact)1 AttributeContainerInternal (org.gradle.api.internal.attributes.AttributeContainerInternal)1 DisplayName (org.gradle.internal.DisplayName)1 DefaultLibraryLocalComponentMetadata (org.gradle.language.base.internal.model.DefaultLibraryLocalComponentMetadata)1