use of org.gradle.api.internal.artifacts.repositories.metadata.MavenImmutableAttributesFactory 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;
}
Aggregations