rules_scala
rules_scala copied to clipboard
write an aspect to emit bloop configuration
see:
https://scalacenter.github.io/bloop/docs/configuration-format
If we had an aspect similar to the one for intelliJ, we could use metals with rules_scala, which would be nice for many users.
This doesn't seem very hard to do based on a quick look at the configuration file.
I gave this a go months ago and my takeaway was that it should be done using bazel query output instead of an aspect. I forget my exact reasoning.
https://github.com/andyscott/rules_bloop
There was a bloop extension made by @psilospore already. I'll be reviewing it and maybe make a PR soon(-ish).
Just to clarify I have a WIP to create a phase to compile as an optional alternative to the built in compile phase motivated by this blog post: https://jorge.vican.me/posts/integrate-bloop-with-bazel-and-pants.html
At the moment I am attempting to achieve this by:
- Creating a bloop config file for each target
- Sending a BSP request to compile the target
- (in progress right now) generate the outputs that the compile phase normally returns:
return struct(
class_jar = ...,
coverage = ...,
full_jars = ...,
ijar = ...,
ijars = ...,
rjars = ...,
java_jar = ...,
source_jars = ...,
merged_provider = ...,
)
It seems like part of that could be reused. I'm pretty new to some of this stuff but could the part to generate the bloop config just be a final phase?
- I hope to simplify and cleanup return values of phases in the next few days. For example I'm fairly certain I can simplify
compile
to only return theexternal_providers
and have others use theJavaInfo
and coverage providers for their needs. - When you say
generate the bloop config just be a final phase
what do you mean by "final phase"?
Related draft PR here: https://github.com/bazelbuild/rules_scala/pull/997
What is the status of this?
Edit:
For anyone in need of a bloop config, until this is ready, I wrote a very hacky shell and python script to generate bloop configs (compatible with rules_jvm_external
) https://gist.github.com/ValdemarGr/fbf2f574d12da0c23513b581d095154f
Summarized accurately in this issue AFAIK.
We recently just landed something like this in bazel-bsp, it can export a set of bloop projects given a set of bazel targets.
Not exactly the same thing but similar?