Search in sources :

Example 1 with DefaultMavenModuleResolveMetadata

use of org.gradle.internal.component.external.model.maven.DefaultMavenModuleResolveMetadata in project gradle by gradle.

the class JavaEcosystemVariantDerivationStrategy method derive.

@Override
public ImmutableList<? extends ConfigurationMetadata> derive(ModuleComponentResolveMetadata metadata) {
    if (metadata instanceof DefaultMavenModuleResolveMetadata) {
        DefaultMavenModuleResolveMetadata md = (DefaultMavenModuleResolveMetadata) metadata;
        ImmutableAttributes attributes = md.getAttributes();
        MavenImmutableAttributesFactory attributesFactory = (MavenImmutableAttributesFactory) md.getAttributesFactory();
        DefaultConfigurationMetadata compileConfiguration = (DefaultConfigurationMetadata) md.getConfiguration("compile");
        DefaultConfigurationMetadata runtimeConfiguration = (DefaultConfigurationMetadata) md.getConfiguration("runtime");
        ModuleComponentIdentifier componentId = md.getId();
        ImmutableCapabilities shadowedPlatformCapability = buildShadowPlatformCapability(componentId, false);
        ImmutableCapabilities shadowedEnforcedPlatformCapability = buildShadowPlatformCapability(componentId, true);
        return ImmutableList.of(// component we cannot mix precise usages with more generic ones)
        libraryWithUsageAttribute(compileConfiguration, attributes, attributesFactory, Usage.JAVA_API), libraryWithUsageAttribute(runtimeConfiguration, attributes, attributesFactory, Usage.JAVA_RUNTIME), libraryWithSourcesVariant(runtimeConfiguration, attributes, attributesFactory, metadata), libraryWithJavadocVariant(runtimeConfiguration, attributes, attributesFactory, metadata), platformWithUsageAttribute(compileConfiguration, attributes, attributesFactory, Usage.JAVA_API, false, shadowedPlatformCapability), platformWithUsageAttribute(runtimeConfiguration, attributes, attributesFactory, Usage.JAVA_RUNTIME, false, shadowedPlatformCapability), platformWithUsageAttribute(compileConfiguration, attributes, attributesFactory, Usage.JAVA_API, true, shadowedEnforcedPlatformCapability), platformWithUsageAttribute(runtimeConfiguration, attributes, attributesFactory, Usage.JAVA_RUNTIME, true, shadowedEnforcedPlatformCapability));
    }
    return null;
}
Also used : ImmutableAttributes(org.gradle.api.internal.attributes.ImmutableAttributes) DefaultMavenModuleResolveMetadata(org.gradle.internal.component.external.model.maven.DefaultMavenModuleResolveMetadata) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) MavenImmutableAttributesFactory(org.gradle.api.internal.artifacts.repositories.metadata.MavenImmutableAttributesFactory)

Example 2 with DefaultMavenModuleResolveMetadata

use of org.gradle.internal.component.external.model.maven.DefaultMavenModuleResolveMetadata in project gradle by gradle.

the class ModuleComponentResolveMetadataSerializer method read.

@Override
public ModuleComponentResolveMetadata read(Decoder decoder) throws EOFException, Exception {
    Map<Integer, MavenDependencyDescriptor> deduplicationDependencyCache = Maps.newHashMap();
    MutableModuleComponentResolveMetadata mutable = delegate.read(decoder, moduleIdentifierFactory, deduplicationDependencyCache);
    readPlatformOwners(decoder, mutable);
    AbstractLazyModuleComponentResolveMetadata resolveMetadata = (AbstractLazyModuleComponentResolveMetadata) mutable.asImmutable();
    if (resolveMetadata instanceof DefaultIvyModuleResolveMetadata) {
        return ivySerializationHelper.readMetadata(decoder, (DefaultIvyModuleResolveMetadata) resolveMetadata);
    } else if (resolveMetadata instanceof DefaultMavenModuleResolveMetadata) {
        return mavenSerializationHelper.readMetadata(decoder, (DefaultMavenModuleResolveMetadata) resolveMetadata, deduplicationDependencyCache);
    } else {
        throw new IllegalStateException("Unknown resolved metadata type: " + resolveMetadata.getClass());
    }
}
Also used : MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) DefaultIvyModuleResolveMetadata(org.gradle.internal.component.external.model.ivy.DefaultIvyModuleResolveMetadata) MavenDependencyDescriptor(org.gradle.internal.component.external.model.maven.MavenDependencyDescriptor) DefaultMavenModuleResolveMetadata(org.gradle.internal.component.external.model.maven.DefaultMavenModuleResolveMetadata) AbstractLazyModuleComponentResolveMetadata(org.gradle.internal.component.external.model.AbstractLazyModuleComponentResolveMetadata)

Aggregations

DefaultMavenModuleResolveMetadata (org.gradle.internal.component.external.model.maven.DefaultMavenModuleResolveMetadata)2 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 MavenImmutableAttributesFactory (org.gradle.api.internal.artifacts.repositories.metadata.MavenImmutableAttributesFactory)1 ImmutableAttributes (org.gradle.api.internal.attributes.ImmutableAttributes)1 AbstractLazyModuleComponentResolveMetadata (org.gradle.internal.component.external.model.AbstractLazyModuleComponentResolveMetadata)1 MutableModuleComponentResolveMetadata (org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata)1 DefaultIvyModuleResolveMetadata (org.gradle.internal.component.external.model.ivy.DefaultIvyModuleResolveMetadata)1 MavenDependencyDescriptor (org.gradle.internal.component.external.model.maven.MavenDependencyDescriptor)1