use of org.gradle.api.capabilities.CapabilitiesMetadata in project gradle by gradle.
the class RealisedIvyModuleResolveMetadata method applyRules.
private static RealisedConfigurationMetadata applyRules(ModuleComponentIdentifier id, String configurationName, VariantMetadataRules variantMetadataRules, ImmutableAttributes attributes, ImmutableCapabilities capabilities, ImmutableList<? extends ModuleComponentArtifactMetadata> artifacts, ImmutableList<ExcludeMetadata> excludes, boolean transitive, boolean visible, ImmutableSet<String> hierarchy, IvyConfigurationHelper configurationHelper, @Nullable List<ModuleDependencyMetadata> dependenciesOverride, boolean addedByRule, boolean isExternalVariant) {
NameOnlyVariantResolveMetadata variant = new NameOnlyVariantResolveMetadata(configurationName);
ImmutableAttributes variantAttributes = variantMetadataRules.applyVariantAttributeRules(variant, attributes);
CapabilitiesMetadata capabilitiesMetadata = variantMetadataRules.applyCapabilitiesRules(variant, capabilities);
ImmutableList<? extends ModuleComponentArtifactMetadata> artifactsMetadata = variantMetadataRules.applyVariantFilesMetadataRulesToArtifacts(variant, artifacts, id);
return createConfiguration(id, configurationName, transitive, visible, hierarchy, artifactsMetadata, excludes, variantAttributes, ImmutableCapabilities.of(capabilitiesMetadata.getCapabilities()), variantMetadataRules, configurationHelper, dependenciesOverride, addedByRule, isExternalVariant);
}
use of org.gradle.api.capabilities.CapabilitiesMetadata in project gradle by gradle.
the class AttributeConfigurationSelector method filterVariantsByRequestedCapabilities.
private static ImmutableList<ConfigurationMetadata> filterVariantsByRequestedCapabilities(ComponentResolveMetadata targetComponent, Collection<? extends Capability> explicitRequestedCapabilities, Collection<? extends ConfigurationMetadata> consumableConfigurations, String group, String name, boolean lenient, AttributeMatchingExplanationBuilder explanationBuilder) {
if (consumableConfigurations.isEmpty()) {
return ImmutableList.of();
}
ImmutableList.Builder<ConfigurationMetadata> builder = ImmutableList.builderWithExpectedSize(consumableConfigurations.size());
boolean explicitlyRequested = !explicitRequestedCapabilities.isEmpty();
for (ConfigurationMetadata configuration : consumableConfigurations) {
CapabilitiesMetadata capabilitiesMetadata = configuration.getCapabilities();
List<? extends Capability> capabilities = capabilitiesMetadata.getCapabilities();
MatchResult result;
if (explicitlyRequested) {
// some capabilities are explicitly required (in other words, we're not _necessarily_ looking for the default capability
// so we need to filter the configurations
result = providesAllCapabilities(targetComponent, explicitRequestedCapabilities, capabilities);
} else {
// we need to make sure the variants we consider provide the implicit capability
result = containsImplicitCapability(capabilitiesMetadata, capabilities, group, name);
}
if (result.matches) {
if (lenient || result == MatchResult.EXACT_MATCH) {
builder.add(configuration);
}
}
}
return builder.build();
}
use of org.gradle.api.capabilities.CapabilitiesMetadata in project gradle by gradle.
the class RealisedMavenModuleResolveMetadata method applyRules.
private static RealisedConfigurationMetadata applyRules(ModuleComponentIdentifier id, String configurationName, VariantMetadataRules variantMetadataRules, ImmutableAttributes attributes, ImmutableCapabilities capabilities, List<? extends ModuleDependencyMetadata> dependencies, ImmutableList<? extends ModuleComponentArtifactMetadata> artifacts, boolean transitive, boolean visible, ImmutableSet<String> hierarchy, boolean addedByRule, boolean isExternalVariant) {
NameOnlyVariantResolveMetadata variant = new NameOnlyVariantResolveMetadata(configurationName);
ImmutableAttributes variantAttributes = variantMetadataRules.applyVariantAttributeRules(variant, attributes);
CapabilitiesMetadata capabilitiesMetadata = variantMetadataRules.applyCapabilitiesRules(variant, capabilities);
List<? extends DependencyMetadata> dependenciesMetadata = variantMetadataRules.applyDependencyMetadataRules(variant, dependencies);
ImmutableList<? extends ModuleComponentArtifactMetadata> artifactsMetadata = variantMetadataRules.applyVariantFilesMetadataRulesToArtifacts(variant, artifacts, id);
return createConfiguration(id, configurationName, transitive, visible, hierarchy, artifactsMetadata, dependenciesMetadata, variantAttributes, ImmutableCapabilities.of(capabilitiesMetadata.getCapabilities()), addedByRule, isExternalVariant);
}
use of org.gradle.api.capabilities.CapabilitiesMetadata in project gradle by gradle.
the class LazyToRealisedModuleComponentResolveMetadataHelper method applyRules.
private static AbstractRealisedModuleComponentResolveMetadata.ImmutableRealisedVariantImpl applyRules(ComponentVariant variant, VariantMetadataRules variantMetadataRules, ModuleComponentIdentifier id) {
ImmutableAttributes attributes = variantMetadataRules.applyVariantAttributeRules(variant, variant.getAttributes());
CapabilitiesMetadata capabilitiesMetadata = variantMetadataRules.applyCapabilitiesRules(variant, variant.getCapabilities());
ImmutableList<? extends ComponentVariant.File> files = variantMetadataRules.applyVariantFilesMetadataRulesToFiles(variant, variant.getFiles(), id);
boolean force = PlatformSupport.hasForcedDependencies(variant);
List<GradleDependencyMetadata> dependencies = variantMetadataRules.applyDependencyMetadataRules(variant, convertDependencies(variant.getDependencies(), variant.getDependencyConstraints(), force));
return new AbstractRealisedModuleComponentResolveMetadata.ImmutableRealisedVariantImpl(id, variant.getName(), attributes, variant.getDependencies(), variant.getDependencyConstraints(), files, ImmutableCapabilities.of(capabilitiesMetadata.getCapabilities()), dependencies, variant.isExternalVariant());
}
Aggregations