bloop icon indicating copy to clipboard operation
bloop copied to clipboard

Support multi-module projects in buildpress

Open tkroman opened this issue 5 years ago • 14 comments

So far I’ve only added a direct project’s setting detection, but I think we need to support multi-module ones as well (ie if I run buildpress on bloop itself, it should detect changes in any module’s sbt settings). Not sure it’s possible w/o hooking deeper into sbt itself rather than just traversing directories. @jvican I would appreciate your input here assuming this makes sense to you.

cross-linking with #948 since I'm hoping to build on top of that.

tkroman avatar Jul 01 '19 14:07 tkroman

By multi-module projects, are you referring here to ProjectRefs?

I'm totally fine not support project references. In my opinion, they lack a lot of polishing and their design/semantics are poorly specified. Yes, I use them, but I know I'm a power user working on a complicated project, so I'm fine dealing with build press not correctly supporting these :smile:

jvican avatar Jul 01 '19 14:07 jvican

Yes, ProjectRefs. I know for a fact that some users are organizing their monorepos this way, ie toplevel module is just an aggregate of all modules which is serving infrastructure purposes like code coverage, integration tests etc, so they would find it useful since those are normally running as a part of CI processes. I added this as a separate issue because src-based plugins are ProjectRefs in meta-build, so if I find a nice and efficient way to support reading them, maybe we’ll get this for free.

tkroman avatar Jul 01 '19 15:07 tkroman

It's true you can feed two birds with one scone.

Whenever you add a ProjectRef, a BuildRef pointing to the workspace base directory that defined that ProjectRef is added to the sbt internal graph/data structures. You could extract those BuildRefs and then run the hasher on top of those directories.

I don't remember right now the sbt APIs to extract such data (maybe BuildData or something like that, available by browsing the State APIs), but it's definitely possible. Feel free to play with these APIs in sbt-bloop, find the info, and whenever you have it we can decide how we can persist this data and make it accessible to buildpress.

I won't be really responsive for the next week and a half, so if you have questions ask them here and I'll try to get back to you whenever I find the time :smile:

jvican avatar Jul 01 '19 15:07 jvican

Hey @tkroman! Are you planning to work on build press any time soon?

jvican avatar Sep 13 '19 17:09 jvican

Hey @jvican! Yes, hopefully soon. I got stuck between changing jobs and trying to do my own project, going to make some free time in the next couple of weeks. Let me get back into the problem first. Also, if you could have some time for call to sync on this, I would appreciate that very much.

tkroman avatar Sep 13 '19 19:09 tkroman

Actually @jvican looks like I'm having too much on my plate right now, not sure I will be able to pay proper attention to this in the next month or so, so if there is anyone who wants to jump on this, they are welcome to. Sorry for the delay and/or inconvenience.

tkroman avatar Sep 25 '19 13:09 tkroman

Thank you for letting me know @tkroman!

jvican avatar Sep 26 '19 12:09 jvican

Hey @tkroman, I'm not that much interested in ProjectRefs but I do intend to be using buildpress soon to power some of our upcoming GitHub CI integrations and it'd be nice if you could quickly look at https://github.com/scalacenter/bloop/issues/948 and implement detection for source sbt plugins, it would unblock some interesting work and allow me to move forward quicker in the next few days.

jvican avatar Oct 05 '19 23:10 jvican

+1, very important to be used in industry

tribbloid avatar Feb 03 '21 00:02 tribbloid

Apparently this issue over at Metals never actually happened in Bloop?

Not the end of the world manually defining: bloopAggregateSourceDependencies in Global := true

but would be nice to get ProjectRef support out of the box to clue in VS Code et al...

godenji avatar Mar 13 '21 16:03 godenji

Apparently this issue over at Metals never actually happened in Bloop?

Not the end of the world manually defining: bloopAggregateSourceDependencies in Global := true

but would be nice to get ProjectRef support out of the box to clue in VS Code et al...

I actually haven't realized there is a separate option for that, but this seems to be true by default. If it doesn't work for a project, we should investigate.

tgodzik avatar Mar 15 '21 16:03 tgodzik

To be clear, without the referenced setting sbt compiles just fine; it's VS Code/Metals/Bloop that doesn't recognize dependent git ProjectRef sources.

Also, Scala 3 RC1.

godenji avatar Mar 16 '21 00:03 godenji

@godenji does it work with the setting? Do you have an example project maybe somewhere?

tgodzik avatar Mar 16 '21 10:03 tgodzik

Yes, it works fine when I manually define the setting in my build.sbt; it's when I omit the setting that VS Code no longer recognizes git ProjectRef dependent sources.

godenji avatar Mar 17 '21 02:03 godenji