use of org.gradle.api.NamedDomainObjectSet in project gradle by gradle.
the class IvyPublishPlugin method createTasksLater.
private void createTasksLater(final Project project, final PublishingExtension publishingExtension, final DirectoryProperty buildDir) {
final TaskContainer tasks = project.getTasks();
final NamedDomainObjectSet<IvyPublicationInternal> publications = publishingExtension.getPublications().withType(IvyPublicationInternal.class);
final NamedDomainObjectList<IvyArtifactRepository> repositories = publishingExtension.getRepositories().withType(IvyArtifactRepository.class);
repositories.all(repository -> tasks.register(publishAllToSingleRepoTaskName(repository), publish -> {
publish.setDescription("Publishes all Ivy publications produced by this project to the " + repository.getName() + " repository.");
publish.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
}));
publications.all(publication -> {
final String publicationName = publication.getName();
createGenerateIvyDescriptorTask(tasks, publicationName, publication, buildDir);
createGenerateMetadataTask(tasks, publication, publications, buildDir, repositories);
createPublishTaskForEachRepository(tasks, publication, publicationName, repositories);
});
}
use of org.gradle.api.NamedDomainObjectSet in project gradle by gradle.
the class MavenPublishPlugin method realizePublishingTasksLater.
private void realizePublishingTasksLater(final Project project, final PublishingExtension extension) {
final NamedDomainObjectSet<MavenPublicationInternal> mavenPublications = extension.getPublications().withType(MavenPublicationInternal.class);
final TaskContainer tasks = project.getTasks();
final DirectoryProperty buildDirectory = project.getLayout().getBuildDirectory();
final TaskProvider<Task> publishLifecycleTask = tasks.named(PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME);
final TaskProvider<Task> publishLocalLifecycleTask = tasks.named(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
final NamedDomainObjectList<MavenArtifactRepository> repositories = extension.getRepositories().withType(MavenArtifactRepository.class);
repositories.all(repository -> tasks.register(publishAllToSingleRepoTaskName(repository), publish -> {
publish.setDescription("Publishes all Maven publications produced by this project to the " + repository.getName() + " repository.");
publish.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
}));
mavenPublications.all(publication -> {
createGenerateMetadataTask(tasks, publication, mavenPublications, buildDirectory);
createGeneratePomTask(tasks, publication, buildDirectory, project);
createLocalInstallTask(tasks, publishLocalLifecycleTask, publication);
createPublishTasksForEachMavenRepo(tasks, publishLifecycleTask, publication, repositories);
});
}
Aggregations