Search in sources :

Example 1 with PublicationContainer

use of org.gradle.api.publish.PublicationContainer in project gradle by gradle.

the class IvyPluginPublishingRules method addMainPublication.

@Mutate
public void addMainPublication(PublishingExtension publishing, GradlePluginDevelopmentExtension pluginDevelopment, ServiceRegistry services) {
    if (!pluginDevelopment.isAutomatedPublishing()) {
        return;
    }
    SoftwareComponentContainer componentContainer = services.get(SoftwareComponentContainer.class);
    SoftwareComponent component = componentContainer.getByName("java");
    PublicationContainer publications = publishing.getPublications();
    createIvyPluginPublication(component, publications);
}
Also used : PublicationContainer(org.gradle.api.publish.PublicationContainer) SoftwareComponent(org.gradle.api.component.SoftwareComponent) SoftwareComponentContainer(org.gradle.api.component.SoftwareComponentContainer) Mutate(org.gradle.model.Mutate)

Example 2 with PublicationContainer

use of org.gradle.api.publish.PublicationContainer in project gradle by gradle.

the class MavenPluginPublishingRules method addMarkerPublications.

@Finalize
public void addMarkerPublications(PublishingExtension publishing, GradlePluginDevelopmentExtension pluginDevelopment) {
    if (!pluginDevelopment.isAutomatedPublishing()) {
        return;
    }
    PublicationContainer publications = publishing.getPublications();
    NamedDomainObjectContainer<PluginDeclaration> declaredPlugins = pluginDevelopment.getPlugins();
    for (PluginDeclaration declaration : declaredPlugins) {
        createMavenMarkerPublication(declaration, (MavenPublication) publications.getByName("pluginMaven"), publications);
    }
}
Also used : PluginDeclaration(org.gradle.plugin.devel.PluginDeclaration) PublicationContainer(org.gradle.api.publish.PublicationContainer) Finalize(org.gradle.model.Finalize)

Example 3 with PublicationContainer

use of org.gradle.api.publish.PublicationContainer in project gradle by gradle.

the class PublishingPlugin method apply.

@Override
public void apply(final Project project) {
    RepositoryHandler repositories = publicationServices.createRepositoryHandler();
    PublicationContainer publications = instantiator.newInstance(DefaultPublicationContainer.class, instantiator, collectionCallbackActionDecorator);
    PublishingExtension extension = project.getExtensions().create(PublishingExtension.class, PublishingExtension.NAME, DefaultPublishingExtension.class, repositories, publications);
    project.getTasks().register(PUBLISH_LIFECYCLE_TASK_NAME, task -> {
        task.setDescription("Publishes all publications produced by this project.");
        task.setGroup(PUBLISH_TASK_GROUP);
    });
    extension.getPublications().all(publication -> {
        PublicationInternal<?> internalPublication = Cast.uncheckedNonnullCast(publication);
        ProjectInternal projectInternal = (ProjectInternal) project;
        projectPublicationRegistry.registerPublication(projectInternal, internalPublication);
    });
    bridgeToSoftwareModelIfNeeded((ProjectInternal) project);
    validatePublishingModelWhenComplete(project, extension);
}
Also used : PublicationContainer(org.gradle.api.publish.PublicationContainer) DefaultPublicationContainer(org.gradle.api.publish.internal.DefaultPublicationContainer) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) RepositoryHandler(org.gradle.api.artifacts.dsl.RepositoryHandler) PublishingExtension(org.gradle.api.publish.PublishingExtension) DefaultPublishingExtension(org.gradle.api.publish.internal.DefaultPublishingExtension)

Example 4 with PublicationContainer

use of org.gradle.api.publish.PublicationContainer in project gradle by gradle.

the class IvyPluginPublishingRules method addMarkerPublications.

@Finalize
public void addMarkerPublications(PublishingExtension publishing, GradlePluginDevelopmentExtension pluginDevelopment) {
    if (!pluginDevelopment.isAutomatedPublishing()) {
        return;
    }
    PublicationContainer publications = publishing.getPublications();
    NamedDomainObjectContainer<PluginDeclaration> declaredPlugins = pluginDevelopment.getPlugins();
    for (PluginDeclaration declaration : declaredPlugins) {
        createIvyMarkerPublication(declaration, (IvyPublication) publications.getByName("pluginIvy"), publications);
    }
}
Also used : PluginDeclaration(org.gradle.plugin.devel.PluginDeclaration) PublicationContainer(org.gradle.api.publish.PublicationContainer) Finalize(org.gradle.model.Finalize)

Example 5 with PublicationContainer

use of org.gradle.api.publish.PublicationContainer in project gradle by gradle.

the class MavenPluginPublishingRules method addMainPublication.

@Mutate
public void addMainPublication(PublishingExtension publishing, GradlePluginDevelopmentExtension pluginDevelopment, ServiceRegistry services) {
    if (!pluginDevelopment.isAutomatedPublishing()) {
        return;
    }
    SoftwareComponentContainer componentContainer = services.get(SoftwareComponentContainer.class);
    SoftwareComponent component = componentContainer.getByName("java");
    PublicationContainer publications = publishing.getPublications();
    createMavenPluginPublication(component, publications);
}
Also used : PublicationContainer(org.gradle.api.publish.PublicationContainer) SoftwareComponent(org.gradle.api.component.SoftwareComponent) SoftwareComponentContainer(org.gradle.api.component.SoftwareComponentContainer) Mutate(org.gradle.model.Mutate)

Aggregations

PublicationContainer (org.gradle.api.publish.PublicationContainer)6 SoftwareComponent (org.gradle.api.component.SoftwareComponent)2 SoftwareComponentContainer (org.gradle.api.component.SoftwareComponentContainer)2 Finalize (org.gradle.model.Finalize)2 Mutate (org.gradle.model.Mutate)2 PluginDeclaration (org.gradle.plugin.devel.PluginDeclaration)2 Action (org.gradle.api.Action)1 RepositoryHandler (org.gradle.api.artifacts.dsl.RepositoryHandler)1 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)1 PublishingExtension (org.gradle.api.publish.PublishingExtension)1 DefaultPublicationContainer (org.gradle.api.publish.internal.DefaultPublicationContainer)1 DefaultPublishingExtension (org.gradle.api.publish.internal.DefaultPublishingExtension)1 MavenPublication (org.gradle.api.publish.maven.MavenPublication)1 Jar (org.gradle.api.tasks.bundling.Jar)1 ShipkitConfiguration (org.shipkit.gradle.configuration.ShipkitConfiguration)1 ShipkitConfigurationPlugin (org.shipkit.internal.gradle.configuration.ShipkitConfigurationPlugin)1