bazelbuild / rules_scala

Scala rules for Bazel
Apache License 2.0
364 stars 275 forks source link

write an aspect to emit bloop configuration #915

Open johnynek opened 4 years ago

johnynek commented 4 years ago

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.

andyscott commented 4 years ago

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

yuriy-yarosh commented 4 years ago

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

psilospore commented 4 years ago

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?

ittaiz commented 4 years ago
  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"?
psilospore commented 4 years ago

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

ValdemarGr commented 4 years ago

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

johnynek commented 4 years ago

Summarized accurately in this issue AFAIK.

steveniemitz commented 2 years ago

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?