Repository navigation
feat: add generated_srcs to rb_bundle_fetch - #421
Open
titusfortner wants to merge 1 commit into
Open
titusfortner wants to merge 1 commit into
titusfortner wants to merge 1 commit into
Conversation
…in the staged lock
titusfortner
added a commit
to titusfortner/selenium
that referenced
this pull request
Oct 13, 2026
…ib/rules_ruby#421 and how to back it out
2 tasks done
titusfortner
added a commit
to SeleniumHQ/selenium
that referenced
this pull request
Oct 13, 2026
…ad the version (#18164) * [rb] generate version.rb from the root version.bzl so tests do not read the version * [rb] write version.rb before Bundler reads the source tree gemspecs * [rb] point the rules_ruby generated_srcs patch comment at bazel-contrib/rules_ruby#421 and how to back it out
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.
This allows Bazel to dynamically generate version files so that just bumping the version does not invalidate test result cache.
Today
rb_bundle_fetchcopies the gemspec and the version file it requires at fetch time, so the version file must be checked in, and that copy plusGemfile.locksit in the runfiles of every target that depends on the bundle.What
generated_srcstorb_bundle_fetchandruby.bundle_fetch: files the Gemfile needs that the build produces, such as aversion.rbfromexpand_templategenerated_srcsis set, the bundle's copy ofGemfile.lockgets its path gem versions rewritten to match their gemspecs, so the checked-in lock keeps the real version while unstamped builds use anotherexamples/stamped_gem, a gem whose version lives in Starlark and is stamped only under--stamp, with a Linux CI jobNotes
generated_srcstake exactly today's path: no staging, no lock rewrite, and Bundler's deployment-mode check still applies.__dir__orFile.realpathwould otherwise resolve to the gemspec's original directory, which doesn't contain the generated file.BUNDLE_CACHE_PATHkeeps forward slashes on Windows, unlike the other Bundler paths, because Bundler globs it and Ruby globs treat backslashes as escapes.bundle installand every test cached across a bump; the rewrite only touches path gem entries, and a miss fails loudly with Bundler's "gemspecs for path gems changed".install_gemfile_lockhook: every consumer would maintain its own lock rewrite in sync with its version source.Considerations
Gemfile.locktext, limited to path gem version strings.glob:sources or nested gemspecs.generated_srcscould land as its own PR, but alone it only helps a project whose checked-in lock already records the unstamped version, so it would not remove the need for the lock rewrite.Selenium is trying this out as a patch in SeleniumHQ/selenium#18164, where its Ruby smoke tests pass on Linux, macOS and Windows.