Skip to content

Fix dokkaGenerate for Kotlin Multiplatform modules - #714

Merged
alexander-yevsyukov merged 4 commits into
masterfrom
fix-dokka-doc-generation
Jun 28, 2026
Merged

Fix dokkaGenerate for Kotlin Multiplatform modules#714
alexander-yevsyukov merged 4 commits into
masterfrom
fix-dokka-doc-generation

Conversation

@alexander-yevsyukov

@alexander-yevsyukov alexander-yevsyukov commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Problem

Under Dokka 2.2.0, ./gradlew dokkaGenerate fails for any repository that has
Kotlin Multiplatform modules (reproduced in SpineEventEngine/logging). Two distinct
issues combine:

  1. Version forcing leaks into Dokka's tool classpath. forceVersions() applies the
    project's version forcing and failOnVersionConflict() to every configuration,
    including Dokka's isolated dokka*GeneratorRuntimeResolver classpath. Dokka 2.2.0
    pins its own dependencies (e.g. jackson-*:2.15.3, kotlin-stdlib:2.0.21), which
    conflict with the project's forced versions (e.g. Jackson.bom 2.22.0):
    Could not resolve … Conflict found for module 'com.fasterxml.jackson…': between versions 2.22.0 and 2.15.3.

  2. The Dokka Javadoc format can't handle KMP source sets. The
    org.jetbrains.dokka-javadoc plugin's dokkaGeneratePublicationJavadoc task fails
    for every KMP module with No source set found for <module>/jvmMain.

Fix

  • DependencyResolution.forceVersions() — skip configurations whose name starts with
    dokka, leaving Dokka's own classpath to resolve as Dokka intends.
  • dokka-setup.gradle.kts — disable dokkaGeneratePublicationJavadoc for KMP modules
    (they publish HTML docs via htmlDocsJar).

Verification

Applied to SpineEventEngine/logging (which has many KMP modules): ./gradlew dokkaGenerate now completes successfully (it previously failed on :logging,
:context-tests, and every other KMP module).

🤖 Generated with Claude Code

Two issues break `dokkaGenerate` under Dokka 2.2.0:

- `forceVersions()` applied the project's version forcing (and
  `failOnVersionConflict()`) to Dokka's own generator/plugin configurations,
  conflicting with the versions Dokka pins (e.g. Jackson 2.15.3 vs the forced
  2.22.0). Skip configurations whose name starts with `dokka`.
- The `org.jetbrains.dokka-javadoc` format cannot resolve Kotlin Multiplatform
  source sets ("No source set found for <module>/jvmMain"), failing the Javadoc
  publication for every KMP module. KMP modules publish HTML docs, so disable the
  Javadoc publication task for them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alexander-yevsyukov alexander-yevsyukov moved this to 🏗 In progress in v2.0 Jun 27, 2026
@alexander-yevsyukov alexander-yevsyukov self-assigned this Jun 27, 2026
@alexander-yevsyukov alexander-yevsyukov changed the title Fix dokkaGenerate for Kotlin Multiplatform modules Fix dokkaGenerate for Kotlin Multiplatform modules Jun 27, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abd441818e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread buildSrc/src/main/kotlin/DependencyResolution.kt Outdated
alexander-yevsyukov added a commit to SpineEventEngine/logging that referenced this pull request Jun 27, 2026
Adopt the `buildSrc` fix from SpineEventEngine/config#714 so `dokkaGenerate`
(the "Check documentation" CI step) succeeds for this repo's KMP modules:

- `forceVersions()` skips Dokka's own generator/plugin configurations, which pin
  their own dependency versions (e.g. Jackson 2.15.3) and must not get the
  project's version forcing.
- the Dokka Javadoc publication is disabled for KMP modules (they publish HTML
  docs); its task cannot resolve KMP source sets.

This carries the fix ahead of the official `config` release. Once config#714
merges, re-pin the `config` submodule to master and re-sync `buildSrc` normally.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes ./gradlew dokkaGenerate failures under Dokka 2.2.0 in builds containing Kotlin Multiplatform (KMP) modules by preventing project-wide dependency version forcing from affecting Dokka’s isolated runtime classpath and by disabling the Dokka Javadoc publication task for KMP modules (which Dokka Javadoc format cannot handle).

Changes:

  • Excludes Dokka-owned dokka* configurations from forceVersions() to avoid dependency conflicts on Dokka generator/plugin classpaths.
  • Disables dokkaGeneratePublicationJavadoc when the Kotlin Multiplatform plugin is applied, avoiding the KMP source set resolution failure.
  • Updates copyright headers to 2026.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
buildSrc/src/main/kotlin/dokka-setup.gradle.kts Disables Dokka’s Javadoc publication task for KMP modules to avoid source set lookup failures.
buildSrc/src/main/kotlin/DependencyResolution.kt Skips version forcing / conflict-fail strategy for dokka* configurations so Dokka can resolve its pinned tool dependencies.

`kmp-module.gradle.kts` and `jvm-module.gradle.kts` each register their own
`configurations.all { … }` block that forces the project's Jackson (and other)
versions onto every configuration. Like `forceVersions()`, these must skip
Dokka's own `dokka…` configurations so Dokka keeps its pinned dependency
versions and `dokkaGenerate` does not break for KMP modules.

Addresses the review note on the incomplete exemption.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6cba9d4814

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread buildSrc/src/main/kotlin/DependencyResolution.kt Outdated

@armiol armiol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexander-yevsyukov I think Codex may have a point. Just in case, requesting the changes.

alexander-yevsyukov and others added 2 commits June 28, 2026 16:41
`BomsPlugin` still forced the project's Kotlin, StdLib, Coroutines, and
JUnit versions onto Dokka's own `dokka*` configurations, substituting them
on Dokka's isolated tool classpath — the remaining gap raised by Codex in
the review of this PR.

Extract the `dokka*` predicate into a single shared `Configuration.isDokka`
helper in `io.spine.dependency`, and route every version-forcing site
through it (`DependencyResolution`, `jvm-module`, `kmp-module`, and now
`BomsPlugin`), so the exemption can no longer be applied inconsistently.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alexander-yevsyukov

Copy link
Copy Markdown
Contributor Author

@armiol — pushed fd4a346 addressing Codex's remaining open point (P2).

BomsPlugin was still forcing the project's Kotlin / StdLib / Coroutines / JUnit versions onto Dokka's own dokka* classpath, so the exemption was incomplete. It now skips those configurations too. To stop this recurring, the dokka* predicate is centralized into a single shared Configuration.isDokka helper in io.spine.dependency, and every version-forcing site routes through it (DependencyResolution.forceVersions(), jvm-module, kmp-module, BomsPlugin).

Both Codex threads are resolved. Ready for another look.

@alexander-yevsyukov
alexander-yevsyukov merged commit 03e67ea into master Jun 28, 2026
3 checks passed
@alexander-yevsyukov
alexander-yevsyukov deleted the fix-dokka-doc-generation branch June 28, 2026 16:04
@github-project-automation github-project-automation Bot moved this from 🏗 In progress to ✅ Done in v2.0 Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants