use of org.gradle.api.publish.ivy.IvyModuleDescriptorAuthor in project gradle by gradle.
the class GenerateIvyDescriptor method doGenerate.
@TaskAction
public void doGenerate() {
IvyModuleDescriptorSpecInternal descriptorInternal = toIvyModuleDescriptorInternal(getDescriptor());
IvyDescriptorFileGenerator ivyGenerator = new IvyDescriptorFileGenerator(descriptorInternal.getProjectIdentity(), descriptorInternal.writeGradleMetadataMarker(), descriptorInternal.getVersionMappingStrategy());
ivyGenerator.setStatus(descriptorInternal.getStatus());
ivyGenerator.setBranch(descriptorInternal.getBranch());
ivyGenerator.setExtraInfo(descriptorInternal.getExtraInfo().asMap());
for (IvyModuleDescriptorAuthor ivyAuthor : descriptorInternal.getAuthors()) {
ivyGenerator.addAuthor(ivyAuthor);
}
for (IvyModuleDescriptorLicense ivyLicense : descriptorInternal.getLicenses()) {
ivyGenerator.addLicense(ivyLicense);
}
ivyGenerator.setDescription(descriptorInternal.getDescription());
for (IvyConfiguration ivyConfiguration : descriptorInternal.getConfigurations()) {
ivyGenerator.addConfiguration(ivyConfiguration);
}
for (IvyArtifact ivyArtifact : descriptorInternal.getArtifacts()) {
ivyGenerator.addArtifact(ivyArtifact);
}
for (IvyDependencyInternal ivyDependency : descriptorInternal.getDependencies()) {
ivyGenerator.addDependency(ivyDependency);
}
for (IvyExcludeRule excludeRule : descriptorInternal.getGlobalExcludes()) {
ivyGenerator.addGlobalExclude(excludeRule);
}
ivyGenerator.withXml(descriptorInternal.getXmlAction()).writeTo(getDestination());
}
use of org.gradle.api.publish.ivy.IvyModuleDescriptorAuthor in project gradle by gradle.
the class IvyDescriptorFileGenerator method writeDescriptor.
private void writeDescriptor(final Writer writer) throws IOException {
OptionalAttributeXmlWriter xmlWriter = new OptionalAttributeXmlWriter(writer, " ", IVY_FILE_ENCODING);
xmlWriter.startElement("ivy-module").attribute("version", "2.0");
if (usesClassifier()) {
xmlWriter.attribute("xmlns:m", "http://ant.apache.org/ivy/maven");
}
xmlWriter.startElement("info").attribute("organisation", projectIdentity.getOrganisation()).attribute("module", projectIdentity.getModule()).attribute("branch", branch).attribute("revision", projectIdentity.getRevision()).attribute("status", status).attribute("publication", ivyDateFormat.format(new Date()));
for (IvyModuleDescriptorLicense license : licenses) {
xmlWriter.startElement("license").attribute("name", license.getName().getOrNull()).attribute("url", license.getUrl().getOrNull()).endElement();
}
for (IvyModuleDescriptorAuthor author : authors) {
xmlWriter.startElement("ivyauthor").attribute("name", author.getName().getOrNull()).attribute("url", author.getUrl().getOrNull()).endElement();
}
if (description != null) {
xmlWriter.startElement("description").attribute("homepage", description.getHomepage().getOrNull()).characters(description.getText().getOrElse("")).endElement();
}
if (extraInfo != null) {
for (Map.Entry<QName, String> entry : extraInfo.entrySet()) {
if (entry.getKey() != null) {
xmlWriter.startElement("ns:" + entry.getKey().getLocalPart()).attribute("xmlns:ns", entry.getKey().getNamespaceURI()).characters(entry.getValue()).endElement();
}
}
}
xmlWriter.endElement();
writeConfigurations(xmlWriter);
writePublications(xmlWriter);
writeDependencies(xmlWriter);
xmlWriter.endElement();
}
Aggregations