From da1b6d919a5e36d9c21bbe61a5f9246a9d7169a8 Mon Sep 17 00:00:00 2001 From: Francisco Solis <30329003+Im-Fran@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:49:26 -0300 Subject: [PATCH] patch: remove extension in favor of task variables --- SonatypeCentralUpload/build.gradle.kts | 2 +- ...natypeCentralUploadPluginFunctionalTest.kt | 4 +-- .../SonatypeCentralUploadExtension.kt | 33 ------------------- .../SonatypeCentralUploadPlugin.kt | 11 +------ 4 files changed, 3 insertions(+), 47 deletions(-) delete mode 100644 SonatypeCentralUpload/src/main/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadExtension.kt diff --git a/SonatypeCentralUpload/build.gradle.kts b/SonatypeCentralUpload/build.gradle.kts index 95e3cc1..3dbac25 100644 --- a/SonatypeCentralUpload/build.gradle.kts +++ b/SonatypeCentralUpload/build.gradle.kts @@ -6,7 +6,7 @@ plugins { id("com.gradle.plugin-publish") version "1.2.1" } -version = "1.0.1" +version = "1.0.2" group = "cl.franciscosolis" // Set up the publishing plugin diff --git a/SonatypeCentralUpload/src/functionalTest/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadPluginFunctionalTest.kt b/SonatypeCentralUpload/src/functionalTest/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadPluginFunctionalTest.kt index 22757c8..95ced01 100644 --- a/SonatypeCentralUpload/src/functionalTest/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadPluginFunctionalTest.kt +++ b/SonatypeCentralUpload/src/functionalTest/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadPluginFunctionalTest.kt @@ -47,8 +47,6 @@ class SonatypeCentralUploadPluginFunctionalTest { rootProject.name = "SonatypeCentralUploadTest" """.trimIndent()) buildFile.writeText(""" - import cl.franciscosolis.sonatypecentralupload.SonatypeCentralUploadTask - plugins { id("cl.franciscosolis.gradledotenv") version "1.0.1" id("cl.franciscosolis.sonatype-central-upload") @@ -64,7 +62,7 @@ class SonatypeCentralUploadPluginFunctionalTest { } } - named("sonatypeCentralUpload") { + sonatypeCentralUpload { dependsOn(named("randomTask")) username = env["SONATYPE_USERNAME"] ?: "" password = env["SONATYPE_PASSWORD"] ?: "" diff --git a/SonatypeCentralUpload/src/main/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadExtension.kt b/SonatypeCentralUpload/src/main/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadExtension.kt deleted file mode 100644 index ef24975..0000000 --- a/SonatypeCentralUpload/src/main/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadExtension.kt +++ /dev/null @@ -1,33 +0,0 @@ -package cl.franciscosolis.sonatypecentralupload - -import org.gradle.api.file.FileCollection -import org.gradle.api.provider.Property -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.Optional -import java.io.File - -abstract class SonatypeCentralUploadExtension { - @get:Input - abstract val username: Property - - @get:Input - abstract val password: Property - - @get:Input - @get:Optional - abstract val signingKey: Property - - @get:Input - @get:Optional - abstract val signingKeyPassphrase: Property - - @get:Input - @get:Optional - abstract val publicKey: Property - - @get:Input - abstract val archives: Property - - @get:Input - abstract val pom: Property -} \ No newline at end of file diff --git a/SonatypeCentralUpload/src/main/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadPlugin.kt b/SonatypeCentralUpload/src/main/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadPlugin.kt index ee62ad3..7345593 100644 --- a/SonatypeCentralUpload/src/main/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadPlugin.kt +++ b/SonatypeCentralUpload/src/main/kotlin/cl/franciscosolis/sonatypecentralupload/SonatypeCentralUploadPlugin.kt @@ -5,15 +5,6 @@ import org.gradle.api.Project class SonatypeCentralUploadPlugin: Plugin { override fun apply(project: Project) { - val extension: SonatypeCentralUploadExtension = project.extensions.create("sonatypeCentralUpload", SonatypeCentralUploadExtension::class.java) - project.tasks.register("sonatypeCentralUpload", SonatypeCentralUploadTask::class.java) { task -> - task.username.set(extension.username) - task.password.set(extension.password) - task.signingKey.set(extension.signingKey) - task.signingKeyPassphrase.set(extension.signingKeyPassphrase) - task.publicKey.set(extension.publicKey) - task.archives.set(extension.archives) - task.pom.set(extension.pom) - } + project.tasks.register("sonatypeCentralUpload", SonatypeCentralUploadTask::class.java) } }