Search in sources :

Example 1 with ComponentConfigurationIdentifier

use of org.gradle.internal.component.model.ComponentConfigurationIdentifier in project gradle by gradle.

the class DefaultLocalComponentMetadataBuilder method addConfiguration.

@Override
public BuildableLocalConfigurationMetadata addConfiguration(BuildableLocalComponentMetadata metaData, ConfigurationInternal configuration) {
    BuildableLocalConfigurationMetadata configurationMetadata = createConfiguration(metaData, configuration);
    metaData.addDependenciesAndExcludesForConfiguration(configuration, configurationMetadataBuilder);
    ComponentConfigurationIdentifier configurationIdentifier = new ComponentConfigurationIdentifier(metaData.getId(), configuration.getName());
    configuration.collectVariants(new ConfigurationInternal.VariantVisitor() {

        @Override
        public void visitArtifacts(Collection<? extends PublishArtifact> artifacts) {
            metaData.addArtifacts(configuration.getName(), artifacts);
        }

        @Override
        public void visitOwnVariant(DisplayName displayName, ImmutableAttributes attributes, Collection<? extends Capability> capabilities, Collection<? extends PublishArtifact> artifacts) {
            metaData.addVariant(configuration.getName(), configuration.getName(), configurationIdentifier, displayName, attributes, ImmutableCapabilities.of(capabilities), artifacts);
        }

        @Override
        public void visitChildVariant(String name, DisplayName displayName, ImmutableAttributes attributes, Collection<? extends Capability> capabilities, Collection<? extends PublishArtifact> artifacts) {
            metaData.addVariant(configuration.getName(), configuration.getName() + "-" + name, new NestedVariantIdentifier(configurationIdentifier, name), displayName, attributes, ImmutableCapabilities.of(capabilities), artifacts);
        }
    });
    return configurationMetadata;
}
Also used : ComponentConfigurationIdentifier(org.gradle.internal.component.model.ComponentConfigurationIdentifier) ImmutableAttributes(org.gradle.api.internal.attributes.ImmutableAttributes) DisplayName(org.gradle.internal.DisplayName) BuildableLocalConfigurationMetadata(org.gradle.internal.component.local.model.BuildableLocalConfigurationMetadata) ConfigurationInternal(org.gradle.api.internal.artifacts.configurations.ConfigurationInternal)

Example 2 with ComponentConfigurationIdentifier

use of org.gradle.internal.component.model.ComponentConfigurationIdentifier in project gradle by gradle.

the class DefaultArtifactSet method createForConfiguration.

public static ArtifactSet createForConfiguration(ComponentIdentifier componentIdentifier, ModuleVersionIdentifier ownerId, ConfigurationMetadata configuration, ImmutableList<? extends ComponentArtifactMetadata> artifacts, ModuleSources moduleSources, ExcludeSpec exclusions, AttributesSchemaInternal schema, ArtifactResolver artifactResolver, Map<ComponentArtifactIdentifier, ResolvableArtifact> allResolvedArtifacts, ArtifactTypeRegistry artifactTypeRegistry, ImmutableAttributes selectionAttributes, CalculatedValueContainerFactory calculatedValueContainerFactory) {
    VariantResolveMetadata variantMetadata = new DefaultVariantMetadata(configuration.getName(), new ComponentConfigurationIdentifier(componentIdentifier, configuration.getName()), configuration.asDescribable(), configuration.getAttributes(), artifacts, configuration.getCapabilities());
    ResolvedVariant resolvedVariant = toResolvedVariant(variantMetadata, ownerId, moduleSources, exclusions, artifactResolver, allResolvedArtifacts, artifactTypeRegistry, calculatedValueContainerFactory);
    return new SingleVariantArtifactSet(componentIdentifier, schema, resolvedVariant, selectionAttributes);
}
Also used : ComponentConfigurationIdentifier(org.gradle.internal.component.model.ComponentConfigurationIdentifier) VariantResolveMetadata(org.gradle.internal.component.model.VariantResolveMetadata) DefaultVariantMetadata(org.gradle.internal.component.model.DefaultVariantMetadata)

Aggregations

ComponentConfigurationIdentifier (org.gradle.internal.component.model.ComponentConfigurationIdentifier)2 ConfigurationInternal (org.gradle.api.internal.artifacts.configurations.ConfigurationInternal)1 ImmutableAttributes (org.gradle.api.internal.attributes.ImmutableAttributes)1 DisplayName (org.gradle.internal.DisplayName)1 BuildableLocalConfigurationMetadata (org.gradle.internal.component.local.model.BuildableLocalConfigurationMetadata)1 DefaultVariantMetadata (org.gradle.internal.component.model.DefaultVariantMetadata)1 VariantResolveMetadata (org.gradle.internal.component.model.VariantResolveMetadata)1