Search in sources :

Example 1 with ArtifactPublisher

use of org.gradle.api.internal.artifacts.ArtifactPublisher in project gradle by gradle.

the class Upload method upload.

@TaskAction
protected void upload() {
    getLogger().info("Publishing configuration: " + configuration);
    Module module = ((ConfigurationInternal) configuration).getModule();
    ArtifactPublisher artifactPublisher = getPublicationServices().createArtifactPublisher();
    File descriptorDestination = isUploadDescriptor() ? getDescriptorDestination() : null;
    List<PublicationAwareRepository> publishRepositories = collect(getRepositories(), Transformers.cast(PublicationAwareRepository.class));
    try {
        artifactPublisher.publish(publishRepositories, module, configuration, descriptorDestination);
    } catch (Exception e) {
        throw new PublishException(String.format("Could not publish configuration '%s'", configuration.getName()), e);
    }
}
Also used : ArtifactPublisher(org.gradle.api.internal.artifacts.ArtifactPublisher) PublicationAwareRepository(org.gradle.api.internal.artifacts.repositories.PublicationAwareRepository) PublishException(org.gradle.api.artifacts.PublishException) Module(org.gradle.api.internal.artifacts.Module) File(java.io.File) ConfigurationInternal(org.gradle.api.internal.artifacts.configurations.ConfigurationInternal) PublishException(org.gradle.api.artifacts.PublishException)

Aggregations

File (java.io.File)1 PublishException (org.gradle.api.artifacts.PublishException)1 ArtifactPublisher (org.gradle.api.internal.artifacts.ArtifactPublisher)1 Module (org.gradle.api.internal.artifacts.Module)1 ConfigurationInternal (org.gradle.api.internal.artifacts.configurations.ConfigurationInternal)1 PublicationAwareRepository (org.gradle.api.internal.artifacts.repositories.PublicationAwareRepository)1