Open bb010g opened 1 year ago
This is not enough to fix the following case, where there is a path dependency on a package that is part of a separate workspace:
#!/usr/bin/env bash
mkdir testcrate
cd testcrate
mkdir src && touch src/lib.rs
cat > Cargo.toml <<-EOF
[package]
name = "testcrate"
version = "0.1.0"
edition = "2021"
[dependencies]
ws_member = { path = "ws_dep/ws_member" }
EOF
mkdir ws_dep
cd ws_dep
cat > Cargo.toml <<-EOF
[workspace]
members = ["ws_member"]
resolver = "2"
[workspace.package]
version = "0.1.0"
EOF
mkdir ws_member
cd ws_member
mkdir src && touch src/lib.rs
cat > Cargo.toml <<-EOF
[package]
name = "ws_member"
version.workspace = true
edition = "2021"
EOF
error: cargo update in temp compat workspace for "/tmp/testcrate/Cargo.toml"
Caused by:
Updating Cargo lockfile
Caused by:
failed to get `ws_member` as a dependency of package `testcrate v0.1.0 (/tmp/cargo-outdated5rgCOb)`
Caused by:
failed to load source for dependency `ws_member`
Caused by:
Unable to update /tmp/cargo-outdated5rgCOb/ws_dep/ws_member
Caused by:
failed to parse manifest at `/tmp/cargo-outdated5rgCOb/ws_dep/ws_member/Cargo.toml`
Caused by:
error inheriting `version` from workspace root manifest's `workspace.package.version`
Caused by:
failed to find a workspace root
The check here needs to be generalized not just for the workspace of the root package, but for all dependency packages.
FYI, I've rebased this on master and factored out all the unrelated changes in this branch of mine, you might want to work off that if you continue with this: https://github.com/Xiretza/cargo-outdated/tree/workspace-inheritance
@Xiretza and @bb010g thanks for digging into this and sorry for the silence - if you'd like to re-energize this PR I'll help get it included.
Virtual workspaces are generally less special now. Logging coverage has increased where it was useful during debugging. Switching to
Path::strip_prefix
from substrings usingPath::to_str_lossy
has fixed possible confusion when temporary paths are long. Cargo&Package
values are carried around longer now so that the user doesn't have to write explicitlib
tables into theirCargo.toml
files to avoid warnings.Fixes kbknapp/cargo-outdated#325.