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

Fill the gap between "cargo install" and "cargo build --release" #7309

Closed
crlf0710 opened this issue Aug 29, 2019 · 6 comments
Closed

Fill the gap between "cargo install" and "cargo build --release" #7309

crlf0710 opened this issue Aug 29, 2019 · 6 comments
Labels
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

@crlf0710
Copy link
Member

Currently we can use "cargo install" to install an executable. And we can use "cargo build" to build the artifact. There should be a third command that deploys the executable artifact to $CARGO_HOME/bin and let cargo install manage them.

@crlf0710 crlf0710 added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Aug 29, 2019
@joshtriplett
Copy link
Member

It feels like this request went directly to having a particular solution in mind, rather than describing the problem you're trying to solve. Could you please explain what problem you're trying to solve here?

@crlf0710
Copy link
Member Author

crlf0710 commented Sep 5, 2019

Sure~ Case 1 When we develop a binary crate for our own use; Case 2 When we use other's binary crate but does some patching and hacking ourselves, we modify the code, run cargo run --release and made sure it works ok. Now we're happy with the code and want to install the built artifacts to our systems' "~/.cargo/bin" directory. If we do a git install, everything will be built from scratch - works but can be really slow.

So, the best approach could be copying the built artifacts to that directory. Currently i do this manually, but I wish this could be covered by some use of cargo.

@raftario
Copy link

This is a feature I thought about too and I'd be interested in working on it. Would a new --install flag added to the build command make sense ?

@Huanzo
Copy link

Huanzo commented Oct 27, 2019

You can use the the install subcommand to install a local crate without recompiling it with the --path flag.

cargo install --path . inside your project root should install the current binary crate without recompilation.

@weihanglo
Copy link
Member

weihanglo commented May 24, 2023

I feel like this comment from Huanzo should do the trick. Things need to beware is that cargo install defaults to do a --release build whereas cargo build using dev profile. See Cargo Guide: Profiles.

There should be nearly no recompile if their compiler flags and the profile matche. Sometimes a mismatch happens though. I would suggest finding what contributes to the mismatch and fix it first.

@weihanglo weihanglo added the S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. label May 24, 2023
@epage
Copy link
Contributor

epage commented Nov 2, 2023

Considering that cargo install seems to be able to do the trick, I'm going to close this. If there is a reason for us to reconsider this, let us know!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

7 participants