Update support for Rust inter-workspace dependencies - #369
Update support for Rust inter-workspace dependencies#369johncarmack1984 wants to merge 4 commits into
Conversation
Package Changes Through c0ce23eNo changes. Add a change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
|
I want to make sure I understand the context here. Are you defining and publishing/changelog multiple crates as part monorepo where some/all have their version actually defined in the The intent of looking for the version number of a dep is that we bump it if it is declared as a dep and exists in the deps specified in |
|
Wrapping a loose end I've felt bad about: your question in February landed right as I was leaving Flight Science. Then I lost write access to the fltsci fork this branch lives on, so I can't update or rebase it. Three options: I recreate this from my own fork and actually answer your question this time, you take the diff wholesale, or we close it. Whatever's least work for you. Sorry for the silence :) |
|
Recreated as #397, rebuilt on current main with the February question answered in the description. Closing this one in its favor. |
Motivation
Covector fails when processing Cargo.toml files that use workspace dependencies ({ workspace = true }) or path-only dependencies ({ path = "../pkg" }). These are valid Cargo dependency patterns, but covector throws an error because it expects all object-style dependencies to have an explicit version field.
This blocks monorepos that use Cargo's workspace dependency inheritance feature, which is the recommended pattern for managing versions across Rust workspaces.
Approach
Modified getPackageFileVersion in packages/files/src/index.ts to handle two additional Cargo dependency patterns:
For both patterns, the function now returns an empty string instead of throwing an error, allowing covector to continue processing.
Alternate Designs
Could have attempted to resolve the actual version from the workspace root for workspace = true dependencies. However, this would require additional file reads and workspace resolution logic. Returning an empty string is simpler and sufficient for covector's dependency tracking purposes.
Possible Drawbacks or Risks
TODOs and Open Questions
Learning
Screenshots
see pasted terminal output below:
Before:
After: