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

Migrate Gradle runner's classpath resolution to stable API #3121

Closed
IgnatBeresnev opened this issue Aug 15, 2023 · 2 comments
Closed

Migrate Gradle runner's classpath resolution to stable API #3121

IgnatBeresnev opened this issue Aug 15, 2023 · 2 comments
Assignees
Labels
enhancement An issue for a feature or an overall improvement runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin

Comments

@IgnatBeresnev
Copy link
Member

IgnatBeresnev commented Aug 15, 2023

Background

In order to generate documentation for a project, the Gradle runner must first resolve the classpath of that project, which must include dependencies and platform types.

Dokka uses Kotlin Gradle Plugin's API to extract the information about targets, source sets and compilations of any given project. It uses this information to resolve the classpath, which gets passed to the analysis.

The problem

For historical reasons, the Gradle runner relies on some low-level, undocumented, non-stable and/or internal KGP API for classpath and compilation resolution, which leads to compatibility problems almost every Kotlin release.

This means that when a user migrates to a new version of Kotlin (by updating the version of KGP), they might see errors when running Dokka's tasks (examples: #3038, #3068). From the user's perspective, it's a bug/regression of Dokka, but in reality something was changed internally in KGP (either intentionally or not), or the API used by Dokka got deprecated/removed, and it now leads to errors.

This is a major issue for the following reasons:

  • it blocks Kotlin version updates in some libraries
  • it takes a significant amount of our time to hunt these errors/bugs down and find substitutions
  • it affects the Kotlin Multiplatform team as it imposes restrictions on the changes they would like to make (i.e they cannot delete the API which would break Dokka), and it takes their time to help us with debugging and finding solutions to emerging problems

Possible solution

IDEs need similar information as Dokka to perform source code analysis: they need to resolve project files, dependencies and platform types. For this, KGP already provides some high-level and stable API, which is tested and is looked after by the Kotlin Multiplatform team.

Migrating to the mentioned API for IDEs should resolve the majority of the problems outlined in this issue, as Dokka will not have to think about backward compatibility, and the following principle will apply: "If it is resolved by your IDE, it will be resolved by Dokka".


This issue is a subtask of Sustainability of dependencies (#3127)

@IgnatBeresnev IgnatBeresnev added enhancement An issue for a feature or an overall improvement runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin labels Aug 15, 2023
@IgnatBeresnev IgnatBeresnev added this to the Gradle runner 2.0 milestone Aug 15, 2023
@IgnatBeresnev
Copy link
Member Author

Might resolve: #2599

@IgnatBeresnev
Copy link
Member Author

We've agreed that the new Dokka Gradle plugin will be developed and maintained by the Kotlin Build Tooling team (the same team that develops KGP), so I guess this issue has been resolved in one way or another :)

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 runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin
Projects
None yet
Development

No branches or pull requests

1 participant