Skip to content

Commit

Permalink
fix publish workflow (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek-12 committed Mar 6, 2024
1 parent fb008b3 commit db30e5a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 5 additions & 10 deletions buildSrc/src/main/kotlin/ConfigurePublication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<PublishingExtension>()).apply {
sonatypeRepository(isReleaseBuild, properties)
publications.withType<MavenPublication>().configureEach {
groupId = rootProject.group.toString()
artifact(javadocTask)
configurePom()
configureVersion(isReleaseBuild)
}
sonatypeRepository(isReleaseBuild, properties)
}
signPublications(isReleaseBuild, properties)
}
Expand All @@ -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<PublishingExtension>()).apply {
sonatypeRepository(isReleaseBuild, properties)

publications {
maybeCreate(Config.publishingVariant, MavenPublication::class).apply {
from(components[Config.publishingVariant])
Expand All @@ -67,6 +61,7 @@ fun Project.publishAndroid(ext: LibraryExtension) = with(ext) {
configureVersion(isReleaseBuild)
}
}
sonatypeRepository(isReleaseBuild, properties)
}
signPublications(isReleaseBuild, properties)
}
Expand Down
10 changes: 5 additions & 5 deletions buildSrc/src/main/kotlin/PublishingExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit db30e5a

Please sign in to comment.