use of org.gradle.api.internal.artifacts.ModuleVersionPublisher in project gradle by gradle.
the class DefaultIvyDependencyPublisher method publish.
public void publish(List<ModuleVersionPublisher> publishResolvers, IvyModulePublishMetadata publishMetaData) {
try {
// Make a copy of the publication and filter missing artifacts
DefaultIvyModulePublishMetadata publication = new DefaultIvyModulePublishMetadata(publishMetaData.getId(), publishMetaData.getModuleDescriptor());
for (IvyModuleArtifactPublishMetadata artifact : publishMetaData.getArtifacts()) {
addPublishedArtifact(artifact, publication);
}
for (ModuleVersionPublisher publisher : publishResolvers) {
LOGGER.info("Publishing to {}", publisher);
publisher.publish(publication);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of org.gradle.api.internal.artifacts.ModuleVersionPublisher in project gradle by gradle.
the class DependencyResolverIvyPublisher method publish.
public void publish(IvyNormalizedPublication publication, PublicationAwareRepository repository) {
ModuleVersionPublisher publisher = repository.createPublisher();
IvyPublicationIdentity projectIdentity = publication.getProjectIdentity();
ModuleComponentIdentifier moduleVersionIdentifier = DefaultModuleComponentIdentifier.newId(projectIdentity.getOrganisation(), projectIdentity.getModule(), projectIdentity.getRevision());
// Use the legacy metadata type so that we can leverage `ModuleVersionPublisher.publish()`
DefaultIvyModulePublishMetadata publishMetaData = new DefaultIvyModulePublishMetadata(moduleVersionIdentifier, "");
for (IvyArtifact publishArtifact : publication.getArtifacts()) {
publishMetaData.addArtifact(createIvyArtifact(publishArtifact), publishArtifact.getFile());
}
IvyArtifactName ivyDescriptor = new DefaultIvyArtifactName("ivy", "ivy", "xml");
publishMetaData.addArtifact(ivyDescriptor, publication.getIvyDescriptorFile());
File gradleModuleDescriptorFile = publication.getGradleModuleDescriptorFile();
if (gradleModuleDescriptorFile != null && gradleModuleDescriptorFile.exists()) {
// may not exist if experimental features are disabled
IvyArtifactName gradleDescriptor = new DefaultIvyArtifactName(projectIdentity.getModule(), "json", "module");
publishMetaData.addArtifact(gradleDescriptor, gradleModuleDescriptorFile);
}
publisher.publish(publishMetaData);
}
use of org.gradle.api.internal.artifacts.ModuleVersionPublisher 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);
}
use of org.gradle.api.internal.artifacts.ModuleVersionPublisher 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);
}
}
Aggregations