How good is the current support for Kotlin Multipl...
# bazel
s
How good is the current support for Kotlin Multiplatform in Bazel? Currently I'm using Gradle, and there is a wall as to how man modules you can reasonably have.
6
d
I also find it really annoying having to write so much code in Gradle just to create a module with a single class
s
I love gradle. It just doesn't scale well to hundreds of multiplatform modules
👍🏻 1
l
It's been a year and a half since this question was posted. Do we have any updates on it since then?
e
I don't consider myself a Kotlin expert, but do spend quite a bit of time in the Bazel space and am working on a Kotlin/Android project. I'll do my best: •
rules_jvm_external
, which is the de-facto way of resolving Maven dependencies, does not really yet understand KMP. This mostly means you should expect to manually list out coordinates for various platform-specific libraries. It's more an annoyance than a blocker. • There exist no open source rules that leverage
kotlin-native
to build i.e. Apple/Windows apps. There are companies that have their own rules that do, and I don't think are that hard to make if you are familiar with rule writing.
s
If anything, the bazel support has gotten worse as the bazel engineers removed kotlin JS support due to the change in library format
e
What platforms is kotlin-js typically used for w/KMP?
s
Node and web
Anywhere js can run
e
I bet it wouldn't take much to bring it back. Seems nobody noticed Shea's volunteer to maintain it https://github.com/bazelbuild/rules_kotlin/pull/1185#issuecomment-2364994631
s
Yeah, that's a dead thread. He would do better to submit a pr
👍 1
👍🏻 1
s
Absolutely brutal. Forced the Walt Disney Company to have to migrate multiple projects off Bazel to Gradle.
Lack of better official support for Kotlin in build tools outside of Gradle is an enormous problem, and completely incomprehensible to me given Google’s endorsement of Kotlin for Android and Google’s use of Blaze/Bazel.
sad panda 2
s
With regards to external dependency support for KMP, I landed gradle resolver support (it's still somewhat experimental in terms of performance but works well) with
rules_jvm_external
https://github.com/bazel-contrib/rules_jvm_external/pull/1357 so we should be able to resolve KMP artifacts automatically for different platforms with gradle metadata with a small amount of follow-up work (right now it'll resolve JVM as the default platform and we need to request explicit variant attributes for other platforms). I am going to look into adding that next and then look into adding back JS support in the rules (assuming there's no one else looking into it).