Move BSP out dir to a different folder
Now that we're using Scala 3 and the IntelliJ compile server is on by default, I've been seeing intermittent errors that seem to suggest multiple compilers stomping over each's files on disks
So, you suggesting to no longer shared any build cache between CLI and IDE? A lot of development efforts went into sharing both, but sometimes with questionable success (For example: shared compile results while keeping IDE-dedicated resuls like semanticdb files separate). We should present the pros and cons. And probable make this an easy user-selectable option instead of a hard-coded choice.
Personally, I have not much use of shared build caches (in its current state). When using GenIdea, we also don't share compiler build output. When I need artifacts or other build targets, I always go to the CLI. IDE is just for editing, sometimes testing (when writing the test or the code under test).
Beside avoiding a whole class of possible issues, we also could avoid the global lock by making it out-dir specific.
Instead of using a different out-dir, we could just change all those bspXXX targets that return an UnresolvedPath, since they potentially violate the T.dest contract, to only read but not write files in foreign T.dest paths. Instead of peaking into the T.dest of their companion non-bsp tasks, they should just use their own T.dest.
As a consequence, potential out-of-sync tasks that return an UnresolvedPath aren't shared between BSP and CLI, but all other tasks like source generators or practically everything that is not handled by BSP specifically, can be shared as before, as Mill takes care of their integrity.
I think having separate out/ folders and separate Mill processes would be the simplest thing here. IIRC that's also what SBT does (or can be configured to do?) to avoid the same class of problem.
We could definitely tweak the BSP side to try and make the interference go away, but I'm not familiar enough with our BSP integration to knwo for sure if it's feasible
According to https://blog.pierre-ricadat.com/scala-3-migration-report-from-the-field, Intellij/SBT has a co fig use separate compiler output paths that does this
A Manual workaround to unblock intellij is to set change Settings / Languages & Frameworks / Scala / Editor / Error Highlighting / Scala3 from Compiler to Built-in, which makes IntelliJ not make so many requests to BSP resulting in less blocking
Taking this on.
Will make it configurable via mill frontmatter.