dokka icon indicating copy to clipboard operation
dokka copied to clipboard

[K2] Support KMP projects

Open vmishenev opened this issue 1 year ago • 5 comments

This issue is part of a larger issue: Migrate Dokka's analysis to K2 compiler (#2888).

Goal

Dokka should be able to generate documentation for all Kotlin Multiplatform projects.

That includes, but not limited to:

  • Projects that use 3rd party klib libraries.
  • Projects that use platform/native types provided by Kotlin by default (like CVariable)
  • Projects that use cintrop to generate bindings for an arbitrary local library.
  • Projects that have non-stable targets such as Kotlin/Wasm.

The documentation generated for such projects by K1 and K2 analyses should not have significant and breaking differences.

Sub-tasks

  • [x] #3114
  • [x] #3189
  • [x] https://github.com/Kotlin/dokka/issues/3360
  • [x] https://github.com/Kotlin/dokka/issues/3377
  • [ ] https://github.com/Kotlin/dokka/issues/3386
  • [x] https://github.com/Kotlin/dokka/issues/3381
  • [x] https://github.com/Kotlin/dokka/issues/3380
  • [x] https://github.com/Kotlin/dokka/issues/3379
  • [x] https://github.com/Kotlin/dokka/issues/3378

Upstream issues

vmishenev avatar Aug 21 '23 19:08 vmishenev

Current status

The analysis of multiplatform (.klib ) libraries cannot be implemented due to the needed K2 API being only partially implemented.

Blocking issue: KT-61371 - Analysis API standalone: register compiler symbol provider for libraries in standalone mode

Blocking issue's due date: around the release of Kotlin 1.9.20. It's unlikely that the fix we need will be part of Kotlin 1.9.20 itself, but it should be out at around that time, so we'll likely have to depend on a -dev artifact of either 1.9.20 (if it's backported into a custom branch) or of whatever the next version is going to be.

IgnatBeresnev avatar Aug 24 '23 17:08 IgnatBeresnev

KT-61371 has been implemented and merged into Kotlin, but there are more issues to be addressed, so we are still blocked.

IgnatBeresnev avatar Sep 22 '23 12:09 IgnatBeresnev

After KT-61371 is fixed, KT-62244 should be addressed.

vmishenev avatar Oct 02 '23 12:10 vmishenev

KT-62244 is fixed, but new issues have been discovered. The meta issue for them is KT-62696

vmishenev avatar Oct 20 '23 11:10 vmishenev

Current status

Since a number of upstream blocking issues were fixed, Dokka is now able to generate documentation for a subset of KMP projects, albeit with limitations and bugs.

While regression testing Kotlin/JVM projects for #3140, we were able to spend some time on testing KMP projects, and found issues that we weren't aware of before. I've updated the subtasks of this issue based on the findings.

IgnatBeresnev avatar Dec 12 '23 20:12 IgnatBeresnev

Current status

#3386 generally does not work for K1 as well.

Most kotlinx libraries can be built with Dokka K2 successfully.

Open issues specific to KMP:

  • #3702
  • #3701 and #3373
  • #3751
  • #3685 (should be fixed by Java-Kotlin interop)

vmishenev avatar Aug 19 '24 15:08 vmishenev