From 350cff776e199c9062f4be3300c60598c43c73d4 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Tue, 24 Oct 2023 19:19:55 +0200 Subject: [PATCH] Fix release tasks --- .../teavm/buildutil/PublishTeaVMPlugin.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/build-logic/src/main/java/org/teavm/buildutil/PublishTeaVMPlugin.java b/build-logic/src/main/java/org/teavm/buildutil/PublishTeaVMPlugin.java index ee1721315..43cccaafe 100644 --- a/build-logic/src/main/java/org/teavm/buildutil/PublishTeaVMPlugin.java +++ b/build-logic/src/main/java/org/teavm/buildutil/PublishTeaVMPlugin.java @@ -45,11 +45,16 @@ public abstract class PublishTeaVMPlugin implements Plugin { target.getExtensions().add(PublishTeaVMExtension.class, EXTENSION_NAME, extension); target.afterEvaluate(p -> target.getExtensions().configure(PublishingExtension.class, publishing -> { - publishing.publications(publications -> { - publications.create("java", MavenPublication.class, publication -> { - customizePublication(target, publication, extension); + var pluginMavenPublication = publishing.getPublications().findByName("pluginMaven"); + if (pluginMavenPublication == null) { + publishing.publications(publications -> { + publications.create("java", MavenPublication.class, publication -> { + customizePublication(target, publication, extension, true); + }); }); - }); + } else { + customizePublication(target, (MavenPublication) pluginMavenPublication, extension, false); + } if (publish) { var signing = target.getExtensions().getByType(SigningExtension.class); publishing.getPublications().configureEach(signing::sign); @@ -90,12 +95,15 @@ public abstract class PublishTeaVMPlugin implements Plugin { }); } - private void customizePublication(Project project, MavenPublication publication, ExtensionImpl extension) { + private void customizePublication(Project project, MavenPublication publication, ExtensionImpl extension, + boolean includeComponent) { publication.setGroupId("org.teavm"); if (extension.getArtifactId() != null) { publication.setArtifactId(extension.getArtifactId()); } - publication.from(project.getComponents().getByName("java")); + if (includeComponent) { + publication.from(project.getComponents().getByName("java")); + } if (extension.packaging != null) { publication.getPom().setPackaging(extension.packaging); }