-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add Kotlin support #120
base: develop
Are you sure you want to change the base?
Add Kotlin support #120
Conversation
@@ -109,17 +122,49 @@ private List<String> getBuildTargetTags(boolean hasTests) { | |||
return tags; | |||
} | |||
|
|||
private void setJvmBuildTarget(GradleSourceSet sourceSet, BuildTarget bt) { | |||
private void setBuildTarget(GradleSourceSet sourceSet, BuildTarget bt) { | |||
if (sourceSet.isKotlin()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a source set applies kotlin, scala & java plugins, then which one should be returned as the data of the build target?
I've not idea about this. I asked this question in the BSP discord channel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've no idea either. I doubt it's possible. I think that both the Scala and Kotlin plugins are Java aware and able to mix in their languages with Java so you could have Java classes referencing Scala classes and vice versa in the same project. But neither plugin is aware of the other language so Scala wouldn't know what to do with Kotlin and Kotlin wouldn't know what to do with Scala. Happy to be corrected on this but I think the code would have to be in separate projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Searched in google and found that there are some people doing that: https://discuss.gradle.org/t/kotlin-groovy-and-java-compilation/14903/8.
But I guess that's a very rare case.
Update:
Looks like BSP team is targeting to address this in 3.0: build-server-protocol/build-server-protocol#487
Basically, allowing multiple build target data.
rebased |
Adds Kotlin support.
I don't use Kotlin but I thought it would be good to get support for a few languages to help decide on best design for handling multiple languages.
BSP spec is not finalised for Kotlin. See here. I've no idea about how to setup
associates
in a Gradle build so I've ignored it.Kotlin plugin doesn't seem to be part of Gradle so everything here is done with reflection - I guess you could add the Kotlin library into the
plugin
project if you don't want to use reflection.Up to you if you want to merge. I could change this to a draft PR.