Support Cargo workspace versions and version-files in Rust projects - #41
Merged
Conversation
RustConfig gains version_files, read from [tool.fastship].version-files by the same rule as ShipConfig: each listed file must contain the old version exactly once, every file is checked before any is written, and the copies are rewritten after Cargo.toml. The read-and-check and write halves are shared helpers now, used by the Python flow as before. A bare crate has no pyproject to declare copies in, so CrateConfig carries an empty list. Claude-Session: https://claude.ai/code/session_01KCKXyYZu5R6fnPbTx3pMmo
When [package] has version.workspace = true, the version lives in [workspace.package]. _cargo_version_section names the section that holds it, and both the read and the bump go through it, so a workspace whose crates inherit one version is released like a single crate. A single crate with a literal [package].version is unchanged. The README records that, and that version-files applies to Rust projects. Claude-Session: https://claude.ai/code/session_01KCKXyYZu5R6fnPbTx3pMmo
`_cargo_version_section` now picks `[workspace.package]` only when the crate inherits its version or the manifest declares a workspace package, so a plain crate missing its version gets the same error text as before. Also: read `cfg.version` once in `_cargo_bump`, docstrings on `_write_copies` and `ship_rs_bump`, a shared version-file setup helper in the tests with a `[package]`-first workspace case, and a plainer README. Claude-Session: https://claude.ai/code/session_01KCKXyYZu5R6fnPbTx3pMmo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support shared Cargo workspace versions in
ship-bump. Extendversion-filesto Rust projects so additional version copies, such as an npmpackage.json, stay synchronized. Invalid copies stop the bump before any files are changed.Workspace root packages must inherit the shared version; independently versioned roots are rejected.