Search in sources :

Example 41 with IvyArtifactName

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

the class AbstractIvyDependencyDescriptorFactory method convertArtifacts.

protected List<IvyArtifactName> convertArtifacts(Set<DependencyArtifact> dependencyArtifacts) {
    if (dependencyArtifacts.isEmpty()) {
        return Collections.emptyList();
    }
    ImmutableList.Builder<IvyArtifactName> names = ImmutableList.builder();
    for (DependencyArtifact dependencyArtifact : dependencyArtifacts) {
        DefaultIvyArtifactName name = new DefaultIvyArtifactName(dependencyArtifact.getName(), dependencyArtifact.getType(), getExtension(dependencyArtifact), dependencyArtifact.getClassifier());
        names.add(name);
    }
    return names.build();
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) DependencyArtifact(org.gradle.api.artifacts.DependencyArtifact) ImmutableList(com.google.common.collect.ImmutableList) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName)

Example 42 with IvyArtifactName

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

the class ComponentArtifactIdentifierSerializer method write.

@Override
public void write(Encoder encoder, DefaultModuleComponentArtifactIdentifier value) throws Exception {
    componentIdentifierSerializer.write(encoder, value.getComponentIdentifier());
    IvyArtifactName ivyArtifactName = value.getName();
    encoder.writeString(ivyArtifactName.getName());
    encoder.writeString(ivyArtifactName.getType());
    encoder.writeNullableString(ivyArtifactName.getExtension());
    encoder.writeNullableString(ivyArtifactName.getClassifier());
}
Also used : IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName)

Example 43 with IvyArtifactName

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

the class MavenLocalPomMetadataSource method listModuleVersions.

@Override
public void listModuleVersions(ModuleDependencyMetadata dependency, ModuleIdentifier module, List<ResourcePattern> ivyPatterns, List<ResourcePattern> artifactPatterns, VersionLister versionLister, BuildableModuleVersionListingResolveResult result) {
    IvyArtifactName dependencyArtifact = getPrimaryDependencyArtifact(dependency);
    versionLister.listVersions(module, dependencyArtifact, artifactPatterns, result);
}
Also used : IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName)

Example 44 with IvyArtifactName

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

the class AbstractResourcePattern method isComplete.

@Override
public boolean isComplete(ModuleComponentArtifactMetadata artifactIdentifier) {
    IvyArtifactName artifactName = artifactIdentifier.getName();
    ModuleComponentIdentifier componentIdentifier = artifactIdentifier.getId().getComponentIdentifier();
    return isValidSubstitute(componentIdentifier.getModule(), false) && isValidSubstitute(componentIdentifier.getGroup(), organisationIsOptional) && isValidSubstitute(componentIdentifier.getVersion(), revisionIsOptional) && isValidSubstitute(artifactName.getName(), artifactIsOptional) && isValidSubstitute(artifactName.getClassifier(), classifierIsOptional) && isValidSubstitute(artifactName.getExtension(), extensionIsOptional) && isValidSubstitute(artifactName.getType(), typeIsOptional);
}
Also used : IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier)

Example 45 with IvyArtifactName

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

the class DefaultArtifactPublisher method publish.

@Override
public void publish(final Iterable<? extends PublicationAwareRepository> repositories, final Module module, final Configuration configuration, final File descriptor) throws PublishException {
    Set<ConfigurationInternal> allConfigurations = Cast.uncheckedCast(configuration.getAll());
    Set<ConfigurationInternal> configurationsToPublish = Cast.uncheckedCast(configuration.getHierarchy());
    // Will create `ivy.xml` even for Maven publishing! (as long as `Upload.uploadDescriptor == true`)
    if (descriptor != null) {
        // Convert once, in order to write the Ivy descriptor with _all_ configurations
        DefaultIvyModulePublishMetadata publishMetaData = toPublishMetaData(module, allConfigurations, false);
        ivyModuleDescriptorWriter.write(publishMetaData, descriptor);
    }
    // Convert a second time with only the published configurations: this ensures that the correct artifacts are included
    DefaultIvyModulePublishMetadata publishMetaData = toPublishMetaData(module, configurationsToPublish, true);
    if (descriptor != null) {
        IvyArtifactName artifact = new DefaultIvyArtifactName("ivy", "ivy", "xml");
        publishMetaData.addArtifact(artifact, descriptor);
    }
    for (PublicationAwareRepository repository : repositories) {
        ModuleVersionPublisher publisher = repository.createPublisher();
        LOGGER.info("Publishing to {}", publisher);
        publisher.publish(publishMetaData);
    }
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) PublicationAwareRepository(org.gradle.api.internal.artifacts.repositories.PublicationAwareRepository) ConfigurationInternal(org.gradle.api.internal.artifacts.configurations.ConfigurationInternal) ModuleVersionPublisher(org.gradle.api.internal.artifacts.ModuleVersionPublisher)

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