Skip to content
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

Support cargo install --all #4101

Open
RalfJung opened this issue May 25, 2017 · 13 comments
Open

Support cargo install --all #4101

RalfJung opened this issue May 25, 2017 · 13 comments
Labels
A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-install S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

Comments

@RalfJung
Copy link
Member

There seems to be no easy way currently to install all binaries from all crates in a given workspace. Instead, cargo install has to be called for all of them separately. It would be nice if cargo install supported a --all flag to recurse into all crates of the workspace.

Does this seem to make sense?

@alexcrichton
Copy link
Member

Makes sense to me!

I got scared that you might have meant cargo install --all as "install all binaries from crates.io please" but I like this interpretation better :)

@RalfJung
Copy link
Member Author

I got scared that you might have meant cargo install --all as "install all binaries from crates.io please"

That one sounds like... a nice Easter egg? ;)

@est31
Copy link
Member

est31 commented May 26, 2017

Maybe it could be called cargo install --all-workspace ?

@RalfJung
Copy link
Member Author

I suggested --all for consistency with cargo build. But unfortunately, cargo install is already working somewhat differently than build, test etc. (e.g., it doesn't take --package but instead takes --path).

@carols10cents carols10cents added A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-install labels Oct 3, 2017
@matthiasbeyer
Copy link
Contributor

I second this! Would be really nice to have the --all feature! 👍

@matthiasbeyer
Copy link
Contributor

I'm working on this, PR will be filed in a few minutes.

@rushmorem
Copy link

For some workspaces, it makes sense to install from only one specific package. For example:

cargo install --git https://github.com/habitat-sh/habitat --package hab --tag 0.58.0

In fact, I tried to run this exact command just a moment ago, which is what led me here.

@matthiasbeyer Would it be feasible to include this functionality in the same PR or should I open a separate issue?

@matthiasbeyer
Copy link
Contributor

I'm on a sabbatical and cannot contribute code right now, so I suppose opening a new PR would be the way to go.

@dwijnand dwijnand changed the title Suppport cargo install --all Support cargo install --all Feb 1, 2019
@sophiajt
Copy link

sophiajt commented Mar 2, 2020

Hi from the Nushell team!

We ship Nu with a set of plugins, and we're having to work around not having this feature using some (admittedly a little gross) hackery. We'd love to see this happen.

Happy to help implement it, if it helps!

@ehuss
Copy link
Contributor

ehuss commented Mar 3, 2020

It might be helpful to spell out the exact desired behavior. Something along these lines:

Support the normal package selection flags (-p, -all, --workspace, --exclude) when used with the --path flag. Passing a bare arg would be the same as -p. This may cause some complexities since -p is a pkgspec, and install args are names only, what are the possible problems here? What is the behavior with --git? cargo install inherently does not have a workspace-oriented view with --git, so it may introduce some complexities with it. Should --git just not support those flags? Should it be an error for registry sources?

Implementation may be tricky because install is inherently unaware of workspaces at the high level. It may require some redesign of how it is implemented, which may not be easy.

@chenrui333
Copy link

Any update on this thread? It would be good to have something like this cargo install --package xx working.

@proski
Copy link

proski commented Oct 23, 2023

I don't think a special flag like --all should be needed. cargo build knows what to build without --all, why should cargo install --path . need it?
On top of that, there is workspace.default-members: https://doc.rust-lang.org/cargo/reference/workspaces.html#the-default-members-field
The documentation is unclear what operations it should apply to. It doesn't apply to cargo install apparently, which might be a bug.

@0xBYTESHIFT

This comment was marked as off-topic.

Arnaud-de-Grandmaison-ARM added a commit to Arnaud-de-Grandmaison-ARM/keybroker-demo that referenced this issue Oct 9, 2024
For some reason, cargo install and cargo build do not do exactly the
same thing.  My commit at

ed6ce14

broke cargo install without us noting it or CI catching it.

This commit adds a test to cover this. It should be noted that Rust does
not yet cargo install with workspace, so we need to point it to each of
the individual binaries that we want to install, for reference see:
 - rust-lang/cargo#7599
 - rust-lang/cargo#4101
 - rust-lang/cargo#7124

We install each of the binaries into a temporary directory that will be
cleaned up automatically by the runner when the job finishes.

Signed-off-by: Arnaud de Grandmaison <[email protected]>
Arnaud-de-Grandmaison-ARM added a commit to Arnaud-de-Grandmaison-ARM/keybroker-demo that referenced this issue Oct 9, 2024
For some reason, cargo install and cargo build do not do exactly the
same thing.  My commit at

ed6ce14

broke cargo install without us noting it or CI catching it. This commit
adds a test to cover this.

It should be noted that cargo install does not yet (or still does not !)
play nice with workspace, so we need to point it to each of the
individual binaries that we want to install, for reference see:
 - rust-lang/cargo#7599
 - rust-lang/cargo#4101
 - rust-lang/cargo#7124

We install each of the binaries into a temporary directory provided by
the runner and that will be cleaned up automatically when the job
finishes.

Signed-off-by: Arnaud de Grandmaison <[email protected]>
Arnaud-de-Grandmaison-ARM added a commit to veraison/keybroker-demo that referenced this issue Oct 9, 2024
For some reason, cargo install and cargo build do not do exactly the
same thing.  My commit at

Arnaud-de-Grandmaison-ARM@ed6ce14

broke cargo install without us noting it or CI catching it. This commit
adds a test to cover this.

It should be noted that cargo install does not yet (or still does not !)
play nice with workspace, so we need to point it to each of the
individual binaries that we want to install, for reference see:
 - rust-lang/cargo#7599
 - rust-lang/cargo#4101
 - rust-lang/cargo#7124

We install each of the binaries into a temporary directory provided by
the runner and that will be cleaned up automatically when the job
finishes.

Signed-off-by: Arnaud de Grandmaison <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-install S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Projects
None yet
Development

No branches or pull requests