-
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
Add a new argument "--no-build" to "cargo run" #3773
Comments
If you want to rerun the executable without rebuilding it, then perhaps you can just run it directly? Something like |
@matklad, I suppose I want |
Hm, then perhaps you can check if I am not sure if it is possible to determine the situation when the project has been build, but is not fresh: Cargo is stateless, so it only can check if the set of input files is as fresh as the contents of A simple check like "does target directory exist" can be done outside the Cargo. |
I'm going to close this out for the time being; it seems best to start with @matklad's suggested workaround. |
The approach suggested by @matklad seems more correct to me. |
this would still be useful to emit dep files without compiling anything btw (in order to perform static analysis on the correct files) |
@mimoo not sure I understand what you are trying to do, but if you mean depinfo files ( identity_proc_macro! {
mod foo; // depends on foo.rs, after we expand the macro
} Usually, |
Just to present a use case, I'm using cargo remote to build a project on another machine then copy the build artifacts back. Using cargo run seems to try to rebuild again on the local machine. One of the dependencies of the project behaves differently if CARGO_MANIFEST_DIR environment variable is set or not, so running the binary directly fails. My workaround for now is manually setting that environment variable when running the binary directly, but I could see it being nice to have a --no-rebuild option for cargo. It could be as simple as just running the binaries if they exist in the target folder and failing if they don't exist. |
Another use-case: I want to build the project, then execute some custom commands and then run the the project. This logic is inside a build pipeline (in my case in MoonZoon CLI). Running |
Another use case: I'm building for an embedded platform using the manufacturer's modified Rust fork including Cargo. P.S. Cargo.toml having a "separate debug symbols" option would be an alternative. |
Hello everyone.
Currently if you execute
cargo run
, Cargo compiles the project at first and then runs it.I run RLS as
cargo run --manifest-path /path/to/RLS/Cargo.toml
.Currently I cannot execute the second instance of RLS because it tries to compile and fails because RLS is already running, hence the executable cannot be deleted.
I need Cargo not to build the project.
I suggest to add a new argument
--no-build
.It would be good if Cargo shows a warning indicating that the project is changed, but runs it anyway if it can.
I can implement it myself.
I want to hear your opinions about it.
Thanks
The text was updated successfully, but these errors were encountered: