Skip to content

Implement multi workspace/multiple crate cargo check support #2792

@kiljacken

Description

@kiljacken

While trying to fix #2780 I had some thoughts about how cargo check watching interacts with multi-workspaces and multiple-project-in-single-workspace setups.

Having multiple workspaces is in theory simple: Just launch a watcher for each workspace, and then figure out how to multiplex the result channels. Should be doable, with not too large an amount of work.

The main issue comes with having multiple projects inside a single workspace. Because multiple crates that don't share a cargo workspace could depend on each other, we can't naively run a cargo check instance for each crate.

And here's where i need somebody to check my thoughts: It seems that the thing we need to do, to solve both issues, is to run a check watcher for each crate where:

  • The crate lives in an open workspace.
  • The crate is a purely a root in the crate graph, that is, not other crate depends on it.

Which doesn't sound too bad. There is one small problem, which is probably a solved problem in graph theory: For the second condition to be checked quickly, we need to be able to invert the crate graph, so that instead of mapping from crate -> dependencies it maps crate -> crates depending on it.

The above seems to make sense in my head, but I'd love hear peoples opinions. These things tend to turn out better and simpler when multiple heads come together.

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions