rules_scala
rules_scala copied to clipboard
support for java_plugins within scala_library rules
The built in java_library rule has support for java_plugins by way of the plugins attribute. scala_library also has a plugins attribute but I believe its only intended for scalac plugins, as one would expect.
Since the scala rules support compiling both java and scala sources, has anyone here had experience with integrating java a annotation processor with scala rules. If not, does anyone here have pointers on where to look?
I have never done this. I know nothing about it.
Lol. I'll poke around the community.
Haven't been keeping a close eye on recent changes but it looks like javac is now invoked by the new java_common.compile api here (which is neat!). It looks like there's an interface for threading through javac plugins to the new common compile interface here but the 'plugins' argument isn't provided by the scala rules. I guess there'd need to be some way to capture that in thread it all the way through.
Sounds like it's simple a matter of adding another attribute (javac_plugins?) and passing it around. Note that currently you should probably support both strict deps off (default) and strict deps on since we're working hard on ironing the strict deps issues to make it the default and only one. You can see many examples in the e2e for reference.
On Tue, Oct 10, 2017 at 8:32 PM doug tangren [email protected] wrote:
Haven't been keeping a close eye on recent changes but it looks like javac is now invoked by the new java_common.compile api here https://github.com/bazelbuild/rules_scala/blob/master/scala/scala.bzl#L303 (which is neat!). It looks like there's an interface for threading through javac plugins to the new common compile interface here https://docs.bazel.build/versions/master/skylark/lib/java_common.html#compile but the 'plugins' argument isn't provided by the scala rules. I guess there'd need to be some way to capture that in thread it all the way through.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bazelbuild/rules_scala/issues/299#issuecomment-335549409, or mute the thread https://github.com/notifications/unsubscribe-auth/ABUIF61pQaNUBbq-ZZ0GcCy0QliwlxCBks5sq6oqgaJpZM4P0Rbn .
Sounds like it's simple a matter of adding another attribute (javac_plugins?) and passing it around
That'd be my guess.
I found another way to accomplish what I was trying to do so feel free to close this if you'd like. It may be helpful to leave it open as a trail for others to find if they run into a similar situation. I think adding and forwarding along javac_plugins could make for a nice beginner contributor task.
I'm good with keeping this open and we indeed want to have a much parity as we can with the java rules. Can you share how you solved your problem in case it will help others coming here?
On Tue, Oct 10, 2017 at 9:10 PM doug tangren [email protected] wrote:
Sounds like it's simple a matter of adding another attribute (javac_plugins?) and passing it around
That'd be my guess.
I found another way to accomplish what I was trying to do so feel free to close this if you'd like. It may be helpful to leave it open as a trail for others to find if they run into a similar situation. I think adding and forwarding along javac_plugins could make for a nice beginner contributor task.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/bazelbuild/rules_scala/issues/299#issuecomment-335560268, or mute the thread https://github.com/notifications/unsubscribe-auth/ABUIF8nT54Q_wEem2Bowm9ZLYQ-OY9-vks5sq7MogaJpZM4P0Rbn .
@softprops What was the workaround you tried ?
I punted for now
@subramaniamr the feature really looks simple to implement (mainly need an example of a plugin for the test).
As we said before it's about adding another attribute of java_plugins (default value of empty) and passing it to java_common.compile call (it doesn't pass it today which defaults to empty).
Production code wise we're talking about a few lines of code to change.
Any chance you're willing to send a PR for this?
I have a local version of the 'javac_plugins' working, will submit a PR , once we figure out our Corp policy for contributing back.
is there any way now to use java_plugins with scala_library?