Skip to content

Experimental resolution of dependencies in Kotlin multiplatform projects (Gradle) #377

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

Merged
merged 2 commits into from
Aug 12, 2022

Conversation

themkat
Copy link
Collaborator

@themkat themkat commented Aug 1, 2022

Implements basic dependency resolution for Kotlin multiplatform projects using Gradle, though a bit flawed (see below). Multiplatform projects have a bit of a different structure than what we are used to in regular projects. In one folder (and build.gradle file) there can be several targets. You can read more on that here.

Have tried a few different projects, mainly (found in #376):
https://github.com/ktorio/ktor-samples/tree/main/chat

Seem to work pretty good, but I see one possible issue:

  • The language server does not separate between the different targets, so it will just resolve the dependencies for all of them. That means a frontend target will get completions with dependencies of the backend target and so on. This is because the language server works on a gradle module basis, and not on a Kotlin multiplatform target basis. This would have to be rewritten to work properly, and I think this might be a lot of work. I still think some flawed support is way better than people getting tons of errors. Now they can at least work with external dependencies in those projects (no errors, and completions work) 🙂 Feel free to disagree.

@themkat themkat changed the title Experimental resolution of dependencies in Kotlin multiplatform projects Experimental resolution of dependencies in Kotlin multiplatform projects (Gradle) Aug 1, 2022
@fwcd
Copy link
Owner

fwcd commented Aug 4, 2022

Interesting, I haven't tested KLS with anything outside of Kotlin/JVM, but improving support for multiplatform definitely sounds useful! Perhaps this would even move us a bit closer to #11

@fwcd fwcd added enhancement New feature or request dependency resolution Related to the project dependency/standard library resolver gradle Related to the language server's support for Gradle projects labels Aug 4, 2022
Copy link
Owner

@fwcd fwcd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, eventually my hope is to progress on #85 so we don't need any custom Gradle scripts at all, but for now this looks like a good solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency resolution Related to the project dependency/standard library resolver enhancement New feature or request gradle Related to the language server's support for Gradle projects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants