Skip to content

Commit

Permalink
Merge pull request #2 from ikarenkov/publishing_0.1.1
Browse files Browse the repository at this point in the history
Publishing 0.1.1
  • Loading branch information
ikarenkov authored Feb 1, 2024
2 parents b1ccf95 + 028721e commit 2e40291
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPom
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.tasks.AbstractPublishToMaven
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.configure
Expand All @@ -12,6 +13,7 @@ import org.gradle.kotlin.dsl.findByType
import org.gradle.kotlin.dsl.maven
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.withType
import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import java.util.Properties

Expand All @@ -22,7 +24,23 @@ internal fun Project.setupPublishing() {
archiveClassifier.set("javadoc")
}

val isSigningEnabled = getExtraString("signing.keyId") != null

if (isSigningEnabled) {
// Workaround for https://github.com/gradle/gradle/issues/26091 and https://youtrack.jetbrains.com/issue/KT-46466
val signingTasks = tasks.withType<Sign>()
tasks.withType<AbstractPublishToMaven>().configureEach {
dependsOn(signingTasks)
}
}

configure<PublishingExtension> {
if (isSigningEnabled) {
configure<SigningExtension> {
// Signing artifacts. Signing.* extra properties values will be used
sign(publications)
}
}
// Configure maven central repository
repositories {
maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
Expand All @@ -47,8 +65,8 @@ internal fun Project.setupPublishing() {
pom {
name = "Kombucha UDF"
description =
"UDF library for state hosting based on ELM principles. " +
"It helps distinguish pure functions from the othe ones and keep logic inside pure function."
"UDF library based on The Elm Architecture (TEA) concepts that helps to focus on logic of you application, " +
"rather then understanding what is going on."
url = "https://github.com/ikarenkov/kombucha-udf"

setupLicense()
Expand All @@ -62,15 +80,6 @@ internal fun Project.setupPublishing() {

val publications = extensions.findByType<PublishingExtension>()?.publications

configure<SigningExtension> {
if (getExtraString("signing.keyId") != null) {
// Signing artifacts. Signing.* extra properties values will be used
publications?.let {
sign(it)
}
}
}

afterEvaluate {
publications?.withType<MavenPublication> {
artifactId = "kombucha-$artifactId"
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]

kombucha = "0.1"
kombucha = "0.1.1"

kotlin = "1.9.21"
kotlinCompilerExtension = "1.5.7"
Expand Down

0 comments on commit 2e40291

Please sign in to comment.