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

Add metadata subcommand to cargo #2193

Closed
matklad opened this issue Dec 4, 2015 · 8 comments
Closed

Add metadata subcommand to cargo #2193

matklad opened this issue Dec 4, 2015 · 8 comments

Comments

@matklad
Copy link
Member

matklad commented Dec 4, 2015

This is a follow up of #1225, #1434 and #2091

cc @dan-t @lunaryorn @winger @alexcrichton

Currently we have an external sub command by @winger. The fork compatible with the recent version of cargo is here. It is very experimental, but already can be used to extract valuable metadata (a proof by gif). It depends on the dev version of cargo and is not available on crates.io, but you can cargo install --git https://github.com/intellij-rust/cargo-metadata it.

I would really like to include this sub command to cargo:

  • It's not very convenient to ask a user to install some tool when she just tries to open a project in an IDE.
  • Installing metadata can be a hassle: it depends on the cargo itself, so it takes ages to compile and can fail if you don't have necessary OpenSSL headers.
  • A "standard" metadata command would help tools interoperability.

So I ask the following questions:

  • What data and in what format should metadata provide? @dan-t, @lunaryorn could you experiment with it and give feedback?
  • What steps are to be taken to merge this thing to cargo?
@dan-t
Copy link

dan-t commented Dec 4, 2015 via email

@alexcrichton
Copy link
Member

In terms of format, I think it should probably default to the Cargo standard of TOML but also be configurable to other formats like JSON or perhaps just some textual encoding. I wouldn't be too worried about that, however.

In terms of what data this should provide, I think that basically exposing the standard structures of Package and such are probably sufficient (e.g. exporting a subset of their fields), and then we may want to provide various stages for example metadata of the current package before resolution and then metadata after resolution (to include dependencies).

#1434 seemed pretty promising to me but it unfortunately stalled :(

@matklad
Copy link
Member Author

matklad commented Dec 4, 2015

I will try update #1434 then

@matklad
Copy link
Member Author

matklad commented Dec 4, 2015

@alexcrichton am I correct that read-manifest and metadata should be two separate commands? They seem pretty similar in scope. May be we should use a single command with different flags?

@alexcrichton
Copy link
Member

Yeah I think it's fine to start a new metadata command from scratch. I'd be fine deprecating read-manifest as well eventually in favor of just one command if it comes to that as well.

@alexeykudinkin
Copy link

@alexcrichton any progress on this? It really impedes us introducing fully-fledged Cargo's projects support in https://github.com/intellij-rust/intellij-rust.

@alexcrichton
Copy link
Member

Indeed! @matklad is doing some awesome work over in #2196 to add this command.

@alexcrichton
Copy link
Member

(any suggestions about what sort of output you'd like to see would also be quite welcome!)

matklad added a commit to matklad/cargo that referenced this issue Jan 25, 2016
bors added a commit that referenced this issue Jan 25, 2016
Most of the work was done by @dan-t in #1225 and by @winger in #1434

Fixes #2193

I failed to properly rebase previous attempts so I just salvaged this from bits and pieces.

@alexcrichton are you sure that the default format should be TOML? I think that TOML is more suitable for humans, and JSON is better (at the moment at least) for tools. Maybe we should default to ~~TOML~~ JSON?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants