github Kotlin/dokka v2.0.0
2.0.0

16 hours ago

Dokka 2.0.0 focuses on simplifying configuration and preparing for support of future Kotlin language features. Key highlights include:

  • Dokka Gradle Plugin v2: revamped Gradle plugin based on Dokkatoo.
  • Experimental K2 Analysis: support for K2 compiler frontend.
  • HTML Improvements: better accessibility and easier customization.

More details about each of the changes below. See Dokka 2.0.0 milestone for the list of all changes.

Dokka's Gradle plugin v2 based on Dokkatoo

Please check the migration guide for the update procedure and give feedback!

Dokka 2.0.0 introduces significant improvements to Dokka Gradle plugin, aligning more closely with Gradle best practices:

  • Adopts Gradle types, which leads to better performance.
  • Uses an intuitive top-level DSL configuration instead of a low-level task-based setup, which simplifies the build scripts and their readability.
  • Takes a more declarative approach to documentation aggregation, which makes multi-project documentation easier to manage.
  • Uses a type-safe plugin configuration, which improves the reliability and maintainability of your build scripts.
  • Fully supports Gradle configuration cache and build cache, which improves performance and simplifies build work.

Changes from Dokka 2.0.0-Beta

  • Forward Dokka Generator messages to Gradle logger (#3833)
  • Add deprecated property to help migrate from JSON Dokka plugin configuration (#3877)
  • Rename dokkaPublicationDirectory to basePublicationsDirectory (#3876)
  • Rename dokkaModuleDirectory, and mark as internal (#3880)
  • Update and add KDoc for DGPv2 (#3842)
  • Remove DokkaPluginParametersBuilder (#3872)
  • Increase default max heap of Worker to 2G (#3913)
  • Remove the dependency of dokkaGenerate on dokkaGenerateModule* (#3920)
  • KT-71784 Fix classpath for KMP shared source sets (#3942)
  • Fix DGP/KMP integration, so Dokka can 'see' code from shared source sets in target source sets (#3814)

Dokka's K2 analysis

Dokka 2.0.0 introduces K2 analysis, which is currently in an experimental stage. Dokka's K2 analysis leverages Kotlin's K2 compiler frontend for analysing code and uses the same shared Analysis API, which is used in IntelliJ IDEA’s K2 mode. The output with K2 analysis should mostly match that of K1 analysis, but there may be minor differences. We are actively working towards stabilizing K2 analysis and are planning to enable K2 analysis by default in future.

To opt in to Dokka's K2 analysis, add the following flag to your project's gradle.properties file:

org.jetbrains.dokka.experimental.tryK2=true

Known limitations:

We would greatly value your feedback if you encounter any of these limitations.

Potential differences between the outputs of K1 and K2:

While the output of K2 analysis aims to align with K1, there are some differences to be aware of:

  • Java synthetic properties: rendering may vary (details).
  • KDoc links: resolution and rendering differences (details).
  • Inconsistent documentable rendering order (#3590).
  • Enum entries: anonymous and overridden methods are no longer rendered (#3129).
  • Other differences may arise due to variations in type inference between K1 and K2.

HTML format

Dokka 2.0.0 introduces some changes to HTML output. We updated the structure of some elements and classes, particularly in the navigation and sidebar, to improve accessibility and simplify maintenance. These changes only affect you if you previously customized Dokka styles.

  • We removed redundant wrappers like navigation--inner and navigation-title.
  • We reworked blocks such as versions-dropdown to make them more accessible.
  • We renamed classes like navigation-controls--homepage to improve consistency. For example, it’s now called navigation-controls--btn_homepage.

For more information, see the pull request.

The easiest way to update your current templates is to adjust the new templates to your needs.

Bugfixes

  • Fix merging expect-actual declarations (#3875)

Other changes

  • Update the external link URL for stdlib (#3938)

Feedback

We would appreciate your feedback!

Full Changelog: v1.9.20...v2.0.0

Don't miss a new dokka release

NewReleases is sending notifications on new releases.