From dede651cdf1981accf89342176f5f2fa336ea3df Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Sat, 9 Mar 2024 15:21:22 +0100 Subject: [PATCH] fix(build): Sign all artifacts on release (#541) This commit tries to fix the problem where some artifacts are not signed on release. --- gradle-plugin/build.gradle | 7 ++++--- gradle/grailsCentralPublishing.gradle | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gradle-plugin/build.gradle b/gradle-plugin/build.gradle index 9f90ba6c3..9f34d709f 100644 --- a/gradle-plugin/build.gradle +++ b/gradle-plugin/build.gradle @@ -53,10 +53,11 @@ gradlePlugin { afterEvaluate { signing { + def publicationContainer = project.extensions.findByType(PublishingExtension).publications required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - Publication[] publications = new Publication[publishing.publications.size() - 1] - publishing.publications.findAll { it.name != 'pluginMaven' }.toArray(publications) - sign(publications) + Publication[] publicationsToSign = new Publication[publicationContainer.size() - 1] + publicationContainer.findAll { it.name != 'pluginMaven' }.toArray(publicationsToSign) + sign(publicationsToSign) } publishing.publications.each { publication -> diff --git a/gradle/grailsCentralPublishing.gradle b/gradle/grailsCentralPublishing.gradle index c7ac1470f..c71bd202e 100644 --- a/gradle/grailsCentralPublishing.gradle +++ b/gradle/grailsCentralPublishing.gradle @@ -40,10 +40,12 @@ project.extensions.configure(PublishingExtension) { PublishingExtension pe -> } afterEvaluate { - def mavenPublication = project.extensions.findByType(PublishingExtension).publications.named('pluginMaven') - project.extensions.configure(SigningExtension) { SigningExtension se -> + def publicationContainer = extensions.findByType(PublishingExtension).publications + extensions.configure(SigningExtension) { SigningExtension se -> se.required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - se.sign mavenPublication.get() + Publication[] publicationsToSign = new Publication[publicationContainer.size()] + publicationContainer.findAll().toArray(publicationsToSign) + se.sign(publicationsToSign) } }