|
| 1 | +plugins { |
| 2 | + id("org.jetbrains.dokka") |
| 3 | + signing |
| 4 | + `maven-publish` |
| 5 | +} |
| 6 | + |
| 7 | +tasks.withType<AbstractArchiveTask>().configureEach { |
| 8 | + isPreserveFileTimestamps = false |
| 9 | + isReproducibleFileOrder = true |
| 10 | +} |
| 11 | + |
| 12 | +publishing { |
| 13 | + repositories { |
| 14 | + maven { |
| 15 | + name = "Central" |
| 16 | + url = if (version.toString().endsWith("SNAPSHOT")) { |
| 17 | + // uri("https://s01.oss.sonatype.org/content/repositories/snapshots") |
| 18 | + uri("https://oss.sonatype.org/content/repositories/snapshots") |
| 19 | + } else { |
| 20 | + // uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2") |
| 21 | + uri("https://oss.sonatype.org/service/local/staging/deploy/maven2") |
| 22 | + } |
| 23 | + credentials { |
| 24 | + username = properties["ossrhUsername"]?.toString() ?: System.getenv("OSSRH_USERNAME") |
| 25 | + password = properties["ossrhPassword"]?.toString() ?: System.getenv("OSSRH_PASSWORD") |
| 26 | + } |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + publications { |
| 31 | + withType<MavenPublication> { |
| 32 | + val publication = this |
| 33 | + val javadocJar = tasks.register("${publication.name}JavadocJar", Jar::class) { |
| 34 | + archiveClassifier.set("javadoc") |
| 35 | + from(tasks.dokkaJavadoc) |
| 36 | + // Each archive name should be distinct. Mirror the format for the sources Jar tasks. |
| 37 | + archiveBaseName.set("${archiveBaseName.get()}-${publication.name}") |
| 38 | + } |
| 39 | + |
| 40 | + artifact(javadocJar) |
| 41 | + pom { |
| 42 | + name.set("kotlinx-serialization-bencoding") |
| 43 | + description.set("A Kotlin serialization codec for bencoding format.") |
| 44 | + url.set("https://github.com/iseki0/kotlinx-serialization-bencoding") |
| 45 | + licenses { |
| 46 | + license { |
| 47 | + name.set("Apache-2.0") |
| 48 | + url.set("https://www.apache.org/licenses/LICENSE-2.0") |
| 49 | + } |
| 50 | + } |
| 51 | + developers { |
| 52 | + developer { |
| 53 | + id.set("iseki0") |
| 54 | + name.set("iseki zero") |
| 55 | + |
| 56 | + } |
| 57 | + } |
| 58 | + scm { |
| 59 | + connection.set("scm:git:https://github.com/iseki0/kotlinx-serialization-bencoding.git") |
| 60 | + developerConnection.set("scm:git:https://github.com/iseki0/kotlinx-serialization-bencoding.git") |
| 61 | + url.set("https://github.com/iseki0/kotlinx-serialization-bencoding") |
| 62 | + } |
| 63 | + } |
| 64 | + } |
| 65 | + } |
| 66 | + |
| 67 | +} |
| 68 | + |
| 69 | +signing { |
| 70 | + // To use local gpg command, configure gpg options in ~/.gradle/gradle.properties |
| 71 | + // reference: https://docs.gradle.org/current/userguide/signing_plugin.html#example_configure_the_gnupgsignatory |
| 72 | + useGpgCmd() |
| 73 | + publishing.publications.forEach { sign(it) } |
| 74 | +} |
0 commit comments