Search in sources :

Example 6 with CoercingStringValueSnapshot

use of org.gradle.internal.snapshot.impl.CoercingStringValueSnapshot in project gradle by gradle.

the class DefaultMavenImmutableAttributesFactory method libraryWithUsage.

@Override
public ImmutableAttributes libraryWithUsage(ImmutableAttributes original, String usage) {
    ComponentTypeEntry entry = new ComponentTypeEntry(original, Category.LIBRARY, usage);
    ImmutableAttributes result = concatCache.get(entry);
    if (result == null) {
        result = concat(original, USAGE_ATTRIBUTE, new CoercingStringValueSnapshot(usage, objectInstantiator));
        result = concat(result, FORMAT_ATTRIBUTE, new CoercingStringValueSnapshot(LibraryElements.JAR, objectInstantiator));
        result = concat(result, CATEGORY_ATTRIBUTE, new CoercingStringValueSnapshot(Category.LIBRARY, objectInstantiator));
        concatCache.put(entry, result);
    }
    return result;
}
Also used : ImmutableAttributes(org.gradle.api.internal.attributes.ImmutableAttributes) CoercingStringValueSnapshot(org.gradle.internal.snapshot.impl.CoercingStringValueSnapshot)

Example 7 with CoercingStringValueSnapshot

use of org.gradle.internal.snapshot.impl.CoercingStringValueSnapshot in project gradle by gradle.

the class DefaultMavenImmutableAttributesFactory method sourcesVariant.

@Override
public ImmutableAttributes sourcesVariant(ImmutableAttributes original) {
    ImmutableAttributes result = original;
    result = concat(result, CATEGORY_ATTRIBUTE, new CoercingStringValueSnapshot(Category.DOCUMENTATION, objectInstantiator));
    result = concat(result, Bundling.BUNDLING_ATTRIBUTE, objectInstantiator.named(Bundling.class, Bundling.EXTERNAL));
    result = concat(result, DocsType.DOCS_TYPE_ATTRIBUTE, objectInstantiator.named(DocsType.class, DocsType.SOURCES));
    result = concat(result, USAGE_ATTRIBUTE, new CoercingStringValueSnapshot(Usage.JAVA_RUNTIME, objectInstantiator));
    return result;
}
Also used : ImmutableAttributes(org.gradle.api.internal.attributes.ImmutableAttributes) CoercingStringValueSnapshot(org.gradle.internal.snapshot.impl.CoercingStringValueSnapshot)

Example 8 with CoercingStringValueSnapshot

use of org.gradle.internal.snapshot.impl.CoercingStringValueSnapshot in project gradle by gradle.

the class DefaultMavenImmutableAttributesFactory method javadocVariant.

@Override
public ImmutableAttributes javadocVariant(ImmutableAttributes original) {
    ImmutableAttributes result = original;
    result = concat(result, CATEGORY_ATTRIBUTE, new CoercingStringValueSnapshot(Category.DOCUMENTATION, objectInstantiator));
    result = concat(result, Bundling.BUNDLING_ATTRIBUTE, objectInstantiator.named(Bundling.class, Bundling.EXTERNAL));
    result = concat(result, DocsType.DOCS_TYPE_ATTRIBUTE, objectInstantiator.named(DocsType.class, DocsType.JAVADOC));
    result = concat(result, USAGE_ATTRIBUTE, new CoercingStringValueSnapshot(Usage.JAVA_RUNTIME, objectInstantiator));
    return result;
}
Also used : ImmutableAttributes(org.gradle.api.internal.attributes.ImmutableAttributes) CoercingStringValueSnapshot(org.gradle.internal.snapshot.impl.CoercingStringValueSnapshot)

Example 9 with CoercingStringValueSnapshot

use of org.gradle.internal.snapshot.impl.CoercingStringValueSnapshot in project gradle by gradle.

the class DesugaringAttributeContainerSerializer method read.

@Override
public ImmutableAttributes read(Decoder decoder) throws IOException {
    ImmutableAttributes attributes = ImmutableAttributes.EMPTY;
    int count = decoder.readSmallInt();
    for (int i = 0; i < count; i++) {
        String name = decoder.readString();
        byte type = decoder.readByte();
        if (type == BOOLEAN_ATTRIBUTE) {
            attributes = attributesFactory.concat(attributes, Attribute.of(name, Boolean.class), decoder.readBoolean());
        } else if (type == STRING_ATTRIBUTE) {
            String value = decoder.readString();
            attributes = attributesFactory.concat(attributes, Attribute.of(name, String.class), value);
        } else if (type == INTEGER_ATTRIBUTE) {
            int value = decoder.readInt();
            attributes = attributesFactory.concat(attributes, Attribute.of(name, Integer.class), value);
        } else if (type == DESUGARED_ATTRIBUTE) {
            String value = decoder.readString();
            attributes = attributesFactory.concat(attributes, Attribute.of(name, String.class), new CoercingStringValueSnapshot(value, namedObjectInstantiator));
        }
    }
    return attributes;
}
Also used : ImmutableAttributes(org.gradle.api.internal.attributes.ImmutableAttributes) CoercingStringValueSnapshot(org.gradle.internal.snapshot.impl.CoercingStringValueSnapshot)

Aggregations

ImmutableAttributes (org.gradle.api.internal.attributes.ImmutableAttributes)9 CoercingStringValueSnapshot (org.gradle.internal.snapshot.impl.CoercingStringValueSnapshot)9 MutableComponentVariant (org.gradle.internal.component.external.model.MutableComponentVariant)2 Capability (org.gradle.api.capabilities.Capability)1 DefaultShadowedCapability (org.gradle.internal.component.external.model.DefaultShadowedCapability)1 ImmutableCapability (org.gradle.internal.component.external.model.ImmutableCapability)1