use of org.gradle.api.attributes.AttributeContainer in project MyLuaApp-Build-Core by dingyi222666.
the class AttributeDesugaring method desugarSelector.
public ComponentSelector desugarSelector(ComponentSelector selector) {
if (selector instanceof ModuleComponentSelector) {
ModuleComponentSelector module = (ModuleComponentSelector) selector;
AttributeContainer moduleAttributes = module.getAttributes();
if (!moduleAttributes.isEmpty()) {
ImmutableAttributes attributes = ((AttributeContainerInternal) moduleAttributes).asImmutable();
return DefaultModuleComponentSelector.newSelector(module.getModuleIdentifier(), module.getVersionConstraint(), desugar(attributes), module.getRequestedCapabilities());
}
}
if (selector instanceof DefaultProjectComponentSelector) {
DefaultProjectComponentSelector project = (DefaultProjectComponentSelector) selector;
AttributeContainer projectAttributes = project.getAttributes();
if (!projectAttributes.isEmpty()) {
ImmutableAttributes attributes = ((AttributeContainerInternal) projectAttributes).asImmutable();
return new DefaultProjectComponentSelector(project.getBuildIdentifier(), project.getIdentityPath(), project.projectPath(), project.getProjectName(), desugar(attributes), project.getRequestedCapabilities());
}
}
return selector;
}
use of org.gradle.api.attributes.AttributeContainer in project gradle by gradle.
the class ResolvedVariantResultSerializer method read.
@Override
public ResolvedVariantResult read(Decoder decoder) throws IOException {
int index = decoder.readSmallInt();
if (index == -1) {
return null;
}
if (index == read.size()) {
ComponentIdentifier owner = componentIdentifierSerializer.read(decoder);
String variantName = decoder.readString();
AttributeContainer attributes = attributeContainerSerializer.read(decoder);
List<Capability> capabilities = readCapabilities(decoder);
read.add(null);
ResolvedVariantResult externalVariant = read(decoder);
DefaultResolvedVariantResult result = new DefaultResolvedVariantResult(owner, Describables.of(variantName), attributes, capabilities, externalVariant);
this.read.set(index, result);
return result;
}
return read.get(index);
}
use of org.gradle.api.attributes.AttributeContainer in project gradle by gradle.
the class ComponentMetadataDetailsAdapter method attributes.
@Override
public ComponentMetadataDetails attributes(Action<? super AttributeContainer> action) {
AttributeContainer attributes = metadata.getAttributesFactory().mutable((AttributeContainerInternal) metadata.getAttributes());
action.execute(attributes);
metadata.setAttributes(attributes);
return this;
}
use of org.gradle.api.attributes.AttributeContainer in project gradle by gradle.
the class ConsumerProvidedVariantFinder method matchAttributes.
private boolean matchAttributes(AttributeContainerInternal actual, AttributeContainerInternal requested) {
AttributeMatcher schemaToMatchOn = schema.matcher();
Map<AttributeContainer, Boolean> cache = getCache(requested).ignoreExtraActual;
Boolean match = cache.get(actual);
if (match == null) {
match = schemaToMatchOn.isMatching(actual, requested);
cache.put(actual, match);
}
return match;
}
use of org.gradle.api.attributes.AttributeContainer in project gradle by gradle.
the class DefaultScriptHandler method defineConfiguration.
private void defineConfiguration() {
// Defer creation and resolution of configuration until required. Short-circuit when script does not require classpath
if (configContainer == null) {
configContainer = dependencyResolutionServices.getConfigurationContainer();
}
if (dependencyHandler == null) {
dependencyHandler = dependencyResolutionServices.getDependencyHandler();
}
if (classpathConfiguration == null) {
classpathConfiguration = configContainer.create(CLASSPATH_CONFIGURATION);
// should ideally reuse the `JvmEcosystemUtilities` but this code is too low level
// and this service is therefore not available!
AttributeContainer attributes = classpathConfiguration.getAttributes();
attributes.attribute(Usage.USAGE_ATTRIBUTE, instantiator.named(Usage.class, Usage.JAVA_RUNTIME));
attributes.attribute(Category.CATEGORY_ATTRIBUTE, instantiator.named(Category.class, Category.LIBRARY));
attributes.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, instantiator.named(LibraryElements.class, LibraryElements.JAR));
attributes.attribute(Bundling.BUNDLING_ATTRIBUTE, instantiator.named(Bundling.class, Bundling.EXTERNAL));
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, Integer.parseInt(JavaVersion.current().getMajorVersion()));
attributes.attribute(GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, instantiator.named(GradlePluginApiVersion.class, GradleVersion.current().getVersion()));
classpathConfiguration.getDependencyConstraints().add(dependencyHandler.getConstraints().create(Log4jBannedVersion.LOG4J2_CORE_COORDINATES, constraint -> constraint.version(version -> {
version.require(Log4jBannedVersion.LOG4J2_CORE_REQUIRED_VERSION);
version.reject(Log4jBannedVersion.LOG4J2_CORE_VULNERABLE_VERSION_RANGE);
})));
}
}
Aggregations