Search in sources :

Example 1 with DefaultModuleComponentArtifactIdentifier

use of org.gradle.internal.component.external.model.DefaultModuleComponentArtifactIdentifier in project gradle by gradle.

the class ComponentArtifactIdentifierSerializer method write.

public void write(Encoder encoder, ComponentArtifactIdentifier value) throws Exception {
    if (value instanceof DefaultModuleComponentArtifactIdentifier) {
        DefaultModuleComponentArtifactIdentifier moduleComponentArtifactIdentifier = (DefaultModuleComponentArtifactIdentifier) value;
        componentIdentifierSerializer.write(encoder, moduleComponentArtifactIdentifier.getComponentIdentifier());
        IvyArtifactName ivyArtifactName = moduleComponentArtifactIdentifier.getName();
        encoder.writeString(ivyArtifactName.getName());
        encoder.writeString(ivyArtifactName.getType());
        encoder.writeNullableString(ivyArtifactName.getExtension());
        encoder.writeNullableString(ivyArtifactName.getClassifier());
    } else {
        throw new IllegalArgumentException("Unknown identifier type.");
    }
}
Also used : DefaultModuleComponentArtifactIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactIdentifier) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName)

Example 2 with DefaultModuleComponentArtifactIdentifier

use of org.gradle.internal.component.external.model.DefaultModuleComponentArtifactIdentifier in project gradle by gradle.

the class ComponentArtifactIdentifierSerializer method read.

public ComponentArtifactIdentifier read(Decoder decoder) throws Exception {
    ModuleComponentIdentifier componentIdentifier = (ModuleComponentIdentifier) componentIdentifierSerializer.read(decoder);
    String artifactName = decoder.readString();
    String type = decoder.readString();
    String extension = decoder.readNullableString();
    String classifier = decoder.readNullableString();
    return new DefaultModuleComponentArtifactIdentifier(componentIdentifier, artifactName, type, extension, classifier);
}
Also used : DefaultModuleComponentArtifactIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactIdentifier) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier)

Aggregations

DefaultModuleComponentArtifactIdentifier (org.gradle.internal.component.external.model.DefaultModuleComponentArtifactIdentifier)2 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)1