-
Notifications
You must be signed in to change notification settings - Fork 17
feat: add utilities to generate rv_checksums and excluded_gems #283
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
Conversation
Add two Bazel-compatible utilities to automate maintenance of rv-ruby checksums and excluded gems: 1. generate_rv_checksums: Fetches SHA256 checksums from rv-ruby GitHub releases and updates ruby.toolchain() in MODULE.bazel 2. generate_excluded_gems: Queries stdgems.org for native gems and updates ruby.bundle_fetch() excluded_gems in MODULE.bazel Both utilities: - Support --dry-run mode for previewing changes - Use buildozer for automatic MODULE.bazel updates - Include comprehensive test coverage - Use cgrindel_bazel_starlib for consistent error handling Dependencies added: - rules_shell for sh_binary and sh_test support - cgrindel_bazel_starlib for fail/warn/assertions utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Add integration test for generate_excluded_gems.sh to verify buildozer
updates work correctly
- Refactor buildozer command to use array structure and proper list
operations ('remove' + 'add' instead of 'set')
- Use -types flag with name-based targeting instead of extension syntax
- Fix tab indentation in error messages
- Add test for name filtering to ensure only target bundle is updated
The buildozer command now matches the pattern used in
generate_rv_checksums.sh for consistency.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Update both generate_rv_checksums.sh and generate_excluded_gems.sh to use BUILD_WORKSPACE_DIRECTORY when available for the default MODULE.bazel path - This fixes the issue where running via `bazel run` couldn't find MODULE.bazel because it was looking in the execution directory instead of the workspace root - When BUILD_WORKSPACE_DIRECTORY is not set (direct script execution), it falls back to ./MODULE.bazel as before - Move buildifier_prebuilt from dev_dependency to regular dependency since it's required by the generator tools at runtime - Fix line wrapping in integration test comments 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Remove WORKSPACE examples from rv-ruby section (focus on Bzlmod) - Add "Configure rv-ruby Downloads" section documenting generate_rv_checksums utility - Add "Configure Excluded Gems" section documenting generate_excluded_gems utility - Fix rb_bundle_fetch to ruby.bundle_fetch for Bzlmod syntax - Add utility options documentation (--name, --module-bazel, --dry-run) - Improve formatting and organization of rv-ruby configuration steps - Add note about compilation errors when excluded_gems is not set The documentation now provides clear, step-by-step instructions for using the automated utilities instead of manually configuring checksums and excluded gems. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Remove redundant set -o errexit declarations (handled by runfiles.bash) - Add shellcheck disable directives for dynamic sourcing in test files - Remove debug echo statements from integration tests - Wrap long lines to improve readability - Fix line continuation for better formatting consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Add --max-time 30 to curl commands to prevent indefinite hangs - Enhance get_minor_version comment to explain Ruby versioning structure and why stdgems data is organized by minor version 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Remove all echo statements to STDOUT from test files to keep test output clean. Tests should only output on failure. Changes: - Remove DEBUG echo statements from integration tests - Remove TEST/PASS progress messages from all tests - Remove summary "All tests passed!" messages - Keep echo statements redirected to stderr or files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
p0deje
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's great, thank you for taking the time to implement it. I wonder if it's possible to use these tools to generate all checksums and excluded gems mapping for all current RV Ruby versions, then commit them to rules_ruby itself. This will make the overall user experience much better since they won't need to perform any extra steps (unless they use a version of Ruby that's not supported in rules_ruby yet).
| bazel_dep(name = "rules_cc", version = "0.0.9") | ||
| bazel_dep(name = "rules_java", version = "7.2.0") | ||
| bazel_dep(name = "rules_shell", version = "0.4.1") | ||
| bazel_dep(name = "buildifier_prebuilt", version = "8.2.1.1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it have to be a runtime dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunatley, yes. The tools use buildozer to update the MODULE.bazel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks for explanation.
| # the versions resolved in users repositories. | ||
| bazel_dep(name = "bazel_features", version = "1.9.0") | ||
| bazel_dep(name = "bazel_skylib", version = "1.3.0") | ||
| bazel_dep(name = "cgrindel_bazel_starlib", version = "0.27.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it have to be a runtime dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used some shell libraries from my repo in the tools. We can copy those utilities somewhere, but then you would need to maintain them here, as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine to use the dependency then.
We can. However, you will be pinning It is your call about embedding the rv-ruby version info. |
Summary
This PR adds two utilities to help users configure rv-ruby in their MODULE.bazel:
Changes
Utilities Implementation
generate_rv_checksums.shto fetch checksums from rv-ruby GitHub releasesgenerate_excluded_gems.shto fetch default gems from stdgems.org--name,--module-bazel, and--dry-runoptionsTesting
Documentation
Bug Fixes
bazel runUsage Examples
Generate rv_checksums:
Generate excluded_gems:
Testing
All tests pass:
bazel test //tools/...Notes