Replies: 7 comments 28 replies
-
I agree that it would be time to switch from "Bloop as a build server by default" to "sbt/mill BSP by default", as I see both sbt and mill BSP is becoming mature (and ScalaCLI too because it's mostly proxy for underlying bloop BSP server). One concern before moving forward is something about closing server when we close Metals (maybe mill also has the same kind of issue?), I remember there was an issue related to this stuff, but sorry I didn't catch up with this area well... |
Beta Was this translation helpful? Give feedback.
-
A good first step might be to make this configurable. |
Beta Was this translation helpful? Give feedback.
-
I support the future action to provide a better experience for working with sbt/mill bsp.
However, I don't agree that we should do anything with the choice. |
Beta Was this translation helpful? Give feedback.
-
Has code navigation for scala 3.x.x projects improved for sbt build servers? I'm on latest metals and tried to switch to a sbt build server from bloop on a 3.1.2 project yesterday and was informed that code navigation would not work on this build server. On bloop bsp it didn't complain. If major features are breaking on sbt, it may not be a good idea to move the default away from bloop for newcomers - they take the default and code navigation breaks, or documentation or lenses, etc. |
Beta Was this translation helpful? Give feedback.
-
Thinking about this, weighing the pros and cons of each option, I conviced myself that BSP is used for two very different things and that we should consider them separately. 1. Importing the buildIf we only consider the build import, with requests such as In terms of maintenance, if for instance we need to export more information, implementing the change in the build tool directly is more simple and more stable than implementing it in the N plugins that are supposed to work on many versions of many build tools, with the risk that something is inaccessible or that it breaks in any new version of a build tool. 2. Compiling and runningIn contrast, Bloop is better for compiling and running. It optimizes the resource usage, it is non-blocking and it has better performance. Also it is easier to evolve: we only need to implement each new feature once in Bloop to make it available to everyone, rather than N times, in all build tools. For instance if we add a feature to run a single test, we can implement it in Bloop and then it is available to all. ConsequenceAs a consequence, I propose that Metals should always connect to sbt or Mill to import the build, but still use Bloop to compile and run. This is how it could work:
The main advantages of this are:
In some complex build, it would still make sense to use the build tools as the compile and run server as well. While this plan is no panacea, I feel like it could improve a few things that are annoying for Metals users and maintainers. It takes advantage of Bloop while hiding it more behind the scene: no more sbt-bloop, no more Less maintenance, more performance and better user experience :) PS: This plan is not much different from the idea that build tools could offload compilation to Bloop. But, since Metals would benefit the most from it, I claim that it should be implemented in Metals. |
Beta Was this translation helpful? Give feedback.
-
BSP ComparisonsThis is a continuation of the discussion that we were having up above about what Build Since sbt and Mill are really the only two that are being commonly used as build BSP DiscoveryBefore we dive into build tool and the differences first here is an overview of
Build Import / Reload RequestJust a note about the "Build Import" request since this term is a bit overloaded In the situation where you're not using Bloop, the same "Build Import" verbiage A General note about weaknessesIn each section I have some weaknesses listed for using that tool. This isn't BloopIt's helpful to take a look at the
A couple notes here:
Everything else that is relevant for the Metals use-case is there with Bloop Strengths
Weaknesses
sbtHere is the initialize response you'll see from sbt.
A couple notes here:
Strengths
Current limitations
MillHere is the initialize response you'll see from mill.
Strengths
Weaknesses
Comparison chartMore or less if you were to take the core features and table them out they'd
How to proceedHopefully this gives us a better picture of the current state of things. Again Here is what I propose as some concrete next steps:
|
Beta Was this translation helpful? Give feedback.
-
It is possible to build pure Java targets with SBT, it is driven by the |
Beta Was this translation helpful? Give feedback.
-
Historically Bloop has played an absolutely major role in Metals. It paved the way in BSP and has allowed us to support multiple build tools out of the gate with Metals. This was before sbt had BSP support and before Mill had BSP support.
Over the last year looking at conversations on Discord and other places it seems more and more common for sbt users to switch to using sbt as their build server instead of Bloop. This can help out in more complex builds, custom configurations, etc. sbt as a build server just knows how to handle sbt builds better. While there are some limitations (probably the fact that an sbt session blocks), most of the time using sbt as a build server is just a better choice.
We also find ourselves in a position where this may start to cause a bit of confusion as BSP support in tools like sbt and Mill get more popular. We see this in the discussion that took place here. In some ways we're ignoring BSP discovery (which Bloop doesn't follow) and instead favoring Bloop in build tools that Bloop supports. This may not be what the user wants or expects when there is an existing
.bsp/tool.json
entry. Switching to a new build server also adds a bit of mental overhead about when to switch, how to switch, and whether the switch worked.This all sort of leads to the question of at what point do we stop favoring Bloop for build tools that can also serve as build servers? I propose that we start moving in this direction with the goals being:
.bsp/mill.json
, then Mill is automatically used as a BSP serverI'd love to hear other's thoughts on this.
Where we're at
Beta Was this translation helpful? Give feedback.
All reactions