Skip to content

Commit

Permalink
Revert "Adjust publishing config to use dokka javadoc task so jar tas…
Browse files Browse the repository at this point in the history
…k doesn't break signing task dependencies"

This reverts commit a41236d.
  • Loading branch information
russhwolf committed Oct 9, 2023
1 parent 1c16274 commit 1be7a6e
Showing 1 changed file with 46 additions and 54 deletions.
100 changes: 46 additions & 54 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.dokka.gradle.DokkaTask

/*
* Copyright 2020 Russell Wolf
*
Expand Down Expand Up @@ -29,73 +27,67 @@ allprojects {
mavenCentral()
}

if (plugins.hasPlugin("maven-publish")) {
val dokkaJavadoc by tasks.withType<DokkaTask>()

val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
dependsOn(dokkaJavadoc)
from(dokkaJavadoc.outputDirectory)
}
val emptyJavadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}

afterEvaluate {
extensions.findByType<PublishingExtension>()?.apply {
repositories {
maven {
url = uri(
if (isReleaseBuild) {
"https://oss.sonatype.org/service/local/staging/deploy/maven2"
} else {
"https://oss.sonatype.org/content/repositories/snapshots"
}
)
credentials {
username = properties["sonatypeUsername"].toString()
password = properties["sonatypePassword"].toString()
afterEvaluate {
extensions.findByType<PublishingExtension>()?.apply {
repositories {
maven {
url = uri(
if (isReleaseBuild) {
"https://oss.sonatype.org/service/local/staging/deploy/maven2"
} else {
"https://oss.sonatype.org/content/repositories/snapshots"
}
)
credentials {
username = properties["sonatypeUsername"].toString()
password = properties["sonatypePassword"].toString()
}
}
}

publications.withType<MavenPublication>().configureEach {
artifact(javadocJar.get())
publications.withType<MavenPublication>().configureEach {
artifact(emptyJavadocJar.get())

pom {
name.set("Multiplatform Settings")
description.set("A Kotlin Multiplatform library for saving simple key-value data")
url.set("https://github.com/russhwolf/multiplatform-settings")
pom {
name.set("Multiplatform Settings")
description.set("A Kotlin Multiplatform library for saving simple key-value data")
url.set("https://github.com/russhwolf/multiplatform-settings")

licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("russhwolf")
name.set("Russell Wolf")
}
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
scm {
url.set("https://github.com/russhwolf/multiplatform-settings")
}
developers {
developer {
id.set("russhwolf")
name.set("Russell Wolf")
}
}
scm {
url.set("https://github.com/russhwolf/multiplatform-settings")
}
}
}
}

extensions.findByType<SigningExtension>()?.apply {
val publishing = extensions.findByType<PublishingExtension>() ?: return@apply
val key = properties["signingKey"]?.toString()?.replace("\\n", "\n")
val password = properties["signingPassword"]?.toString()
extensions.findByType<SigningExtension>()?.apply {
val publishing = extensions.findByType<PublishingExtension>() ?: return@apply
val key = properties["signingKey"]?.toString()?.replace("\\n", "\n")
val password = properties["signingPassword"]?.toString()

useInMemoryPgpKeys(key, password)
sign(publishing.publications)
}
useInMemoryPgpKeys(key, password)
sign(publishing.publications)
}

tasks.withType<Sign>().configureEach {
onlyIf { isReleaseBuild }
}
tasks.withType<Sign>().configureEach {
onlyIf { isReleaseBuild }
}
}
}
Expand Down

0 comments on commit 1be7a6e

Please sign in to comment.