Search in sources :

Example 1 with IvyModulePublishMetadata

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

the class IvyBackedArtifactPublisher method publish.

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());
    if (descriptor != null) {
        // Convert once, in order to write the Ivy descriptor with _all_ configurations
        IvyModulePublishMetadata publishMetaData = toPublishMetaData(module, allConfigurations);
        validatePublishMetaData(publishMetaData);
        ivyModuleDescriptorWriter.write(publishMetaData, descriptor);
    }
    // Convert a second time with only the published configurations: this ensures that the correct artifacts are included
    BuildableIvyModulePublishMetadata publishMetaData = toPublishMetaData(module, configurationsToPublish);
    if (descriptor != null) {
        IvyArtifactName artifact = new DefaultIvyArtifactName("ivy", "ivy", "xml");
        publishMetaData.addArtifact(artifact, descriptor);
    }
    List<ModuleVersionPublisher> publishResolvers = new ArrayList<ModuleVersionPublisher>();
    for (PublicationAwareRepository repository : repositories) {
        ModuleVersionPublisher publisher = repository.createPublisher();
        publishResolvers.add(publisher);
    }
    dependencyPublisher.publish(publishResolvers, publishMetaData);
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) ArrayList(java.util.ArrayList) BuildableIvyModulePublishMetadata(org.gradle.internal.component.external.model.BuildableIvyModulePublishMetadata) PublicationAwareRepository(org.gradle.api.internal.artifacts.repositories.PublicationAwareRepository) IvyModulePublishMetadata(org.gradle.internal.component.external.model.IvyModulePublishMetadata) BuildableIvyModulePublishMetadata(org.gradle.internal.component.external.model.BuildableIvyModulePublishMetadata) DefaultIvyModulePublishMetadata(org.gradle.internal.component.external.model.DefaultIvyModulePublishMetadata) ConfigurationInternal(org.gradle.api.internal.artifacts.configurations.ConfigurationInternal) ModuleVersionPublisher(org.gradle.api.internal.artifacts.ModuleVersionPublisher)

Aggregations

ArrayList (java.util.ArrayList)1 ModuleVersionPublisher (org.gradle.api.internal.artifacts.ModuleVersionPublisher)1 ConfigurationInternal (org.gradle.api.internal.artifacts.configurations.ConfigurationInternal)1 PublicationAwareRepository (org.gradle.api.internal.artifacts.repositories.PublicationAwareRepository)1 BuildableIvyModulePublishMetadata (org.gradle.internal.component.external.model.BuildableIvyModulePublishMetadata)1 DefaultIvyModulePublishMetadata (org.gradle.internal.component.external.model.DefaultIvyModulePublishMetadata)1 IvyModulePublishMetadata (org.gradle.internal.component.external.model.IvyModulePublishMetadata)1 DefaultIvyArtifactName (org.gradle.internal.component.model.DefaultIvyArtifactName)1 IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)1