dokka
dokka copied to clipboard
[K2] Support KMP projects
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
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.
KT-61371 has been implemented and merged into Kotlin, but there are more issues to be addressed, so we are still blocked.
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.
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)