use of org.gradle.api.DomainObjectSet in project gradle by gradle.
the class NativeBasePlugin method addPublicationsFromVariants.
private void addPublicationsFromVariants(final Project project, final SoftwareComponentContainer components) {
project.getPluginManager().withPlugin("maven-publish", plugin -> {
components.withType(PublicationAwareComponent.class, component -> {
project.getExtensions().configure(PublishingExtension.class, publishing -> {
final ComponentWithVariants mainVariant = component.getMainPublication();
publishing.getPublications().create("main", MavenPublication.class, publication -> {
MavenPublicationInternal publicationInternal = (MavenPublicationInternal) publication;
publicationInternal.getMavenProjectIdentity().getArtifactId().set(component.getBaseName());
publicationInternal.from(mainVariant);
publicationInternal.publishWithOriginalFileName();
});
Set<? extends SoftwareComponent> variants = mainVariant.getVariants();
if (variants instanceof DomainObjectSet) {
((DomainObjectSet<? extends SoftwareComponent>) variants).all(child -> addPublicationFromVariant(child, publishing, project));
} else {
for (SoftwareComponent variant : variants) {
addPublicationFromVariant(variant, publishing, project);
}
}
});
});
});
}
Aggregations