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 doesn't identify which crate in the current workspace is the "current" one #4018

Open
sfackler opened this issue May 10, 2017 · 4 comments
Labels
A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-metadata S-triage Status: This issue is waiting on initial triage.

Comments

@sfackler
Copy link
Member

No description provided.

@alexcrichton
Copy link
Member

cc @matklad

@matklad
Copy link
Member

matklad commented May 10, 2017

Hm, and what is "the current crate"? The one specified with --manifest-path or the closest to the current working directory?

We can surface that to cargo-metadata for sure, but logically it does not belong there (i.e, I expect cargo metadata to return the same output regardless of the location in the workspace it is invoked from).

I also feel that "current crate" is a bit elusive concept (there's no current crate with -all flag).

Perhaps it would not be that difficult to reconstruct "current" on the client's side? You don't have to do directory traversal, you can look at the manifest_path fields of Package nodes of metadata.

@sfackler
Copy link
Member Author

The "current" crate is the one that builds if I run cargo build with the same flags.

@matklad
Copy link
Member

matklad commented May 10, 2017

The "current" crate is the one that builds if I run cargo build with the same flags.

Cargo may build any set of packages from a workspace depending on the flags. For example

$ cargo build -p foo -p bar  

will build foo and bar and their dependencies, but not, for example, baz. And there's also cargo build --all. So there's no the "current" crate really. Why do you need to know current crate?

@carols10cents carols10cents added A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-metadata labels Oct 3, 2017
@epage epage added the S-triage Status: This issue is waiting on initial triage. label Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-metadata S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

5 participants