Comments (6)
can you give some links here? There are plugins for the scala compiler you mean?
from rules_scala.
can't you use scalaopts
https://github.com/bazelbuild/rules_scala/blob/master/scala/scala.bzl#L274
and pass -Psomeplugin:opts
?
from rules_scala.
http://bazel.io/docs/be/java.html#java_plugin
https://github.com/google/auto/tree/master/service
It's actually java annotation processing. And, yeah, scala and java have different concepts of annotation plugins.
In this particular case, I think it'd be possible to add a javac step to make things work though that won't work for other annotation processors / plugins.
I might be able to play with this in a couple of weeks ...
from rules_scala.
from what I can see, those have to be applied with javac. I guess if you have the annotation in scope when you compile, scalac won't complain, then you need a step where javac is called on the resulting jar with the plugin and I guess a new jar is produced?
from rules_scala.
Okay, I've looked into this a bit more. I created this issue before I really understood how JSR 269 annotation processing works.
It is possible to do this, along the lines of what you mention: the only diff is you have to explode the jar and pass all the classes to javac
, along with -proc:only
, rather than pass in the intact jar.
But that seems like it's going too far. This isn't a bazel issue, it's a java vs. scala issue. And if we did this, it would only work for this one kind of annotation processing, since arbitrary JSR 269 annotation processors can do things that wouldn't work for this.
I think the right answer is to just create a native java class. In my case, I just extend a scala class, e.g.,
@AutoService(Configurator.class)
public class JavaLogbackConfigurator extends LogbackConfigurator {}
This seems like a perfectly reasonable approach.
It's a little kludgy right now since we have to do the java_import
trampoline to get scala libraries into java builds but there's another issue for that ...
from rules_scala.
ok. So this adds to the need to solve #18
from rules_scala.
Related Issues (20)
- Upgrade CI tests to use Bazel 6 HOT 2
- rules_scala cause IJ plugin failures with Bazel@HEAD
- Support for specifying test classes and/or test cases when using junit tests HOT 4
- warning: [path] bad path element
- [Scala 2.13.12] Issue with scala.tools.nsc.reporters.Reporter when compiling
- FYI - Discussion for SIP-51: drop 2.13 library forwards binary compatibility
- rules_scala support for JDK 21 HOT 42
- Add add_opens and add_exports support HOT 1
- Scalafmt fails with Build without the bytes HOT 20
- Support Scala 3.3.1
- SemanticdbInfo.plugin_jar should be File not string HOT 2
- coverage creates the offline.jar into same directory for tests with different directories
- Bazel 7 - scala_proto_aspect rule must declare '@@bazel_tools//tools/jdk:toolchain_type' toolchain in order to use java_common HOT 1
- Can't run a bazel executable within bazel on Windows HOT 10
- javacopts order differs from java_library
- strict_deps_mode = error complains about dependencies that aren't referenced HOT 3
- use newer version of scalafmt
- How to set JVM version? rules_scala keeps insisting on using Java 11 HOT 1
- Unreadable test result
- test_scala_proto_server test is flaky on MacOS CI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_scala.