Search in sources :

Example 1 with DefaultModuleComponentArtifactMetadata

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

the class ExternalResourceResolver method getMetaDataArtifactFor.

private ModuleDescriptorArtifactMetadata getMetaDataArtifactFor(ModuleComponentIdentifier moduleComponentIdentifier) {
    IvyArtifactName ivyArtifactName = getMetaDataArtifactName(moduleComponentIdentifier.getModule());
    DefaultModuleComponentArtifactMetadata defaultModuleComponentArtifactMetadata = new DefaultModuleComponentArtifactMetadata(moduleComponentIdentifier, ivyArtifactName);
    return new DefaultModuleDescriptorArtifactMetadata(defaultModuleComponentArtifactMetadata);
}
Also used : DefaultModuleDescriptorArtifactMetadata(org.gradle.internal.component.model.DefaultModuleDescriptorArtifactMetadata) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) DefaultModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata)

Example 2 with DefaultModuleComponentArtifactMetadata

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

the class IvyConfigurationHelper method collectArtifactsFor.

private void collectArtifactsFor(String name, Collection<ModuleComponentArtifactMetadata> dest) {
    for (Artifact artifact : artifactDefinitions) {
        if (artifact.getConfigurations().contains(name)) {
            ModuleComponentArtifactMetadata artifactMetadata = artifacts.get(artifact);
            if (artifactMetadata == null) {
                artifactMetadata = new DefaultModuleComponentArtifactMetadata(componentId, artifact.getArtifactName());
                artifacts.put(artifact, artifactMetadata);
            }
            dest.add(artifactMetadata);
        }
    }
}
Also used : DefaultModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata) ModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata) DefaultModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata) Artifact(org.gradle.internal.component.external.descriptor.Artifact)

Example 3 with DefaultModuleComponentArtifactMetadata

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

the class RealisedMavenModuleResolveMetadata method getArtifactsForConfiguration.

static ImmutableList<? extends ModuleComponentArtifactMetadata> getArtifactsForConfiguration(DefaultMavenModuleResolveMetadata metadata) {
    ImmutableList<? extends ModuleComponentArtifactMetadata> artifacts;
    if (metadata.isRelocated()) {
        // relocated packages have no artifacts
        artifacts = ImmutableList.of();
    } else if (metadata.isPomPackaging()) {
        // Modules with POM packaging _may_ have a jar
        artifacts = ImmutableList.of(metadata.optionalArtifact("jar", "jar", null));
    } else if (metadata.isKnownJarPackaging()) {
        // Modules with a type of packaging that's always a jar
        artifacts = ImmutableList.of(metadata.artifact("jar", "jar", null));
    } else {
        // Modules with other types of packaging may publish an artifact with that extension or a jar
        String type = metadata.getPackaging();
        artifacts = ImmutableList.of(new DefaultModuleComponentArtifactMetadata(metadata.getId(), new DefaultIvyArtifactName(metadata.getId().getModule(), type, type), metadata.artifact("jar", "jar", null)));
    }
    return artifacts;
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) DefaultModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata)

Example 4 with DefaultModuleComponentArtifactMetadata

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

the class DependencyResolverIvyPublisher method publish.

@Override
public void publish(IvyNormalizedPublication publication, IvyArtifactRepository repository) {
    IvyResolver publisher = ((DefaultIvyArtifactRepository) repository).createPublisher();
    IvyPublicationIdentity projectIdentity = publication.getProjectIdentity();
    ModuleComponentIdentifier moduleVersionIdentifier = DefaultModuleComponentIdentifier.newId(DefaultModuleIdentifier.newId(projectIdentity.getOrganisation(), projectIdentity.getModule()), projectIdentity.getRevision());
    for (IvyArtifact artifact : publication.getAllArtifacts()) {
        ModuleComponentArtifactMetadata artifactMetadata = new DefaultModuleComponentArtifactMetadata(moduleVersionIdentifier, createIvyArtifact(artifact));
        publish(publisher, artifact, artifactMetadata);
    }
}
Also used : DefaultIvyArtifactRepository(org.gradle.api.internal.artifacts.repositories.DefaultIvyArtifactRepository) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) DefaultModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata) IvyResolver(org.gradle.api.internal.artifacts.repositories.resolver.IvyResolver) ModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata) DefaultModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata) IvyArtifact(org.gradle.api.publish.ivy.IvyArtifact)

Example 5 with DefaultModuleComponentArtifactMetadata

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

the class ComponentArtifactMetadataSerializer method read.

@Override
public ComponentArtifactMetadata 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 DefaultModuleComponentArtifactMetadata(componentIdentifier, new DefaultIvyArtifactName(artifactName, type, extension, classifier));
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) DefaultModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata)

Aggregations

DefaultModuleComponentArtifactMetadata (org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata)6 DefaultIvyArtifactName (org.gradle.internal.component.model.DefaultIvyArtifactName)4 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)2 ModuleComponentArtifactMetadata (org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata)2 DefaultIvyArtifactRepository (org.gradle.api.internal.artifacts.repositories.DefaultIvyArtifactRepository)1 IvyResolver (org.gradle.api.internal.artifacts.repositories.resolver.IvyResolver)1 IvyArtifact (org.gradle.api.publish.ivy.IvyArtifact)1 Artifact (org.gradle.internal.component.external.descriptor.Artifact)1 DefaultModuleComponentIdentifier (org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier)1 MutableModuleComponentResolveMetadata (org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata)1 DefaultModuleDescriptorArtifactMetadata (org.gradle.internal.component.model.DefaultModuleDescriptorArtifactMetadata)1 IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)1 LocallyAvailableExternalResource (org.gradle.internal.resource.local.LocallyAvailableExternalResource)1