Skip to content

Commit c8c6b6f

Browse files
feat: generate and publish docs (#320)
1 parent 2137913 commit c8c6b6f

4 files changed

Lines changed: 50 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
<!-- x-release-please-start-version -->
44

55
[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.45.0)
6+
[![javadoc](https://javadoc.io/badge2/com.withorb.api/orb-java/0.45.0/javadoc.svg)](https://javadoc.io/doc/com.withorb.api/orb-java/0.45.0)
67

78
<!-- x-release-please-end -->
89

910
The Orb Java SDK provides convenient access to the Orb REST API from applications written in Java.
1011

1112
The Orb Java SDK is similar to the Orb Kotlin SDK but with minor differences that make it more ergonomic for use in Java, such as `Optional` instead of nullable values, `Stream` instead of `Sequence`, and `CompletableFuture` instead of suspend functions.
1213

13-
The REST API documentation can be found on [docs.withorb.com](https://docs.withorb.com/reference/api-reference).
14+
The REST API documentation can be found on [docs.withorb.com](https://docs.withorb.com/reference/api-reference). Javadocs are also available on [javadoc.io](https://javadoc.io/doc/com.withorb.api/orb-java/0.45.0).
1415

1516
## Installation
1617

build.gradle.kts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1+
plugins {
2+
id("org.jetbrains.dokka") version "2.0.0"
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}
8+
19
allprojects {
210
group = "com.withorb.api"
311
version = "0.45.0" // x-release-please-version
412
}
13+
14+
subprojects {
15+
apply(plugin = "org.jetbrains.dokka")
16+
}
17+
18+
// Avoid race conditions between `dokkaJavadocCollector` and `dokkaJavadocJar` tasks
19+
tasks.named("dokkaJavadocCollector").configure {
20+
subprojects.flatMap { it.tasks }
21+
.filter { it.project.name != "orb-java" && it.name == "dokkaJavadocJar" }
22+
.forEach { mustRunAfter(it) }
23+
}

buildSrc/src/main/kotlin/orb.publish.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import com.vanniktech.maven.publish.JavadocJar
2+
import com.vanniktech.maven.publish.KotlinJvm
13
import com.vanniktech.maven.publish.MavenPublishBaseExtension
24
import com.vanniktech.maven.publish.SonatypeHost
35

@@ -19,6 +21,12 @@ configure<MavenPublishBaseExtension> {
1921
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
2022

2123
coordinates(project.group.toString(), project.name, project.version.toString())
24+
configure(
25+
KotlinJvm(
26+
javadocJar = JavadocJar.Dokka("dokkaJavadoc"),
27+
sourcesJar = true,
28+
)
29+
)
2230

2331
pom {
2432
name.set("API Reference")

orb-java/build.gradle.kts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,24 @@ plugins {
66
dependencies {
77
api(project(":orb-java-client-okhttp"))
88
}
9+
10+
// Redefine `dokkaJavadoc` to:
11+
// - Depend on the root project's task for merging the docs of all the projects
12+
// - Forward that task's output to this task's output
13+
tasks.named("dokkaJavadoc").configure {
14+
actions.clear()
15+
16+
val dokkaJavadocCollector = rootProject.tasks["dokkaJavadocCollector"]
17+
dependsOn(dokkaJavadocCollector)
18+
19+
val outputDirectory = project.layout.buildDirectory.dir("dokka/javadoc")
20+
doLast {
21+
copy {
22+
from(dokkaJavadocCollector.outputs.files)
23+
into(outputDirectory)
24+
duplicatesStrategy = DuplicatesStrategy.INCLUDE
25+
}
26+
}
27+
28+
outputs.dir(outputDirectory)
29+
}

0 commit comments

Comments
 (0)