cargo-outdated icon indicating copy to clipboard operation
cargo-outdated copied to clipboard

Consider using cargo_metadata instead of cargo crate

Open malbarbo opened this issue 8 years ago • 5 comments
trafficstars

It take too long to compile cargo. An alternative is to use cargo_metadata, which offers an api over the cargo metadata command.

malbarbo avatar Sep 27 '17 12:09 malbarbo

As cargo-outdated is supposed to be merged into cargo ultimately in the future, I don't think this would be an appropriate action to take.

Frederick888 avatar Sep 27 '17 12:09 Frederick888

@Frederick888 any tracking issue for this incorporation?

WiSaGaN avatar Dec 08 '17 08:12 WiSaGaN

@WiSaGaN rust-lang/cargo#4309

But even if we put this issue aside, since cargo-outdated has used too many cargo functions, e.g. resolving dependencies, updating various sources, querying crates.io registry, etc, etc, it's just too expensive to duplicate all of these.

Frederick888 avatar Dec 08 '17 08:12 Frederick888

Note that there's https://github.com/theduke/crates_io_api for querying crates.io API.

So it seems to me that it should not be significantly harder to avoid depending on Cargo? Specifically:

  • call cargo-metadata to learn about project structure and dependencies.
  • call crates_io_api to figure out about newer major versions
  • do a "create temp workspace" trick, but run cargo metadata on the workspace as a subprocess, to simulate cargo update.

matklad avatar Feb 03 '19 08:02 matklad

It'd be ideal if Cargo exposed its dependency resolution algorithm as a library. Then even the "temp workspace" hack wouldn't be needed — cargo-outdated could read and evaluate data straight from the API.

kornelski avatar Feb 03 '19 14:02 kornelski