Skip to content

fix: include the toolchain interpreter in rb_gem_push runfiles - #409

Open
titusfortner wants to merge 1 commit into
bazel-contrib:mainfrom
titusfortner:c/rules-ruby-gem-push-runfiles-498a01
Open

titusfortner wants to merge 1 commit into
bazel-contrib:mainfrom
titusfortner:c/rules-ruby-gem-push-runfiles-498a01

Conversation

@titusfortner

Copy link
Copy Markdown
Contributor

Problem

  • rb_gem_push only adds the toolchain's gem script and the .gem file to its runfiles, so the generated wrapper's rlocation of the interpreter comes up empty and the final exec ruby|jruby gem push ... falls back to whatever is on PATH. With MRI this is masked by a system Ruby on most machines; with JRuby it fails outright:
dirname: missing operand
bazel-out/k8-opt/bin/rb/selenium-webdriver-release-nightly.sh: line 104: exec: jruby: not found
  • The rule also skips the toolchain env (TruffleRuby's OPENSSL_PREFIX and LANG, JRuby's Windows JAVA_OPTS) and only applies the target's env through RunEnvironmentInfo, so the documented $(location) expansion never runs and the generated script only works under bazel run.

Seen in the SeleniumHQ/selenium nightly release: https://github.com/SeleniumHQ/selenium/actions/runs/35165684730

Solution

  • Mirror rb_binary: put toolchain.files in runfiles, pass java_bin so JAVA_HOME resolves from runfiles under JRuby, merge toolchain.env, and bake the env into the generated script.
  • Add bazel run :gem-release -- --help to the examples/gem CI matrix. It fails on every JRuby entry without this change.

Verified in Selenium with the runfiles part applied as a patch: https://github.com/SeleniumHQ/selenium/actions/runs/35171062663/job/105043434920

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant