Search in sources :

Example 1 with IvyArtifact

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());
}
Also used : IvyDescriptorFileGenerator(org.gradle.api.publish.ivy.internal.publisher.IvyDescriptorFileGenerator) IvyDependencyInternal(org.gradle.api.publish.ivy.internal.dependency.IvyDependencyInternal) IvyModuleDescriptorSpecInternal(org.gradle.api.publish.ivy.internal.publication.IvyModuleDescriptorSpecInternal) IvyConfiguration(org.gradle.api.publish.ivy.IvyConfiguration) IvyArtifact(org.gradle.api.publish.ivy.IvyArtifact) TaskAction(org.gradle.api.tasks.TaskAction)

Example 2 with IvyArtifact

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;
}
Also used : IvyArtifact(org.gradle.api.publish.ivy.IvyArtifact)

Example 3 with IvyArtifact

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;
}
Also used : IvyArtifact(org.gradle.api.publish.ivy.IvyArtifact)

Example 4 with IvyArtifact

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);
    }
}
Also used : IvyArtifact(org.gradle.api.publish.ivy.IvyArtifact)

Example 5 with IvyArtifact

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);
}
Also used : DefaultIvyModulePublishMetadata(org.gradle.internal.component.external.ivypublish.DefaultIvyModulePublishMetadata) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifact(org.gradle.api.publish.ivy.IvyArtifact) File(java.io.File) ModuleVersionPublisher(org.gradle.api.internal.artifacts.ModuleVersionPublisher)

Aggregations

IvyArtifact (org.gradle.api.publish.ivy.IvyArtifact)8 File (java.io.File)2 HashSet (java.util.HashSet)1 QName (javax.xml.namespace.QName)1 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 ModuleVersionPublisher (org.gradle.api.internal.artifacts.ModuleVersionPublisher)1 IvyArtifactSet (org.gradle.api.publish.ivy.IvyArtifactSet)1 IvyConfiguration (org.gradle.api.publish.ivy.IvyConfiguration)1 IvyPublication (org.gradle.api.publish.ivy.IvyPublication)1 IvyDependencyInternal (org.gradle.api.publish.ivy.internal.dependency.IvyDependencyInternal)1 IvyModuleDescriptorSpecInternal (org.gradle.api.publish.ivy.internal.publication.IvyModuleDescriptorSpecInternal)1 IvyPublicationInternal (org.gradle.api.publish.ivy.internal.publication.IvyPublicationInternal)1 IvyDescriptorFileGenerator (org.gradle.api.publish.ivy.internal.publisher.IvyDescriptorFileGenerator)1 IvyNormalizedPublication (org.gradle.api.publish.ivy.internal.publisher.IvyNormalizedPublication)1 IvyPublicationIdentity (org.gradle.api.publish.ivy.internal.publisher.IvyPublicationIdentity)1 MavenArtifact (org.gradle.api.publish.maven.MavenArtifact)1 MavenArtifactSet (org.gradle.api.publish.maven.MavenArtifactSet)1 MavenPublication (org.gradle.api.publish.maven.MavenPublication)1 MavenPublicationInternal (org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal)1 MavenNormalizedPublication (org.gradle.api.publish.maven.internal.publisher.MavenNormalizedPublication)1