Open
Description
Problem
Hey,
in my project I am using cargo as a library to build customized binaries (user-generated packages) on a server that are then sent to worker nodes.
For this I need to patch a set of my own API/ABI crates to a local/pinned version.
This can be done using the [patch] section in cargo.toml. However, it would be beneficial to do that programatically. A cargo::core::Workspace
allows to acquire a PackageRegistry
, which allows applying patches. However, there is no method that allows passing that PackageRegistry
back to the Workspace
or to pass it to cargo::ops::compile
.
Is there something that makes this impossible?
If I create a PR, which of the options below would be the desired one?
Proposed Solution
I see a few options:
- A setter that allows setting a
PackageRegistry
for theWorkspace
. As theWorkspace
does not store aPackageRegistry
, this might be a larger change. - A setter for the workspace's
root_patch
. While this is also not stored but generated on the fly, I would assume one could add a setter and a hashmap that is merged in with the highest priority. - Allow passing the
PackageRegistry
tocargo::ops::Compile
, and pass that through to the resolver.
Notes
No response