Skip to content

Commit a2494e7

Browse files
committed
Add javadoc jar to jvm publication
1 parent df23b9e commit a2494e7

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

build.gradle.kts

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
2+
import org.jetbrains.dokka.gradle.DokkaTask
23

34
val ossrhUsername: String? by ext
45
val ossrhPassword: String? by ext
@@ -9,6 +10,7 @@ plugins {
910
`maven-publish`
1011
signing
1112
kotlin("multiplatform") version "1.3.61"
13+
id("org.jetbrains.dokka") version "0.10.1"
1214
id("com.github.ben-manes.versions") version "0.27.0"
1315
id("net.researchgate.release") version "2.8.1"
1416
}
@@ -21,8 +23,22 @@ tasks.withType<DependencyUpdatesTask> {
2123
}
2224
}
2325

26+
val dokka by tasks.existing(DokkaTask::class) {
27+
outputFormat = "javadoc"
28+
outputDirectory = "$buildDir/docs/javadoc"
29+
}
30+
31+
val javadocJar by tasks.registering(Jar::class) {
32+
group = LifecycleBasePlugin.BUILD_GROUP
33+
description = "Assembles a jar archive containing the Javadoc API documentation."
34+
archiveClassifier.set("javadoc")
35+
dependsOn(dokka)
36+
from(dokka.get().outputDirectory)
37+
}
38+
2439
repositories {
2540
mavenCentral()
41+
jcenter()
2642
}
2743

2844
kotlin {
@@ -66,12 +82,11 @@ kotlin {
6682
implementation("org.slf4j:slf4j-jdk14:1.7.30")
6783
}
6884
}
69-
}
70-
}
7185

72-
signing {
73-
useGpgCmd()
74-
sign(publishing.publications)
86+
mavenPublication {
87+
artifact(javadocJar.get())
88+
}
89+
}
7590
}
7691

7792
publishing {
@@ -137,6 +152,11 @@ publishing {
137152
}
138153
}
139154

155+
signing {
156+
useGpgCmd()
157+
sign(publishing.publications)
158+
}
159+
140160
tasks.afterReleaseBuild {
141161
dependsOn(tasks.publish)
142162
}

0 commit comments

Comments
 (0)