diff --git a/.github/workflows/dokka-gh-pages.yml b/.github/workflows/dokka-gh-pages.yml new file mode 100644 index 0000000..53c853c --- /dev/null +++ b/.github/workflows/dokka-gh-pages.yml @@ -0,0 +1,61 @@ +name: Deploy the API documentation to GitHub Pages with Dokka + +on: + push: + branches: [ "plugins-release" ] + pull_request: + branches: [ "plugins-release" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: "8" + distribution: "temurin" + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Build the distribution with Gradle Wrapper + run: ./gradlew :dokkaGeneratePublicationHtml + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build/dokka/html/ + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/build.gradle.kts b/build.gradle.kts index f2ba312..8259f79 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,15 @@ tasks.wrapper { distributionType = Wrapper.DistributionType.ALL } +plugins { + id("org.jetbrains.dokka") +} + +// workaround for https://github.com/Kotlin/dokka/issues/3903 from https://github.com/Kotlin/dokka/issues/2260 TODO remove when it's fixed +repositories { + mavenCentral() +} + evaluationDependsOnChildren() task("publishPluginProjectPlugins") { group = "plugin portal" @@ -9,3 +18,17 @@ task("publishPluginProjectPlugins") { val pluginProjects = subprojects.filter { it.name.endsWith("plugins") } pluginProjects.forEach { dependsOn(it.tasks.named("publishPlugins")) } } + + +dependencies { + /* + "common-gradle-dependencies" not added because it's published in a separate branch + "huanshankeji-team-gradle-plugins" not added because it's renamed and more cumbersome to configure, and also because it's only used by us + */ + listOf( + "kotlin-common-gradle-plugins", + "architecture-common-gradle-plugins", + ).forEach { + dokka(project(":$it")) + } +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 6b5e030..db36dd1 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -38,4 +38,6 @@ dependencies { // This is also a bootstrapping dependency. implementation("com.huanshankeji:common-gradle-dependencies:0.7.1-20240314-boostrap") { exclude("org.jetbrains.kotlin") } */ + + implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.0.0-Beta") } diff --git a/buildSrc/src/main/kotlin/aligned-version-plugin-conventions.gradle.kts b/buildSrc/src/main/kotlin/aligned-version-plugin-conventions.gradle.kts index b8b0bbe..93ac02b 100644 --- a/buildSrc/src/main/kotlin/aligned-version-plugin-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/aligned-version-plugin-conventions.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask plugins { id("conventions") + id("dokka-convention") } version = alignedPluginVersion diff --git a/buildSrc/src/main/kotlin/dokka-convention.gradle.kts b/buildSrc/src/main/kotlin/dokka-convention.gradle.kts new file mode 100644 index 0000000..ac6e6ac --- /dev/null +++ b/buildSrc/src/main/kotlin/dokka-convention.gradle.kts @@ -0,0 +1,12 @@ +plugins { + id("org.jetbrains.dokka") +} + +dokka { + dokkaSourceSets.all { + sourceLink { + remoteUrl("https://github.com/huanshankeji/gradle-common/tree/v${version}/${project.name}") + remoteLineSuffix.set("#L") + } + } +} diff --git a/gradle.properties b/gradle.properties index 6e2c210..860f258 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,3 +2,5 @@ #kotlin.mpp.stability.nowarn=true # More memory is needed to build "architecture-common-gradle-plugins" since Kotlin 2.0.0 org.gradle.jvmargs=-Xmx2G +# for Dokka +org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled