rules_scala icon indicating copy to clipboard operation
rules_scala copied to clipboard

write an aspect to emit bloop configuration

Open johnynek opened this issue 4 years ago • 8 comments

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.

johnynek avatar Jan 14 '20 22:01 johnynek

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

andyscott avatar Jan 24 '20 07:01 andyscott

There was a bloop extension made by @psilospore already. I'll be reviewing it and maybe make a PR soon(-ish).

yuriy-yarosh avatar Jan 25 '20 18:01 yuriy-yarosh

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:

  1. Creating a bloop config file for each target
  2. Sending a BSP request to compile the target
  3. (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?

psilospore avatar Jan 25 '20 18:01 psilospore

  1. 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 the external_providers and have others use the JavaInfo and coverage providers for their needs.
  2. When you say generate the bloop config just be a final phase what do you mean by "final phase"?

ittaiz avatar Jan 25 '20 19:01 ittaiz

Related draft PR here: https://github.com/bazelbuild/rules_scala/pull/997

psilospore avatar Feb 11 '20 20:02 psilospore

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

ValdemarGr avatar Oct 06 '20 21:10 ValdemarGr

Summarized accurately in this issue AFAIK.

johnynek avatar Oct 06 '20 21:10 johnynek

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?

steveniemitz avatar Jul 08 '22 19:07 steveniemitz