bazelbuild / rules_scala

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

Allow users to configure `buildijar` value when building a scala library #1582

Open ladinu opened 4 months ago

ladinu commented 4 months ago

Description

Allow users to configure buildijar value when building a library

Motivation

I'm generating some Scala code and compiling them as a library. But IntelliJ is failing to detect the sources of the library. When I turn off build_ijar, I'm able to view sources.

crt-31 commented 4 months ago

I'm not opposed to the setting necessarily, but for the use case the OP describes: My understanding is that IntelliJ is using bazel-bsp to incorperate bazel into their IDE. I would think it would be more proper for bazel-bsp to be the ones that do the source-jar / ijar mapping, they should have or be able to get the information. If you do it in scala_library, you would lose some of the benefits of the ijar.

ladinu commented 4 months ago

@crt-31 I agree that it makes more sense for bazel-bsp to handle ijar -> source-jar mapping. I don't know what it would take to get it working there though. Since I'm only enabling this for generated scala code, I don't think I'll miss out on any of the benefits provided by the ijar.

But I think having this setting is reasonable. It should ultimately be up to the user as to how they want to configure their scala library.

ladinu commented 3 months ago

@liucijus @simuons Any opposition to this change?

liucijus commented 3 months ago

@ladinu It was fixed on intellij plugin. Are you referring to this plugin, or something else?

ladinu commented 3 months ago

@liucijus I'm referring to this PR where users can choose to set build_ijar = True for scala library (default is False)

liucijus commented 3 months ago

I'm generating some Scala code and compiling them as a library. But IntelliJ is failing to detect the sources of the library.

@ladinu would you be able to make a small repro repository for me to debug it? I think it needs to be fixed on the Intellij plugin side.