rules_kotlin
rules_kotlin copied to clipboard
Kotlin annotation Processing
Is there any support for something similar to the java_plugin rule? I would like to use kotlin with dagger2 and require that the kotlin rules plug in to the kapt functionality.
Not at the moment, but great idea. Can you provide an example with gradle or similar how you are using it?
here is an example of how they are using it with Dagger2 and java.
https://github.com/simonhorlick/bazel-dagger-example/
I'm working on this, but it'll require a patch to Bazel (and then a Bazel release). Right now you can't access the exported_plugins of a java_library from skylark.
@plumpy any updates?
I believe bazelbuild/bazel@c00ec98 adds the info needed to make this work. I'll see if I can carve out some time to figure out how to apply that to the kotlin rules. You won't really be able to use it until that commit ships in (presumably) Bazel 0.6.0.
Has anyone thought about this recently? I've yet to try but am spinning up a bazel kotlin project right now.
jgarvis: Bazel has official Kotlin rules now: https://github.com/bazelbuild/rules_kotlin
I haven't used them personally, but I believe they support annotation processors.
I was reading this and assuming I'd have to do a fair amount of legwork to use those rules on android.
https://github.com/bazelbuild/rules_kotlin/issues/58#issuecomment-401435035
@jgavris I'm in the same spot as you are right now.
This issue https://github.com/bazelbuild/bazel/issues/5691 was raised by one of the guys that maintains the offical rules_kotlin repo so it sounds like they're working on it at the moment.
I'm just hanging tight for a while to see what happens. By the time I've figured out how to write the macros needed they'll probably already be available...
I think part of the delay is that they're migrating the native android rules out of core Bazel repo into this one (as skylark rules) https://github.com/bazelbuild/rules_android
I guess once that's done the android_binary rule will be easier to extend to accept kotlin code as a dependency