Skip to main content

Module resolve

Module resolve 

Source
Expand description

PM.6: the source resolver — a declared source becomes something the build service can consume.

Design: plugin-manager.md §4. Three source kinds, and one of them deliberately does not end in a build:

  • PluginSource::Local — the directory is the source tree. Built in place; the tree is never copied.
  • PluginSource::Git — cloned/fetched into a source cache and checked out at rev, then built like Local.
  • PluginSource::Prebuilt — a ready .wasm downloaded straight into the user root. No build, no toolchain (§7), which is the whole point of the kind: it is how a user on a machine with no Rust installs a plugin at all.

So resolve returns Resolved, not a path: “where is the source” and “here is the artifact, skip the build” are different answers and collapsing them would force Prebuilt to invent a source tree it does not have.

§Why git is a subprocess

gix is already in the workspace, but only with read-only features — lattice-vcs inspects repositories, it does not clone them. Turning on blocking-network-client would pull TLS and a network stack into a crate that has neither, to replace a binary every developer running a Git plugin source already has. It is also the same bargain the build service already strikes with cargo: you have the toolchain for the source kind you asked for.

Everything here blocks. Callers run it on spawn_blocking.

Structs§

HttpFetcher
The real fetcher.
SystemGit
The real runner.

Enums§

PluginSource
Where a plugin comes from (mirrors the plugin-source WIT variant PM.7 exposes to init.rs).
RefreshPolicy
Whether a source that is already in the cache may be advanced from the network.
Resolved
What a source resolved to.

Traits§

Fetcher
Downloads a URL to a file.
GitRunner
Runs git. Behind a trait so the resolver’s cache/checkout logic is testable against a fake, and against a real local repository, with no network.

Functions§

git_cache_dir
The source-cache directory for name’s git checkout.
resolve
Resolve source for the plugin called name.