diff --git a/.github/workflows/callable.publish-javadoc.yml b/.github/workflows/callable.publish-javadoc.yml index 711e669..5d45976 100644 --- a/.github/workflows/callable.publish-javadoc.yml +++ b/.github/workflows/callable.publish-javadoc.yml @@ -1,12 +1,12 @@ -name: Publish javadoc (GitHub Pages) +name: Publish dokka (GitHub Pages) on: workflow_dispatch: workflow_call: jobs: - build_package_javadoc: - name: Generate Javadoc + build_package_dokka: + name: Generate Dokka runs-on: ubuntu-latest permissions: contents: write @@ -24,10 +24,13 @@ jobs: with: cache-read-only: true - - name: Generate javadoc (gradle) - run: ./gradlew javadoc +# - name: Generate javadoc (gradle) +# run: ./gradlew javadoc - - name: Conclude javadoc version and set env + - name: Generate dokka HTML documentation + run: ./gradlew dokkaHtmlMultiModule + + - name: Conclude dokka version and set env run: | if [[ "$GITHUB_REF" == "refs/heads/main" || "$GITHUB_REF" == "refs/heads/master" ]]; then echo "PUBLISH_VERSION=current" >> $GITHUB_ENV @@ -38,23 +41,23 @@ jobs: - name: Conclude library name and set env run: echo "LIBRARY_NAME=$(grep -o '^rootProject.name.*' settings.gradle.kts | sed -e 's/rootProject.name.*"\(.*\)"/\1/')" >> $GITHUB_ENV - - name: zip javadoc folder + - name: zip dokka folder env: LIBRARY_NAME: ${{ env.LIBRARY_NAME }} run: | - cd "vite-spring-webmvc/build/docs/javadoc" - zip -r ../../../../javadoc.zip . + cd "build/dokka/htmlMultiModule" + zip -r ../../../dokka.zip . - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: javadoc.zip - path: javadoc.zip + name: dokka.zip + path: dokka.zip - deploy_javadoc: + deploy_dokka: name: Deploy (GH Pages) runs-on: ubuntu-latest - needs: build_package_javadoc + needs: build_package_dokka permissions: contents: write steps: @@ -69,7 +72,7 @@ jobs: git fetch origin gh-pages || true git checkout gh-pages || git switch --orphan gh-pages - - name: Conclude javadoc version and set env + - name: Conclude dokka version and set env run: | if [[ "$GITHUB_REF" == "refs/heads/main" || "$GITHUB_REF" == "refs/heads/master" ]]; then echo "PUBLISH_VERSION=current" >> $GITHUB_ENV @@ -81,64 +84,64 @@ jobs: env: GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }} run: | - echo "

/$GITHUB_REPOSITORY_NAME/javadoc/

" > index.html + echo "

/$GITHUB_REPOSITORY_NAME/kdoc-api/

" > index.html - name: Download artifact from build job uses: actions/download-artifact@v4 with: - name: javadoc.zip + name: dokka.zip - - name: unzip javadoc folder + - name: unzip dokka folder env: PUBLISH_VERSION: ${{ env.PUBLISH_VERSION }} run: | - mkdir -p javadoc - rm -Rf "javadoc/$PUBLISH_VERSION" || true - unzip -d "javadoc/$PUBLISH_VERSION" javadoc.zip - rm javadoc.zip + mkdir -p kdoc-api + rm -Rf "kdoc-api/$PUBLISH_VERSION" || true + unzip -d "kdoc-api/$PUBLISH_VERSION" dokka.zip + rm dokka.zip - - name: Create javadoc index.html listing versions + - name: Create dokka index.html listing versions env: PUBLISH_VERSION: ${{ env.PUBLISH_VERSION }} GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }} run: | - mkdir -p javadoc - rm javadoc/index.html || true - touch javadoc/index.html + mkdir -p kdoc-api + rm kdoc-api/index.html || true + touch kdoc-api/index.html - versions=( $(cd javadoc && find . -maxdepth 1 -type d | jq -srR 'split("\n") | unique | .[][2:] | select(length > 0)') ) + versions=( $(cd kdoc-api && find . -maxdepth 1 -type d | jq -srR 'split("\n") | unique | .[][2:] | select(length > 0)') ) - echo "javadoc versions:" + echo "kdoc-api versions:" for value in "${versions[@]}" do echo "- $value" done - echo "" >> javadoc/index.html - echo "" >> javadoc/index.html - echo "" >> javadoc/index.html - echo " Javadoc | '$GITHUB_REPOSITORY_NAME'" >> javadoc/index.html - echo " " >> javadoc/index.html - echo " " >> javadoc/index.html - echo " " >> javadoc/index.html - echo " " >> javadoc/index.html - echo " " >> javadoc/index.html - echo "" >> javadoc/index.html - echo "" >> javadoc/index.html - echo "
" >> javadoc/index.html - echo "

Javadoc

" >> javadoc/index.html - echo "

Versions

" >> javadoc/index.html - echo " " >> kdoc-api/index.html + echo "
" >> kdoc-api/index.html + echo "" >> kdoc-api/index.html + echo "" >> kdoc-api/index.html - name: Commit files run: | @@ -146,7 +149,7 @@ jobs: git config --local user.name "GitHub Action" git add . git status - git diff-index --quiet HEAD || git commit -m "chore: updates index.html files incl. javadoc versions" + git diff-index --quiet HEAD || git commit -m "chore: updates index.html files incl. dokka versions" # Push changes - name: Push changes diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..6d0ee1c --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index e3184f0..8005737 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,6 +3,8 @@ import com.vanniktech.maven.publish.SonatypeHost plugins { `java-library` alias(libs.plugins.publish.maven) + alias(libs.plugins.dokka) + kotlin("jvm") version "2.0.0" apply false } description = "Java library for Vite integration." @@ -14,6 +16,20 @@ allprojects { } } +subprojects { + apply(plugin = "org.jetbrains.kotlin.jvm") + apply(plugin = "org.jetbrains.dokka") + + tasks.withType().configureEach { + dokkaSourceSets { + configureEach { + sourceRoots.from(file("src/main/java")) + } + } + } + +} + mavenPublishing { publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 20387ff..db63e61 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,9 +8,8 @@ jarkata_servlet_jsp = "4.0.0-M2" junit = "5.10.2" assertj = "3.26.0" testcontainers = "1.19.8" -publish_plugin = "2.0.0" publish_maven_plugin = "0.28.0" -release_plugin = "3.0.2" +dokka = "1.9.20" [libraries] junit = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" } @@ -34,6 +33,6 @@ testcontainers_junit = ["testcontainers", "testcontainers_junit5"] [plugins] spring_boot = { id = "org.springframework.boot", version.ref = "springframework_boot" } spring_dependency_management = { id = "io.spring.dependency-management", version.ref = "spring_dependency_management" } -publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "publish_plugin" } publish_maven = { id = "com.vanniktech.maven.publish", version.ref = "publish_maven_plugin" } -release = { id = "net.researchgate.release", version.ref = "release_plugin" } +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } + diff --git a/vite-spring-webmvc/build.gradle.kts b/vite-spring-webmvc/build.gradle.kts index 485a7db..e999115 100644 --- a/vite-spring-webmvc/build.gradle.kts +++ b/vite-spring-webmvc/build.gradle.kts @@ -25,6 +25,16 @@ dependencies { testImplementation(libs.junit) } +configurations.matching { it.name.startsWith("dokka") }.configureEach { + resolutionStrategy.eachDependency { + if (requested.group.startsWith("com.fasterxml.jackson")) { + // override jackson for Dokka as a workaround + // see: https://github.com/Kotlin/dokka/issues/3472 + useVersion("2.15.3") + } + } +} + tasks.named("test") { // Use JUnit Platform for unit tests. useJUnitPlatform()