-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A way to execute local dependencies #12764
Comments
RFC 3028 doesn't seem to cover my use case very well. I use
#5120 seems to be only concerned with cargo commands. They want either an install step or magical detection of cargo subcommands in
|
I mentioned RFC 3028 because right now, cargo only officially supports depending on lib's and that RFC adds support for depending on bin's. |
All right, it makes sense to first get cargo to parse bin dependencies and build them under that RFC. And later add the capability to trigger the build differently |
I think this is also covered by #2267, which is also requesting the ability to Closing as a duplicate of #2267. If there are specific use cases that don't seem to be commented on in that issue, I'd suggest sharing them over there. |
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 install
ing the binary globally, but this method has multiple disadvantages, because the binary's version is not tracked by myCargo.toml
and 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-orm
repo. The authors suggest building my own executable which would act exactly likesea-orm-cli
by running its exported function. This workaround solves the initial issue, but it still feels hacky and inconvenient. I would like ifcargo
supported 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 build
andcargo run
a binary from a local dependency:For the initial implementation,
cargo build
would 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
.The text was updated successfully, but these errors were encountered: