Fix failure when signing during publishing (#866)

This is a workaround for https://github.com/gradle/gradle/issues/26091
This commit is contained in:
Niels van Velzen 2024-02-04 16:00:25 +01:00 committed by GitHub
parent ff674c897e
commit f4b5963d91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,11 +2,13 @@ import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
import org.gradle.api.publish.maven.tasks.AbstractPublishToMaven
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withType
import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin
@ -16,6 +18,12 @@ fun Project.enablePublishing(init: PublishingExtension.() -> Unit = {}) {
extensions.getByType<PublishingExtension>().init()
// FIXME - workaround for https://github.com/gradle/gradle/issues/26091
val signingTasks = tasks.withType<Sign>()
tasks.withType<AbstractPublishToMaven>().configureEach {
mustRunAfter(signingTasks)
}
// Run block after creating project specific configuration
afterEvaluate {
// Add signing config