build icon indicating copy to clipboard operation
build copied to clipboard

allow a single build/watch command for an entire workspace

Open tylandercasper opened this issue 1 year ago • 6 comments

right now I spawn 3 or 4 different build_runner watches when I open a project, but with the advent of workspaces it feels like that shouldn't be necessary any more.

Is it possible for one build_runner to cover all of the projects in a workspace?

tylandercasper avatar Jan 30 '25 16:01 tylandercasper

Sounds reasonable, thanks.

I guess with renewed interest in build_runner we'll get a pile of feature requests, I can't say yet where this will end up in the pile :)

davidmorgan avatar Jan 30 '25 17:01 davidmorgan

looking forward to seeing what you guys do with it!

tylandercasper avatar Jan 30 '25 17:01 tylandercasper

but with the advent of workspaces

I just opened https://github.com/dart-lang/build/issues/3806 which maybe overlaps a little. But my idea wasn't to restrict it to a single Pub workspace, but rather have a single instance an IDE could spawn that could handle all projects in the open set of folders (which may or may not be a workspace). Probably there are some gains to having only a single build_runner instance (even if it's just spawning multiple isolates) versus spawning many build_runner instances for the different projects in the (VS Code) workspace.

DanTup avatar Jan 30 '25 20:01 DanTup

See also my comment regarding an analyzer plugin, this would also solve the workspace issue. The plugin works on analysis contexts, you will only get one context for the whole workspace, and anything open in your IDE which has an analysis context will get codegen run on it.

jakemac53 avatar Jan 30 '25 22:01 jakemac53

I had a similar idea a while ago: https://github.com/dart-lang/build/issues/2981. At least with the standalone build_runner, a problem is that each build must have a single "root" package which is treated specially in a lot of places (running a build across a workspace means that there may be multiple root packages, or perhaps even a package that is a root package for its own build and a non-root package for another build).

simolus3 avatar Jan 30 '25 22:01 simolus3

Right, build_runner has quite baked in the notion of a single "root" package.

Workspaces do also technically have a "root" package - (at the workspace root) - but we would need to be able to allow other packages to also behave like root packages in terms of running their build-to-source builders and such. It would definitely require some thoughtful design work.

jakemac53 avatar Jan 31 '25 16:01 jakemac53