diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f80c66d..af82b31 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/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..3d60578 --- /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 97408e4..75644ff 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 5f447ed..8cbe10a 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 a58fc64..347ce06 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") } 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 6119aac..c80b35d 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") } 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"))