Skip to content

Commit

Permalink
Fix release tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
konsoletyper committed Oct 24, 2023
1 parent 699c26c commit 80b5492
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,16 @@ public void apply(Project target) {
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);
Expand Down Expand Up @@ -90,12 +95,15 @@ public void apply(Project target) {
});
}

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);
}
Expand Down

0 comments on commit 80b5492

Please sign in to comment.