Prohibit running Dokka in single-target multiplatform projects #3059
Labels
enhancement
An issue for a feature or an overall improvement
UX
An issue/PR related to the User Experience of using Dokka
As of 1.9.0, Kotlin doesn't officially support multiplatform projects with a single target, see KT-52664.
In turn, various Kotlin tools and subsystems, like the Kotlin Gradle Plugin, aren't taking such projects into consideration, which can lead to occasional differences in behaviour (compared to typical projects) or bugs.
Because Dokka depends on such tools and subsystems for auto-configuration and source code analysis, downstream bugs or changes in behaviour sometimes lead to what is perceived by the users as Dokka's bugs, when in reality Dokka has little to do with it.
Such bugs are unpredictable, surface as completely different problems at a glance, they are difficult to debug and, more importantly, are sometimes impossible or extremely difficult to fix on our end.
Related issues: #2679, #3038
Proposal
Instead of puzzling the users with obscure problems and wasting maintainers' time on debugging it, it makes sense to outright fail the build if Dokka is run in a single-target multiplatform project, with a short explanation and a link to this issue. Technically, it should not be difficult to do.
Optionally, it might make sense to add an environment variable that disables the check, in case the user wants to take their chances - at least they were warned.
Workarounds
It should be possible to add an artificial (empty) target to the source sets for generating documentation, which can also be toggled conditionally - for example, when Dokka's tasks are running. This way, the KGP and other tools should process the project as a typical and supported case, and Dokka should not experience any issues.
The text was updated successfully, but these errors were encountered: