use of org.gradle.internal.component.external.model.BuildableIvyModulePublishMetadata 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);
}
Aggregations