rules_kotlin icon indicating copy to clipboard operation
rules_kotlin copied to clipboard

Kotlin annotation Processing

Open lswith opened this issue 8 years ago • 9 comments
trafficstars

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.

lswith avatar May 25 '17 05:05 lswith

Not at the moment, but great idea. Can you provide an example with gradle or similar how you are using it?

pcj avatar May 25 '17 13:05 pcj

here is an example of how they are using it with Dagger2 and java.

https://github.com/simonhorlick/bazel-dagger-example/

lswith avatar May 26 '17 00:05 lswith

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 avatar Jun 06 '17 14:06 plumpy

@plumpy any updates?

lswith avatar Jul 12 '17 04:07 lswith

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.

plumpy avatar Jul 14 '17 22:07 plumpy

Has anyone thought about this recently? I've yet to try but am spinning up a bazel kotlin project right now.

jgavris avatar Jul 11 '18 19:07 jgavris

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.

plumpy avatar Jul 11 '18 20:07 plumpy

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 avatar Jul 11 '18 20:07 jgavris

@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

Paul-McNeice avatar Jul 29 '18 13:07 Paul-McNeice