-
Notifications
You must be signed in to change notification settings - Fork 96
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
refactor: introduce cargo
as a dependency
#51
Conversation
c634373
to
21253e0
Compare
21253e0
to
0539a61
Compare
Thanks for working on this @Frederick888! I ran this locally and got a bunch of lines that look like:
This was inside of rustup.rs, but I was wondering if maybe you know what's going on there? (specifically the "Removed" bit) |
@alexcrichton It means that a node in the dependency tree is removed after an update. In the case of Edit: Actually I think printing out a JSON or even a tree like |
172b13e
to
c388d75
Compare
Ah ok! 👍 |
7070528
to
d056fd0
Compare
@alexcrichton Actually I wonder whether I could replace Is it possible to modify the manifest through |
Unfortunately writing back a manifest may not be possible right now with Cargo's public API, but if you've got suggestion for modifying Cargo's API we're always more than willing to take PRs! |
I tried running this on a few of my projects. First, there appears to be some issues running this against Rocket. When I run this inside Rocket's
I then tried running this against a project with some outdated dependencies: rocket = "0.2.2"
rocket_codegen = "0.2.2"
rand = "0.3" I was expecting for the output to contain three lines, one for each outdated dependency, but instead the output contained 87 (!) lines, apparently one for each outdated transitive dependency. This seems like bad default behavior. There's nothing I can do about outdated transitive dependencies, so showing me those as outdated by default only makes it hard to see what I can control. I suggest showing all outdated transitive dependencies optionally and disabling display by default. Perhaps by default you can display a message saying something like, "Outdated transitive dependencies detected. For the full list, run |
Since it was generally accepted to add a native I would also like to hide the transitive dependencies completely by default and maybe add a flag to show them: it just pollutes the output imo. Nitpick: |
@SergioBenitez Ah, I think I know what the problem is. Before using In terms of the default behaviour, showing the transitive dependencies is actually the default one of some other package managers as well, e.g. @Keats I think it's still a bit early to merge this function to the development cycle of |
@SergioBenitez I have just pushed a fixed to your issue here. Could you give it a try? |
I'm getting following error with freshly compiled
My Cargo.toml:
System: MacOS Sierra UPDATE: I made a quick fix in diff --git a/src/cargo_ops/temp_project.rs b/src/cargo_ops/temp_project.rs
index ca291bf..7146d78 100644
--- a/src/cargo_ops/temp_project.rs
+++ b/src/cargo_ops/temp_project.rs
@@ -307,7 +307,7 @@ fn manifest_paths(elab: &ElaborateWorkspace) -> CargoResult<Vec<PathBuf>> {
if !members.contains(pkg_id) {
let pkg = &elab.pkgs[pkg_id];
let pkg_path = pkg.root().to_string_lossy();
- if &pkg_path[..workspace_path.len()] == workspace_path {
+ if pkg_path.len() > workspace_path.len() && &pkg_path[..workspace_path.len()] == workspace_path {
manifest_paths.push(pkg.manifest_path().to_owned());
}
} And now I'm getting this error:
|
@Frederick888 Okay, that seemed to fix the problem. A couple of notes/questions, however:
|
@mitskevich Thanks for the fix. I modified it a bit and have pushed a new commit here. The new error seems to be caused by an uncopied manifest file, i.e.
|
How about changing grouping by member? An output like the following for one of my projects:
Adding a column doesn't necessarily make sense as some members might have the same packages with different versions for some reasons |
@Keats That's an awesome idea! I like it. |
@Frederick888 Here is an example that consistently breaks latest version of If you will not be able to reproduce it, please let me know, I'll check what is happening in more details later. |
@mitskevich Ah, I see. Currently a
Otherwise there's simply no relationship between Perhaps I should resolve all the relative paths to absolute ones first so all such craps could be gone. |
@mitskevich I think your issue should be fixed by a8491e0. Could you please check it? |
@Frederick888 Yep, |
So as it stands now, most of the discovered "bugs" have been fixed in this PR. Since other ongoing discussions in this thread are basically related to improvements and new features, I think I'd merge this PR, tag a new release (although I can't publish it to crates.io) and file independent issues for them. I would be a bit busy in the next one or two months and this could make it more friendly to potential PRs from others. |
So this is the version with
cargo
as a dependency, which tends to be a "more native" one as suggested in rust-lang/cargo#4309.Changes:
cargo
as a dependencyRM
withRemoved
(closes What does "RM" mean in the output? #46)--all-features
--features
--no-default-features
as other cargo subcommandsThere
mightshould still be some bugs and some implementations are a bit silly, but it's already fine to me for a new release. And by the way @kbknapp, is it ok to add me to the author list as well?Example 1
Run
cargo outdated -r openssl
against rust-lang/cargo@a60d185c (0.20.0)Example 2
Run
cargo outdated -d 3
against Manishearth/rust-clippy@681a303Example 3
Run
cargo outdated --features color
against https://gist.github.com/Frederick888/306bf41c0aef2f4ec409add082ee5d0b