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

feat: Support Cargo workspace inheritance #359

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bb010g
Copy link

@bb010g bb010g commented Jun 23, 2023

Virtual workspaces are generally less special now. Logging coverage has increased where it was useful during debugging. Switching to Path::strip_prefix from substrings using Path::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 explicit lib tables into their Cargo.toml files to avoid warnings.

Fixes #325.

@Xiretza
Copy link

Xiretza commented Jan 4, 2024

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.

@Xiretza
Copy link

Xiretza commented Jan 4, 2024

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

@kbknapp
Copy link
Owner

kbknapp commented Feb 26, 2024

@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.

@kbknapp kbknapp self-assigned this Feb 26, 2024
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

Successfully merging this pull request may close these issues.

Support workspace inheritance
3 participants