Skip to content

Support Cargo workspace versions and version-files in Rust projects - #41

Merged
jph00 merged 4 commits into
mainfrom
rs-version-files
Sep 6, 2026
Merged

Support Cargo workspace versions and version-files in Rust projects#41
jph00 merged 4 commits into
mainfrom
rs-version-files

Conversation

@ncoop57

@ncoop57 ncoop57 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Support shared Cargo workspace versions in ship-bump. Extend version-files to Rust projects so additional version copies, such as an npm package.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.

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
@ncoop57 ncoop57 changed the title Bump workspace-inherited Cargo versions and apply version-files to Rust projects Support Cargo workspace versions and version-files in Rust projects Sep 5, 2026
@ncoop57 ncoop57 added the enhancement New feature or request label Sep 5, 2026
@ncoop57
ncoop57 marked this pull request as ready for review September 6, 2026 13:49
@ncoop57
ncoop57 requested a review from jph00 September 6, 2026 13:49
@jph00
jph00 merged commit c6b94f6 into main Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants