Skip to content

Commit e4ce551

Browse files
committed
Add signAllPublications task
1 parent 17c8ae2 commit e4ce551

File tree

1 file changed

+21
-0
lines changed
  • build-plugins/build-support/src/main/kotlin/aws/sdk/kotlin/gradle/dsl

1 file changed

+21
-0
lines changed

build-plugins/build-support/src/main/kotlin/aws/sdk/kotlin/gradle/dsl/Publish.kt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,27 @@ fun Project.configurePublishing(repoName: String, githubOrganization: String = "
247247
sign(publications)
248248
}
249249

250+
// Register a task that allows you to sign publications which have already been staged in build/m2
251+
project.tasks.register<Sign>("signAllPublications") {
252+
val publicationsDir = layout.buildDirectory.dir("m2").get().asFile
253+
val toSignTree = fileTree(publicationsDir) {
254+
include("**/*.pom", "**/*.module")
255+
include("**/*.jar")
256+
include("**/*.klib")
257+
include("**/*.aar")
258+
include("**/*.zip", "**/*.tar", "**/*.tar.gz")
259+
}
260+
261+
inputs.files(toSignTree)
262+
outputs.upToDateWhen { false } // always re-run task
263+
264+
doFirst {
265+
logger.lifecycle("Recomputing signatures for ${toSignTree.files.size} artifacts in $publicationsDir")
266+
}
267+
268+
sign(*toSignTree.files.toTypedArray())
269+
}
270+
250271
// FIXME - workaround for https://github.com/gradle/gradle/issues/26091
251272
val signingTasks = tasks.withType<Sign>()
252273
tasks.withType<AbstractPublishToMaven>().configureEach {

0 commit comments

Comments
 (0)