-
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 --dry-run
flag to the install
command
#14280
Conversation
0e553f7
to
f25a3a0
Compare
9894bbb
to
275615b
Compare
a1df193
to
a332bdc
Compare
4b81fe7
to
36867ee
Compare
Note: I tweaked the commits to make this easier to review. |
3440b31
to
e1cbe81
Compare
Thanks, sorry if i made a mess with the commits 😅 |
e1cbe81
to
b0e08fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! This should be ready to merge.
@bors r+ |
☀️ Test successful - checks-actions |
Update cargo 19 commits in eaee77dc1584be45949b75e4c4c9a841605e3a4b..80d82ca22abbee5fb7b51fa1abeb1ae34e99e88a 2024-09-19 21:10:23 +0000 to 2024-09-27 17:56:01 +0000 - Update cc to 1.1.22 (rust-lang/cargo#14607) - feat: lockfile path implies --locked on cargo install (rust-lang/cargo#14556) - feat(toml): Add `autolib` (rust-lang/cargo#14591) - fix: correct error count for `cargo check --message-format json` (rust-lang/cargo#14598) - test: relax panic output assertion (rust-lang/cargo#14602) - feat(timings): support dark color scheme in HTML output (rust-lang/cargo#14588) - feat: add CARGO_MANIFEST_PATH env variable (rust-lang/cargo#14404) - fix(config): Don't double-warn about `$CARGO_HOME/config` (rust-lang/cargo#14579) - fix(cargo-rustc): give trailing flags higher precedence on nightly (rust-lang/cargo#14587) - feat: make lockfile v4 the default (rust-lang/cargo#14595) - perf: Improve quality of completion performance traces (rust-lang/cargo#14592) - test: Remove completion tests (rust-lang/cargo#14590) - feat: Add support for completing `cargo update <TAB>` (rust-lang/cargo#14552) - test: Migrate remaining with_stdout/with_stderr calls (rust-lang/cargo#14577) - fix(resolve): Improve multi-MSRV workspaces (rust-lang/cargo#14569) - chore: Bump MSRV to 1.81 (rust-lang/cargo#14585) - Add a `--dry-run` flag to the `install` command (rust-lang/cargo#14280) - fix(resolve): Don't list transitive, incompatible dependencies as available (rust-lang/cargo#14568) - feat(complete): Upgrade clap_complete (rust-lang/cargo#14573)
What does this PR try to resolve?
This PR add the
--dry-run
flag to thecargo install
command (see #11123).I've tried to do the bare minimal for this flag to work without changing anything in the output.
In my opinion, the
--dry-run
flag should mimic as close as possible the behavior of the normal command to avoid missing potential issue in the normal execution.Currently we're missing information about where the binary will be installed.Unlike #13598 this PR:
BuildContext
instead ofInstallablePackage::new
unit_graph
, it add adry_run
to theCompileOptions
and return aCompilation::new
from the functioncompile_ws
without actually compiling.remove some warning not relevant in the case of a--dry-run
Like #13598, the version check and crate downloads still occur.
How should we test and review this PR?
The first commit include a unit tests to ensure that no binary is actually installed after the dry run.
There is also a snapshot test that show the diff output of the
--help
flag.Additional information
Tests and documentation done in #13598, may be cherry picked into this PR if needed.