Skip to main content

resolve

Function resolve 

Source
pub fn resolve(
    root: &Path,
    manifest: Manifest,
) -> Result<Vec<ResolvedPackage>, Vec<Error>>
Expand description

Walk the build’s manifests, starting from the root package, and hand back every package in it — each one after the packages it depends on, so they can be compiled in that order.

root is the directory holding manifest; manifest is already read and validated by the caller, which is why the root package’s own manifest errors are not among what this can report.

The root package’s test-dependencies are part of the build, and no other package’s are: a package listed there is available to that package’s tests/ and is not resolved by anyone depending on it. The rest of the rules apply to the union of the two maps, so one version of each package and an acyclic graph are settled once for the whole build rather than again when the tests are run.

A package reached through the root’s test-dependencies may depend on the root itself. That edge names the root’s src/, which the graph counts apart from its tests/, so it is not a cycle. The order handed back still ends with the root, after such a package; putting the root’s src/ ahead of it is the build loop’s job, since only the build loop compiles the two roots apart.

Every failure is collected rather than returned at the first one: a build whose manifests name three missing directories says so once.