Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prohibit running Dokka in single-target multiplatform projects #3059

Open
IgnatBeresnev opened this issue Jul 4, 2023 · 1 comment
Open
Labels
enhancement An issue for a feature or an overall improvement UX An issue/PR related to the User Experience of using Dokka

Comments

@IgnatBeresnev
Copy link
Member

IgnatBeresnev commented Jul 4, 2023

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.

@IgnatBeresnev IgnatBeresnev added enhancement An issue for a feature or an overall improvement UX An issue/PR related to the User Experience of using Dokka labels Jul 4, 2023
@CLOVIS-AI
Copy link
Contributor

How does this modification fit with the deprecation of the Kotlin/JS Gradle plugin? The Kotlin website recommends creating a kotlin("multiplatform") project with a single JS target, but this issue would make Dokka incompatible with this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An issue for a feature or an overall improvement UX An issue/PR related to the User Experience of using Dokka
Projects
None yet
Development

No branches or pull requests

2 participants