From 1b878361f01c8c659ea9a4d91d1c7e8a7435c2fe Mon Sep 17 00:00:00 2001 From: Danilo Pianini Date: Sat, 7 Dec 2024 22:56:31 +0100 Subject: [PATCH] feat: add task to save the generated bundle deployment id --- .../gradle/mavencentral/ProjectExtensions.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/kotlin/org/danilopianini/gradle/mavencentral/ProjectExtensions.kt b/src/main/kotlin/org/danilopianini/gradle/mavencentral/ProjectExtensions.kt index 899bdfdd..bf230042 100644 --- a/src/main/kotlin/org/danilopianini/gradle/mavencentral/ProjectExtensions.kt +++ b/src/main/kotlin/org/danilopianini/gradle/mavencentral/ProjectExtensions.kt @@ -350,6 +350,17 @@ internal object ProjectExtensions { }, zipTask = zipMavenCentralPortal, ) + tasks.register("saveMavenCentralPortalDeploymentId") { save -> + val fileName = "maven-central-portal-bundle-id" + val file = rootProject.layout.buildDirectory.map { it.asFile.resolve(fileName) } + save.group = PublishingPlugin.PUBLISH_TASK_GROUP + save.description = "Saves the Maven Central Portal deployment ID locally in ${file.get().absolutePath}" + save.dependsOn(zipMavenCentralPortal) + save.outputs.file(file) + save.doLast { + file.get().writeText("${portalDeployment.fileToUpload}=${portalDeployment.deploymentId}\n") + } + } val validate = tasks.register(PublishPortalDeployment.VALIDATE_TASK_NAME) { validate -> validate.group = PublishingPlugin.PUBLISH_TASK_GROUP