From 31f27b5095f090f4cc72469b4a815f1a7054788c Mon Sep 17 00:00:00 2001 From: Aaron J Todd Date: Tue, 15 Aug 2023 10:40:27 -0400 Subject: [PATCH] predicate nexus publication --- .../src/main/kotlin/aws/sdk/kotlin/gradle/dsl/Publish.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build-plugins/src/main/kotlin/aws/sdk/kotlin/gradle/dsl/Publish.kt b/build-plugins/src/main/kotlin/aws/sdk/kotlin/gradle/dsl/Publish.kt index 77c3e53..6467cc2 100644 --- a/build-plugins/src/main/kotlin/aws/sdk/kotlin/gradle/dsl/Publish.kt +++ b/build-plugins/src/main/kotlin/aws/sdk/kotlin/gradle/dsl/Publish.kt @@ -89,6 +89,14 @@ fun Project.configurePublishing(repoName: String) { fun Project.configureNexus() { verifyRootProject { "Kotlin SDK nexus configuration must be applied to the root project only" } + + val doConfigure = listOf(SONATYPE_USERNAME_PROP, SONATYPE_PASSWORD_PROP, PUBLISH_GROUP_NAME_PROP) + .all { project.hasProperty(it) } + if (!doConfigure) { + logger.info("skipping nexus configuration, missing required one or more required properties") + return + } + apply(plugin = "io.github.gradle-nexus.publish-plugin") extensions.configure { val publishGroupName = project.property(PUBLISH_GROUP_NAME_PROP) as String