-
Notifications
You must be signed in to change notification settings - Fork 2.9k
A way to execute local dependencies #12764
Copy link
Copy link
Closed as not planned
Labels
C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
My project has a dependency (
sea-orm), which I use both as a library and as a binary that I need to run (sea-orm-cli). This is a common use case for that dependency. The authors recommendcargo installing the binary globally, but this method has multiple disadvantages, because the binary's version is not tracked by myCargo.tomland goes out of sync with the library. This becomes especially inconvenient when I need to work on multiple branches or multiple projects that use different versions of that dependency. I want the binary to be local and versioned by myCargo.toml.I started a discussion in the
sea-ormrepo. The authors suggest building my own executable which would act exactly likesea-orm-cliby running its exported function. This workaround solves the initial issue, but it still feels hacky and inconvenient. I would like ifcargosupported this natively. From what I understand, currently there's no way to get it to build the upsteam binary.Proposed Solution
Add an option like
--from-crate, so that I cancargo buildandcargo runa binary from a local dependency:For the initial implementation,
cargo buildwould be enough. I can run the binary manually.The name of the option is discussable, it can also be something like
--crate,--from-dep, etc.Notes
Essentially, I want npx, but for
cargo.