Search in sources :

Example 16 with IvyArtifactName

use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.

the class AbstractMavenResolver method publish.

public void publish(IvyModulePublishMetadata moduleVersion) {
    for (IvyModuleArtifactPublishMetadata artifactMetadata : moduleVersion.getArtifacts()) {
        IvyArtifactName artifact = artifactMetadata.getArtifactName();
        ModuleRevisionId moduleRevisionId = IvyUtil.createModuleRevisionId(artifactMetadata.getId().getComponentIdentifier());
        Map<String, String> attributes = Collections.singletonMap("classifier", artifact.getClassifier());
        Artifact ivyArtifact = new DefaultArtifact(moduleRevisionId, null, artifact.getName(), artifact.getType(), artifact.getExtension(), attributes);
        collectArtifact(ivyArtifact, artifactMetadata.getFile());
    }
    publish();
}
Also used : IvyModuleArtifactPublishMetadata(org.gradle.internal.component.external.ivypublish.IvyModuleArtifactPublishMetadata) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) PublishArtifact(org.gradle.api.artifacts.PublishArtifact) Artifact(org.apache.ivy.core.module.descriptor.Artifact) DefaultArtifact(org.apache.ivy.core.module.descriptor.DefaultArtifact) DefaultArtifact(org.apache.ivy.core.module.descriptor.DefaultArtifact)

Example 17 with IvyArtifactName

use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.

the class AbstractRealisedModuleResolveMetadataSerializationHelper method readExcludeRule.

protected DefaultExclude readExcludeRule(Decoder decoder) throws IOException {
    String moduleOrg = decoder.readString();
    String moduleName = decoder.readString();
    IvyArtifactName artifactName = readNullableArtifact(decoder);
    String[] confs = readStringSet(decoder).toArray(new String[0]);
    String matcher = decoder.readNullableString();
    return new DefaultExclude(moduleIdentifierFactory.module(moduleOrg, moduleName), artifactName, confs, matcher);
}
Also used : DefaultExclude(org.gradle.internal.component.external.descriptor.DefaultExclude) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName)

Example 18 with IvyArtifactName

use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.

the class AbstractRealisedModuleResolveMetadataSerializationHelper method readNullableArtifact.

@Nullable
protected IvyArtifactName readNullableArtifact(Decoder decoder) throws IOException {
    boolean hasArtifact = decoder.readBoolean();
    IvyArtifactName artifactName = null;
    if (hasArtifact) {
        String artifact = decoder.readString();
        String type = decoder.readString();
        String ext = decoder.readNullableString();
        String classifier = decoder.readNullableString();
        artifactName = new DefaultIvyArtifactName(artifact, type, ext, classifier);
    }
    return artifactName;
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) Nullable(javax.annotation.Nullable)

Example 19 with IvyArtifactName

use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.

the class DefaultIvyModuleDescriptorWriter method printPublications.

private static void printPublications(Collection<IvyModuleArtifactPublishMetadata> artifacts, SimpleXmlWriter writer) throws IOException {
    writer.startElement("publications");
    for (IvyModuleArtifactPublishMetadata artifactMetadata : artifacts) {
        IvyArtifactName artifact = artifactMetadata.getArtifactName();
        writer.startElement("artifact");
        writer.attribute("name", artifact.getName());
        writer.attribute("type", artifact.getType());
        writer.attribute("ext", artifact.getExtension() == null ? "" : artifact.getExtension());
        writer.attribute("conf", Joiner.on(",").join(artifactMetadata.getConfigurations()));
        if (artifact.getClassifier() != null) {
            printExtraAttributes(Collections.singletonMap("m:classifier", artifact.getClassifier()), writer);
        }
        writer.endElement();
    }
    writer.endElement();
}
Also used : IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName)

Example 20 with IvyArtifactName

use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.

the class DefaultIvyModuleDescriptorWriter method printAllExcludes.

private static void printAllExcludes(IvyModulePublishMetadata metadata, SimpleXmlWriter writer) throws IOException {
    for (Pair<ExcludeMetadata, String> excludePair : metadata.getExcludes()) {
        ExcludeMetadata exclude = excludePair.getLeft();
        writer.startElement("exclude");
        writer.attribute("org", exclude.getModuleId().getGroup());
        writer.attribute("module", exclude.getModuleId().getName());
        IvyArtifactName artifact = exclude.getArtifact();
        if (artifact != null) {
            writer.attribute("artifact", artifact.getName());
            writer.attribute("type", artifact.getType());
            writer.attribute("ext", artifact.getExtension());
        }
        writer.attribute("conf", excludePair.getRight());
        writer.endElement();
    }
}
Also used : IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) ExcludeMetadata(org.gradle.internal.component.model.ExcludeMetadata)

Aggregations

IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)52 DefaultIvyArtifactName (org.gradle.internal.component.model.DefaultIvyArtifactName)28 DefaultExclude (org.gradle.internal.component.external.descriptor.DefaultExclude)7 ExcludeMetadata (org.gradle.internal.component.model.ExcludeMetadata)7 File (java.io.File)6 Artifact (org.gradle.internal.component.external.descriptor.Artifact)6 ModuleIdentifier (org.gradle.api.artifacts.ModuleIdentifier)5 ComponentArtifactIdentifier (org.gradle.api.artifacts.component.ComponentArtifactIdentifier)5 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)5 ImmutableList (com.google.common.collect.ImmutableList)4 DefaultImmutableVersionConstraint (org.gradle.api.internal.artifacts.dependencies.DefaultImmutableVersionConstraint)4 ComponentArtifactMetadata (org.gradle.internal.component.model.ComponentArtifactMetadata)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 List (java.util.List)3 Map (java.util.Map)3 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)3 ModuleVersionSelector (org.gradle.api.artifacts.ModuleVersionSelector)3 DefaultResolvedArtifact (org.gradle.api.internal.artifacts.DefaultResolvedArtifact)3 ImmutableAttributes (org.gradle.api.internal.attributes.ImmutableAttributes)3 MavenScope (org.gradle.internal.component.external.descriptor.MavenScope)3