From daa6d947828b0f7243ef07bdd001c4e57317f4d1 Mon Sep 17 00:00:00 2001 From: CincyAndroiDeveloper <6299370+CincyAndroiDeveloper@users.noreply.github.com> Date: Tue, 17 Mar 2026 16:35:40 -0400 Subject: [PATCH 1/2] - Integrated Dokka for API documentation generation across the project. - Configured `dokka` in the root `build.gradle.kts` to aggregate documentation for `:kapacity` and `:kapacity-io` modules. - Added module-specific Dokka configurations for `kapacity` and `kapacity-io`, including source links to GitHub and README inclusions. - Created a GitHub Actions workflow to automatically generate and deploy Dokka HTML documentation to GitHub Pages on pushes to the `main` branch. --- .github/workflows/docs.yml | 54 ++++++++++++++++++++++++++++++++++++ build.gradle.kts | 20 +++++++++++++ kapacity-io/build.gradle.kts | 15 ++++++++++ kapacity/build.gradle.kts | 18 ++++++++++-- 4 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..a31ebbe --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,54 @@ +name: Deploy Dokka to GitHub Pages + +on: + # Only trigger this when code is merged into main + push: + branches: ["main"] + +# Grants the workflow permission to push to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Prevents multiple documentation deployments from running at the same time +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + deploy-docs: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + # We use macOS again to ensure the KMP project configures iOS targets successfully + runs-on: macos-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Java 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'zulu' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Generate Dokka HTML + run: ./gradlew dokkaGenerateHtml --no-configuration-cache + + - name: Setup GitHub Pages + uses: actions/configure-pages@v4 + + - name: Upload Documentation Artifact + uses: actions/upload-pages-artifact@v3 + with: + path: 'build/dokka/html' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 487f573..81c2dd6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier + plugins { // this is necessary to avoid the plugins to be loaded multiple times // in each subproject's classloader @@ -9,6 +11,24 @@ plugins { alias(libs.plugins.androidKotlinMultiplatformLibrary) apply false alias(libs.plugins.androidLint) apply false alias(libs.plugins.vanniktech.mavenPublish) apply false + id("org.jetbrains.dokka") version "2.1.0" +} + +dokka { + // Sets properties for the whole project + dokkaPublications.html { + moduleName.set("Kapacity Documentation") + includes.from("README.md") + } + + dokkaSourceSets.configureEach { + documentedVisibilities.set(setOf(VisibilityModifier.Public)) + } +} + +dependencies { + dokka(project(":kapacity")) + dokka(project(":kapacity-io")) } val projectGroup = project.findProperty("GROUP")?.toString() ?: "io.github.developrofthings" diff --git a/kapacity-io/build.gradle.kts b/kapacity-io/build.gradle.kts index c331fbb..7c262ae 100644 --- a/kapacity-io/build.gradle.kts +++ b/kapacity-io/build.gradle.kts @@ -2,6 +2,21 @@ plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.androidKotlinMultiplatformLibrary) alias(libs.plugins.androidLint) + id("org.jetbrains.dokka") +} + +dokka { + dokkaPublications.html { + moduleName.set("Kapacity IO") + includes.from("README.md") + } + dokkaSourceSets.configureEach { + sourceLink { + localDirectory.set(file("src/main/kotlin")) + remoteUrl("https://github.com/DeveloprOfThings/Kapacity/tree/main/kapacity-io") + remoteLineSuffix.set("#L") + } + } } kotlin { diff --git a/kapacity/build.gradle.kts b/kapacity/build.gradle.kts index 7e2d94b..1da6117 100644 --- a/kapacity/build.gradle.kts +++ b/kapacity/build.gradle.kts @@ -2,10 +2,25 @@ plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.androidKotlinMultiplatformLibrary) alias(libs.plugins.androidLint) + id("org.jetbrains.dokka") } -kotlin { +dokka { + dokkaPublications.html { + moduleName.set("Kapacity Core") + includes.from("README.md") + } + + dokkaSourceSets.configureEach { + sourceLink { + localDirectory.set(file("src/main/kotlin")) + remoteUrl("https://github.com/DeveloprOfThings/Kapacity/tree/main/kapacity") + remoteLineSuffix.set("#L") + } + } +} +kotlin { // Target declarations - add or remove as needed below. These define // which platforms this KMP module supports. // See: https://kotlinlang.org/docs/multiplatform-discover-project.html#targets @@ -96,5 +111,4 @@ kotlin { } } } - } \ No newline at end of file From e92082c36303eaaa940db4a3b1bc1ab850f8f471 Mon Sep 17 00:00:00 2001 From: CincyAndroiDeveloper <6299370+CincyAndroiDeveloper@users.noreply.github.com> Date: Wed, 18 Mar 2026 09:47:04 -0400 Subject: [PATCH 2/2] - Updated GitHub workflows to use Java 21 across `ci.yml`, `docs.yml`, and `publish.yml`. --- .github/workflows/ci.yml | 4 ++-- .github/workflows/docs.yml | 4 ++-- .github/workflows/publish.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7991dd..7503de0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,10 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Set up Java 17 + - name: Set up Java 21 uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'zulu' - name: Setup Gradle diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a31ebbe..52b76f2 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -29,10 +29,10 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Set up Java 17 + - name: Set up Java 21 uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'zulu' - name: Setup Gradle diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 425baf0..174448a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,10 +16,10 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Set up Java 17 + - name: Set up Java 21 uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'zulu' - name: Setup Gradle