rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.85k stars 2.43k forks source link

Display artifact dependency information in `cargo tree` #14804

Open weihanglo opened 2 weeks ago

weihanglo commented 2 weeks ago

Some questions I asked in https://github.com/rust-lang/cargo/issues/10593#issuecomment-1341214604:

And some replies from @bstrie

Should we annotate artifact dependency nodes with a special (artifact deps) suffix?

There are multiple possible values for the artifact field, so I wouldn't mind having a (bin) or (staticlib) or (cdylib) suffix.

Should we show the information about which target platform an artifact dependency will be built on?

No, I think that's a detail that can be easily answered by checking Cargo.toml. But if you did decide to display this information, I would include it as part of the above annotation, e.g. (wasm32-wasi bin) or (x86_64-unknown-linux-musl staticlib).

How do we want to display the node of an artifact dependency with { …, lib = true }?

I think it should show up multiple times in the tree graph. The lib node should show up as an entirely normal dependency, whereas the artifact node should be annotated as mentioned above.

Propose solution

Since this is an unstable, we can ship an initial version and iterate on it then.

Version

d8cb5fb7f8f66fc9b4ba3d80b089474164a8a83d

weihanglo commented 2 weeks ago

There is a draft PR for this https://github.com/rust-lang/cargo/pull/14658