cargo-outdated
cargo-outdated copied to clipboard
Consider using cargo_metadata instead of cargo crate
It take too long to compile cargo. An alternative is to use cargo_metadata, which offers an api over the cargo metadata command.
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 any tracking issue for this incorporation?
@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.
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_apito figure out about newer major versions - do a "create temp workspace" trick, but run
cargo metadataon the workspace as a subprocess, to simulate cargo update.
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.