Skip to content

Commit 98f8f6b

Browse files
authored
Add dokka to generate api reference docs (#1)
1 parent 4bb537f commit 98f8f6b

File tree

11 files changed

+712
-0
lines changed

11 files changed

+712
-0
lines changed

.github/workflows/docs.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ jobs:
2626
with:
2727
fetch-depth: 0
2828

29+
- name: Setup JDK
30+
uses: actions/setup-java@v4
31+
with:
32+
distribution: 'temurin'
33+
java-version: '17'
34+
35+
- uses: gradle/actions/setup-gradle@v4
36+
37+
- name: Generate API docs
38+
run: ./gradlew :dokkaGenerate
39+
2940
- name: Setup uv
3041
uses: astral-sh/setup-uv@v5
3142

.github/workflows/preview-docs.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- 'docs/**'
88
- 'mkdocs.yml'
99
- 'pyproject.toml'
10+
- '**/src/**/*.kt'
1011

1112
concurrency:
1213
group: gh-pages-deploy
@@ -25,6 +26,20 @@ jobs:
2526
steps:
2627
- uses: actions/checkout@v4
2728

29+
- name: Setup JDK
30+
if: github.event.action != 'closed'
31+
uses: actions/setup-java@v4
32+
with:
33+
distribution: 'temurin'
34+
java-version: '17'
35+
36+
- uses: gradle/actions/setup-gradle@v4
37+
if: github.event.action != 'closed'
38+
39+
- name: Generate API docs
40+
if: github.event.action != 'closed'
41+
run: ./gradlew :dokkaGenerate
42+
2843
- name: Setup uv
2944
if: github.event.action != 'closed'
3045
uses: astral-sh/setup-uv@v5

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,9 @@ replay_pid*
6565

6666
# Throwaway
6767
.throwaway/
68+
69+
# Generated API docs
70+
docs/api/
71+
72+
# MkDocs build
73+
site/

asyncresult-either/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins {
66
alias(libs.plugins.kotlin.multiplatform)
77
alias(libs.plugins.android.library)
88
alias(libs.plugins.mavenPublish)
9+
alias(libs.plugins.dokka)
910
}
1011

1112
kotlin {

asyncresult-test/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins {
66
alias(libs.plugins.kotlin.multiplatform)
77
alias(libs.plugins.android.library)
88
alias(libs.plugins.mavenPublish)
9+
alias(libs.plugins.dokka)
910
}
1011

1112
kotlin {

asyncresult/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins {
66
alias(libs.plugins.kotlin.multiplatform)
77
alias(libs.plugins.android.library)
88
alias(libs.plugins.mavenPublish)
9+
alias(libs.plugins.dokka)
910
}
1011

1112
kotlin {

build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ plugins {
1111
alias(libs.plugins.android.library) apply false
1212
alias(libs.plugins.mavenPublish) apply false
1313
alias(libs.plugins.spotless) apply false
14+
alias(libs.plugins.dokka)
15+
}
16+
17+
dokka {
18+
moduleName = "AsyncResult"
19+
dokkaPublications.html { outputDirectory = layout.projectDirectory.dir("docs/api") }
20+
}
21+
22+
dependencies {
23+
dokka(projects.asyncresult)
24+
dokka(projects.asyncresultEither)
25+
dokka(projects.asyncresultTest)
1426
}
1527

1628
allprojects {

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ org.gradle.parallel=true
44
org.gradle.configuration-cache.parallel=true
55
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m
66
kotlin.daemon.jvmargs=-Xmx2g
7+
8+
# Dokka V2 plugin mode
9+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
710
# Required to publish to Nexus (see https://github.com/gradle/gradle/issues/11308)
811
systemProp.org.gradle.internal.publish.checksums.insecure=true
912
# Increase timeout when pushing to Sonatype

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ assertk = "0.28.1"
55
arrow = "2.0.0"
66
android-gradle = "8.13.2"
77
ktfmt = "0.53"
8+
dokka = "2.0.0"
89

910
[libraries]
1011
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
@@ -18,3 +19,4 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
1819
android-library = { id = "com.android.library", version.ref = "android-gradle" }
1920
mavenPublish = "com.vanniktech.maven.publish:0.36.0"
2021
spotless = { id = "com.diffplug.spotless", version = "8.1.0" }
22+
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ nav:
2626
- 'Core API': core.md
2727
- 'Arrow Either': either.md
2828
- 'Testing': testing.md
29+
- 'API Reference': api/index.html
2930

3031
# Configuration
3132
theme:

0 commit comments

Comments
 (0)