From db30e5a03d41b7fb2c4582cecd8aaa92417132e9 Mon Sep 17 00:00:00 2001 From: Nek-12 Date: Wed, 6 Mar 2024 16:16:41 +0300 Subject: [PATCH] fix publish workflow (2) --- buildSrc/src/main/kotlin/Config.kt | 1 + buildSrc/src/main/kotlin/ConfigurePublication.kt | 15 +++++---------- buildSrc/src/main/kotlin/PublishingExt.kt | 10 +++++----- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index 2d82686b..6cfaade8 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -29,6 +29,7 @@ object Config { const val description = """A Kotlin Multiplatform MVI library based on coroutines with a powerful plugin system""" const val supportEmail = "hello@respawn.pro" const val vendorName = "Respawn Open Source Team" + const val vendorId = "respawn-app" const val debuggerPluginDescription = "A debugger tool for FlowMVI - $description" const val debuggerName = "FlowMVI Debugger" const val debuggerAppId = "fd36c0cc-ae50-4aad-8579-f37e1e8af99c" diff --git a/buildSrc/src/main/kotlin/ConfigurePublication.kt b/buildSrc/src/main/kotlin/ConfigurePublication.kt index ce980167..e7953a40 100644 --- a/buildSrc/src/main/kotlin/ConfigurePublication.kt +++ b/buildSrc/src/main/kotlin/ConfigurePublication.kt @@ -12,26 +12,24 @@ import org.gradle.kotlin.dsl.maybeCreate import org.gradle.kotlin.dsl.withType import org.gradle.plugins.signing.Sign -private val Project.subProjectName get() = name.removePrefix(":").replace("[/:]".toRegex(), "-") - /** * Configures Maven publishing to sonatype for this project */ fun Project.publishMultiplatform() { - val properties by localProperties - val isReleaseBuild = properties["release"]?.toString().toBoolean() + val properties by rootProject.localProperties + val isReleaseBuild = requireNotNull(properties["release"]).toString().toBooleanStrict() val javadocTask = tasks.named("emptyJavadocJar") // TODO: dokka does not support kmp javadocs yet afterEvaluate { requireNotNull(extensions.findByType()).apply { - sonatypeRepository(isReleaseBuild, properties) publications.withType().configureEach { groupId = rootProject.group.toString() artifact(javadocTask) configurePom() configureVersion(isReleaseBuild) } + sonatypeRepository(isReleaseBuild, properties) } signPublications(isReleaseBuild, properties) } @@ -45,20 +43,16 @@ fun Project.publishMultiplatform() { * Publish the android artifact */ fun Project.publishAndroid(ext: LibraryExtension) = with(ext) { + val properties by rootProject.localProperties publishing { singleVariant(Config.publishingVariant) { withSourcesJar() withJavadocJar() } } - afterEvaluate { - val properties by localProperties val isReleaseBuild = properties["release"]?.toString().toBoolean() - requireNotNull(extensions.findByType()).apply { - sonatypeRepository(isReleaseBuild, properties) - publications { maybeCreate(Config.publishingVariant, MavenPublication::class).apply { from(components[Config.publishingVariant]) @@ -67,6 +61,7 @@ fun Project.publishAndroid(ext: LibraryExtension) = with(ext) { configureVersion(isReleaseBuild) } } + sonatypeRepository(isReleaseBuild, properties) } signPublications(isReleaseBuild, properties) } diff --git a/buildSrc/src/main/kotlin/PublishingExt.kt b/buildSrc/src/main/kotlin/PublishingExt.kt index a60aac4b..8b819cec 100644 --- a/buildSrc/src/main/kotlin/PublishingExt.kt +++ b/buildSrc/src/main/kotlin/PublishingExt.kt @@ -32,11 +32,11 @@ internal fun MavenPublication.configurePom() = pom { } developers { developer { - id.set("respawn-app") - name.set("Respawn") - email.set("hello@respawn.pro") - url.set("https://respawn.pro") - organization.set("Respawn") + id.set(Config.vendorId) + name.set(Config.vendorName) + email.set(Config.supportEmail) + url.set("https://opensource.respawn.pro") + organization.set(Config.vendorName) organizationUrl.set(url) } }