From a01b55e62ad9857a493b50d8f330d6fa8fd4aa6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Kozak?= Date: Mon, 10 Aug 2026 11:07:24 +0200 Subject: [PATCH 1/2] Generate and publish KDoc/API docs via Dokka + GitHub Pages Aggregates KDoc from core and plugin into a single Dokka HTML site, built and deployed to GitHub Pages on every push to master. Also lets core's javadoc jar be auto-derived from Dokka instead of staying empty. --- .github/workflows/docs.yml | 48 ++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ build.gradle.kts | 15 ++++++++++++ core/build.gradle.kts | 13 +++++++++++ plugin/build.gradle.kts | 13 +++++++++++ 5 files changed, 91 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..3d60578a --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,48 @@ +name: Docs + +on: + push: + branches: [ master ] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - uses: gradle/actions/setup-gradle@v4 + + - name: Generate API docs + run: ./gradlew :dokkaGenerate + + - uses: actions/upload-pages-artifact@v3 + with: + path: build/dokka + + deploy: + needs: build + runs-on: ubuntu-latest + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index fd51463f..dae1ff28 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ A Gradle plugin that generates type-safe Kotlin [Ktor](https://ktor.io/) client code from OpenAPI 3.0 specifications. +API documentation: https://avsystem.github.io/justworks/ + ## Installation Add the plugin to your `build.gradle.kts`: diff --git a/build.gradle.kts b/build.gradle.kts index 3dd8b0ec..16df4513 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,6 +5,7 @@ plugins { id("org.jlleitschuh.gradle.ktlint") version "14.2.0" apply false id("org.jetbrains.kotlinx.kover") version "0.9.9" apply false id("com.vanniktech.maven.publish") version "0.37.0" apply false + id("org.jetbrains.dokka") version "2.2.0" } allprojects { @@ -63,3 +64,17 @@ subprojects { } } } + +dependencies { + dokka(project(":core")) + dokka(project(":plugin")) +} + +dokka { + moduleName.set("justworks") + + dokkaPublications.html { + outputDirectory.set(layout.buildDirectory.dir("dokka")) + includes.from("README.md") + } +} diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 8e1ef4d4..ebde82db 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -4,12 +4,25 @@ plugins { kotlin("jvm") id("org.jetbrains.kotlinx.kover") id("com.vanniktech.maven.publish") + id("org.jetbrains.dokka") version "2.2.0" } kotlin { jvmToolchain(21) } +dokka { + moduleName.set("justworks-core") + + dokkaSourceSets.main { + sourceLink { + localDirectory.set(file("src/main/kotlin")) + remoteUrl("https://github.com/AVSystem/justworks/tree/master/core/src/main/kotlin") + remoteLineSuffix.set("#L") + } + } +} + // todo: remove when https://github.com/JLLeitschuh/ktlint-gradle/issues/912 resolved ktlint { version = "1.8.0" diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 6119aac0..431d47f7 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -6,12 +6,25 @@ plugins { `java-gradle-plugin` id("com.vanniktech.maven.publish") id("org.jetbrains.kotlinx.kover") + id("org.jetbrains.dokka") version "2.2.0" } kotlin { jvmToolchain(21) } +dokka { + moduleName.set("justworks-plugin") + + dokkaSourceSets.main { + sourceLink { + localDirectory.set(file("src/main/kotlin")) + remoteUrl("https://github.com/AVSystem/justworks/tree/master/plugin/src/main/kotlin") + remoteLineSuffix.set("#L") + } + } +} + dependencies { implementation(project(":core")) testImplementation(kotlin("test")) From 88c52c6bb1e309dc1df0e39c6b14e2e0cd45ac7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Kozak?= Date: Wed, 14 Oct 2026 14:05:50 +0200 Subject: [PATCH 2/2] docs: address review comments on Dokka setup and CI Co-authored-by: Junie --- .github/workflows/ci.yml | 3 +++ core/build.gradle.kts | 2 +- plugin/build.gradle.kts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f80c66db..af82b31e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,9 @@ jobs: - name: Run tests with coverage run: ./gradlew core:koverXmlReport plugin:koverXmlReport + - name: Generate API docs + run: ./gradlew :dokkaGenerate :core:dokkaJavadocJar + - name: Upload coverage to Codecov if: github.event_name == 'pull_request' uses: codecov/codecov-action@v5 diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 996d9ef5..347ce061 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -4,7 +4,7 @@ plugins { kotlin("jvm") id("org.jetbrains.kotlinx.kover") id("com.vanniktech.maven.publish") - id("org.jetbrains.dokka") version "2.2.0" + id("org.jetbrains.dokka") } kotlin { diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 431d47f7..c80b35de 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -6,7 +6,7 @@ plugins { `java-gradle-plugin` id("com.vanniktech.maven.publish") id("org.jetbrains.kotlinx.kover") - id("org.jetbrains.dokka") version "2.2.0" + id("org.jetbrains.dokka") } kotlin {