-
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
Make cargo metadata and tree respect target #8987
Conversation
Previously, the `metadata` and `tree` subcommands would download dependencies for all targets, regardless of whether those targets were actually enabled. This PR updates them so that they only download the same dependencies that building would do with the requested target(s). `cargo metadata` still includes all targets by default; you can only opt _out_ using `--filter-platform`. Ideally it should use `--target` the same way `tree` does, but it's too late to change that now. Fixes rust-lang#8981.
(rust-highfive has picked a reviewer for you, use r? to override) |
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.
Thanks for this! Could a new test or two be added for the new behavior as well? I think @ehuss should also take a look at this since he's more familiar with cargo tree
than I am.
I added a test to ensure that we only download the needed crates for |
@ehuss Great catch -- I've updated the PR to remove the unnecessary step. |
I'm not super confident this won't have issues, but I can't think of any potential problems. Thanks for fixing it! @bors r+ |
📌 Commit 260a355 has been approved by |
☀️ Test successful - checks-actions |
I wonder, should this be tagged with |
I generally reserve relnotes for new big features or major changes (mostly my bar is "do most users want to know about this?"). Most PRs (like this) are included in the CHANGELOG, so people who really want to know what is going on can find it there. Usually when people run into a problem, they'll file an issue and usually it'll be obvious to me what's going on. I don't expect this to cause problems, though. |
Update cargo 10 commits in a3c2627fbc2f5391c65ba45ab53b81bf71fa323c..75d5d8cffe3464631f82dcd3c470b78dc1dda8bb 2020-12-14 17:21:26 +0000 to 2020-12-22 18:10:56 +0000 - Update git2 (rust-lang/cargo#9009) - Stabilize RUSTC_WORKSPACE_WRAPPER (rust-lang/cargo#8976) - Make cargo metadata and tree respect target (rust-lang/cargo#8987) - Update git2 (rust-lang/cargo#8998) - Revert rust-lang/cargo#8954 - changing rustdoc's cwd (rust-lang/cargo#8996) - With debug HTTP mode log curl's version (rust-lang/cargo#8991) - Reject ambiguous git dependency declaration. (rust-lang/cargo#8984) - Fix tests not working with a different CARGO_TARGET_DIR. (rust-lang/cargo#8982) - Add version to credential dependencies. (rust-lang/cargo#8983) - Clarify FAQ entry wording about lockfiles (rust-lang/cargo#8978)
Previously, the
metadata
andtree
subcommands would downloaddependencies for all targets, regardless of whether those targets were
actually enabled. This PR updates them so that they only download the
same dependencies that building would do with the requested target(s).
cargo metadata
still includes all targets by default; you can only optout using
--filter-platform
. Ideally it should use--target
thesame way
tree
does, but it's too late to change that now.Fixes #8981.