Skip to content

Fix crate setup#2915

Merged
soutaro merged 1 commit intomasterfrom
crate-setup
Apr 3, 2026
Merged

Fix crate setup#2915
soutaro merged 1 commit intomasterfrom
crate-setup

Conversation

@soutaro
Copy link
Copy Markdown
Member

@soutaro soutaro commented Apr 2, 2026

This PR introduces the rust/rbs_version file to make Rust crate releases more stable and safe. The file declares the version of the RBS C library that the Rust crates are built against, ensuring that published crates always use a specific, pinned version of the C parser source rather than relying on symlinks to the working tree.

The vendor directories under the Rust crate source code contain copies of the necessary files from the tags of this repository. (We also have symlink support for development against the working copy version of the C library.)

It also adds several Rake tasks for development and release operations:

  • rust:rbs:pin[VERSION] / rust:rbs:sync / rust:rbs:symlink — manage vendored RBS C parser source in each crate
  • rust:publish:ruby-rbs-sys / rust:publish:ruby-rbs — publish each crate independently, with RBS_RUST_PUBLISH_DRY_RUN=1 for dry-run mode

The CI workflow (rust.yml) is updated to run rust:rbs:sync before Rust builds and adds separate dry-run publish jobs for each crate. Documentation is added in docs/rust.md.

@soutaro soutaro added the no-milestone This PR doesn't associate with a milestone. label Apr 2, 2026
Rakefile Outdated
end

Dir.chdir(File.join(RUST_DIR, "ruby-rbs")) do
sh "cargo", "publish", "--dry-run", "--no-verify"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this one with --no-verify, but the other one doesn't have it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cargo publish --dry-run fails with ruby-rbs because ruby-rbs-sys is not published at this time.

Rakefile Outdated
Comment on lines +701 to +702
sh "git", "add", "-f", *vendor_paths, verbose: false
sh "git", "commit", "-m", "Temporary commit for cargo publish (will be reverted)", verbose: false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea to create a commit that can include the vendored C files just to publish and then undo the commit?

Could this be a bit confusing if crates.io shows the published commit sha and users can't find it in the repository?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is to avoid adding --allow-dirty flag because cargo identifies .gitignore files are dirty.
I got that it will be confusing with commit sha. Hmm...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of resetting:

  1. It cuts new branch for release,
  2. Commit with the vendor files,
  3. Push the commits with release tag, and
  4. Publish the crates with the commits.

So the commits the published crates are built from are available on GitHub with the release tags.

@soutaro soutaro marked this pull request as ready for review April 3, 2026 04:11
@soutaro soutaro merged commit a1fab76 into master Apr 3, 2026
28 checks passed
@soutaro soutaro deleted the crate-setup branch April 3, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-milestone This PR doesn't associate with a milestone.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants