Add workaround for configuration error during maven publish (#342)

The maven publish plugin isn't setting up dependencies correctly,
and we are getting errors like:

 "Task ':pkl-config-java:publishFatJarPublicationToMavenLocal' uses
  this output of task ':pkl-config-java:signLibraryPublication' without
   declaring an explicit or implicit dependency."

This adds a workaround for this type of error.
This commit is contained in:
Daniel Chao
2024-03-19 11:40:13 -07:00
committed by GitHub
parent 46d65506d5
commit 7e948d317c

View File

@@ -103,6 +103,14 @@ tasks.publish {
dependsOn(validatePom)
}
// Workaround for maven publish plugin not setting up dependencies correctly.
// Taken from https://github.com/gradle/gradle/issues/26091#issuecomment-1798137734
val dependsOnTasks = mutableListOf<String>()
tasks.withType<AbstractPublishToMaven>().configureEach {
dependsOnTasks.add(name.replace("publish", "sign").replaceAfter("Publication", ""))
dependsOn(dependsOnTasks)
}
signing {
// provided as env vars `ORG_GRADLE_PROJECT_signingKey` and `ORG_GRADLE_PROJECT_signingPassword`
// in CI.