use of org.gradle.api.publish.ivy.IvyArtifact in project gradle by gradle.
the class GenerateIvyDescriptor method doGenerate.
@TaskAction
public void doGenerate() {
IvyModuleDescriptorSpecInternal descriptorInternal = toIvyModuleDescriptorInternal(getDescriptor());
IvyDescriptorFileGenerator ivyGenerator = new IvyDescriptorFileGenerator(descriptorInternal.getProjectIdentity());
ivyGenerator.setStatus(descriptorInternal.getStatus());
ivyGenerator.setBranch(descriptorInternal.getBranch());
ivyGenerator.setExtraInfo(descriptorInternal.getExtraInfo().asMap());
for (IvyConfiguration ivyConfiguration : descriptorInternal.getConfigurations()) {
ivyGenerator.addConfiguration(ivyConfiguration);
}
for (IvyArtifact ivyArtifact : descriptorInternal.getArtifacts()) {
ivyGenerator.addArtifact(ivyArtifact);
}
for (IvyDependencyInternal ivyDependency : descriptorInternal.getDependencies()) {
ivyGenerator.addDependency(ivyDependency);
}
ivyGenerator.withXml(descriptorInternal.getXmlAction()).writeTo(getDestination());
}
use of org.gradle.api.publish.ivy.IvyArtifact in project gradle by gradle.
the class DefaultIvyArtifactSet method artifact.
public IvyArtifact artifact(Object source, Action<? super IvyArtifact> config) {
IvyArtifact artifact = artifact(source);
config.execute(artifact);
return artifact;
}
use of org.gradle.api.publish.ivy.IvyArtifact in project gradle by gradle.
the class DefaultIvyArtifactSet method artifact.
public IvyArtifact artifact(Object source) {
IvyArtifact artifact = ivyArtifactParser.parseNotation(source);
add(artifact);
return artifact;
}
use of org.gradle.api.publish.ivy.IvyArtifact in project gradle by gradle.
the class ValidatingIvyPublisher method validateArtifacts.
private void validateArtifacts(IvyNormalizedPublication publication) {
for (final IvyArtifact artifact : publication.getArtifacts()) {
field(publication, "artifact name", artifact.getName()).notEmpty().validInFileName();
field(publication, "artifact type", artifact.getType()).notEmpty().validInFileName();
field(publication, "artifact extension", artifact.getExtension()).notNull().validInFileName();
field(publication, "artifact classifier", artifact.getClassifier()).optionalNotEmpty().validInFileName();
checkCanPublish(publication.getName(), artifact);
}
}
use of org.gradle.api.publish.ivy.IvyArtifact 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);
}
Aggregations