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;
}
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());
}
}
Aggregations