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

cargo metadata should return default workspace members #8033

Closed
sunshowers opened this issue Mar 23, 2020 · 9 comments · Fixed by #11978
Closed

cargo metadata should return default workspace members #8033

sunshowers opened this issue Mar 23, 2020 · 9 comments · Fixed by #11978
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-metadata disposition-merge FCP with intent to merge finished-final-comment-period FCP complete S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review T-cargo Team: Cargo to-announce

Comments

@sunshowers
Copy link
Contributor

Describe the problem you are trying to solve

For a workspace, it is possible to specify default members through the workspace.default-members key. It would be great to expose this information through cargo metadata.

Describe the solution you'd like
The same format as workspace_members in cargo metadata -- a list of package IDs.

@sunshowers sunshowers added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Mar 23, 2020
@sunshowers
Copy link
Contributor Author

cc @metajack

@charles-r-earp
Copy link
Contributor

I implemented this here https://github.com/charles-r-earp/cargo. I fixed one test "cargo_metadata_simple".

@sunshowers
Copy link
Contributor Author

@charles-r-earp that looks great! you can probably submit that as a PR to this repo.

@weihanglo
Copy link
Member

Hello all. Thanks for the proposal and the pull request. I'd like to know more about why default members in cargo metadata output is useful. Could you share some details?

Will do a simple FCP collecting options from the team then if it is reasonable.

(And sorry for the way too late reply 😅)

@weihanglo weihanglo added the S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. label Apr 26, 2023
@sunshowers
Copy link
Contributor Author

A simple use case is writing a linter that triggers only on default workspace members. Without support for this, one has to manually scrape the root Cargo.toml.

@charles-r-earp
Copy link
Contributor

Cargo extensions and dev tools will want to emulate cargo, like having options like --manifest-path, --workspace, --package, etc. There are tools to do this like clap_cargo + cargo_metadata which makes use of cargo metadata. This allows cargo-foo bar to operate on all workspace default members just like cargo check / build / test / etc.

@weihanglo weihanglo added the T-cargo Team: Cargo label Apr 26, 2023
@weihanglo
Copy link
Member

Thank you all for sharing!

I propose adding workspace default member information to the output of cargo metadata, to make external plugins easier to align to Cargo's behavior.

One concern is that the size of the output grows overtime.

@rfcbot fcp merge

We don't need to wait for 10 days after the poll btw.

@rfcbot
Copy link
Collaborator

rfcbot commented Apr 26, 2023

Team member @weihanglo has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge final-comment-period FCP — a period for last comments before action is taken labels Apr 26, 2023
@rfcbot
Copy link
Collaborator

rfcbot commented May 2, 2023

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period An FCP proposal has started, but not yet signed off. label May 2, 2023
@weihanglo weihanglo added S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review and removed S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. labels May 3, 2023
@bors bors closed this as completed in 6240788 May 4, 2023
@rfcbot rfcbot added finished-final-comment-period FCP complete to-announce and removed final-comment-period FCP — a period for last comments before action is taken labels May 12, 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-metadata disposition-merge FCP with intent to merge finished-final-comment-period FCP complete S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review T-cargo Team: Cargo to-announce
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants