Skip to content

Commit

Permalink
doc: use Dokka instead of Javadoc for building documentation in modul…
Browse files Browse the repository at this point in the history
…es that contain Kotlin code in src/main

Java's Javadoc can't build documentation for Kotlin code, so we need something else.

Dokka can create documentation for both Kotlin and Java.

See https://kotlinlang.org/docs/dokka-introduction.html
  • Loading branch information
vlsi committed Jun 3, 2023
1 parent a4eb604 commit 6f5936b
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,26 @@ java {
withJavadocJar()
}

tasks.named<Jar>("javadocJar") {
// Set a custom classifier, so we can distinguish it from Dokka-generated javadoc
archiveClassifier.set("javadoc_java")
}

tasks.dokkaJavadoc {
moduleName.set("Apache JMeter ${project.name}")
mustRunAfter("kaptKotlin")
}

val dokkaJar by tasks.registering(Jar::class) {
group = LifecycleBasePlugin.BUILD_GROUP
description = "Assembles a jar archive containing javadoc"
from(tasks.dokkaJavadoc)
archiveClassifier.set("javadoc")
}

configurations[JavaPlugin.JAVADOC_ELEMENTS_CONFIGURATION_NAME].outgoing.artifact(dokkaJar)
configurations[JavaPlugin.JAVADOC_ELEMENTS_CONFIGURATION_NAME].outgoing {
// Avoid publishing Java-generated javadoc
artifacts.clear()
// Publish Dokka-generated javadoc instead
artifact(dokkaJar)
}
5 changes: 5 additions & 0 deletions build-logic/jvm/src/main/kotlin/build-logic.kotlin.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@ tasks.configureEach<KotlinCompile> {
jvmTarget = java.targetCompatibility.toString()
}
}

if (file("src/main/kotlin").isDirectory) {
// When main code contains Kotlin, use Dokka instead of Javadoc
apply(plugin = "build-logic.dokka-javadoc")
}
1 change: 1 addition & 0 deletions checksum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<trusted-key id='adbc987d1a7b91db6b0aaa81995efbf4a3d20beb' group='com.pinterest' />
<trusted-key id='adbc987d1a7b91db6b0aaa81995efbf4a3d20beb' group='com.pinterest.ktlint' />
<trusted-key id='06d34ed6ff73de368a772a781063fe98bcecb758' group='com.puppycrawl.tools' />
<trusted-key id='1be2dd4b1fcf252fe4f0a1d103281aa0289ff53a' group='com.soywiz.korlibs.korte' />
<trusted-key id='4f7e32d440ef90a83011a8fc6425559c47cc79c4' group='com.sun.activation' />
<trusted-key id='31fae244a81d64507b47182e1b2718089ce964b8' group='com.thoughtworks.qdox' />
<trusted-key id='050a37a2e0577f4baa095b52602ec18d20c4661c' group='com.thoughtworks.xstream' />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1be2dd4b1fcf252fe4f0a1d103281aa0289ff53a
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBGBJD1kBCAC2OgrVeUz5GtDnUh1fSKqEDN+3tjFKmCKj92buwiDLz8sWtzEE
ncMlGSic0yAVxMTNIlfq0ec1AFWIFKsMkcpYX435UapQz8S19XhIIROsy5i/bZcg
6bg4ddzAMs5CbpyLFmjzW49tOaZKQbUm0zb5c4NR4B6v7E5DWh/TCJAeqXd5yDQN
q2CAeeolJCv5Vuw76IjcaNlGFBt9/lAr/sjOyT4Tfl/8HA+x1RujVYcv+yxeevGX
zJOWRxO59i2EU3XgCOZXPE3F43cNNfwYpUlQso4nB4c7+vcK4D83PlmAH6t/N6G+
6EbsOS5OsAFmV3yve2ydS9BvF0TQsOcJFKRhABEBAAG5AQ0EYEkPWQEIAOJ14ajv
2BVqQW8oVD4EI5k7iKq1nYKquP4+63pgbx1MTMfkRAEpc6qtxSk5LasO19QkoV60
Wf+mB2CV/USfmQQfZcqREFLF2F3bY5cy964lWcZU0yPevGFg3uLKIqGa26/zQIpX
x3oF6QPV6sdO2vfqIMNQr08flW9BRep5WMtgvEBoAmaUyNBgYlGhdGauqahiI8ZK
oFuPW5E63HNajErH8na5BVaGziJUoq2XjY922tooGJ0Qi4dDUtOmrqEpqBrS8oKY
R1wszQ+USEpB90IuLd5kwut5AvIljjKe0v38o0f6T8nETfkxngdnYGjNoQt8Tbx5
zF4deq+2ojju7jUAEQEAAQ==
=lBfl
-----END PGP PUBLIC KEY BLOCK-----
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1be2dd4b1fcf252fe4f0a1d103281aa0289ff53a

0 comments on commit 6f5936b

Please sign in to comment.