8000 Support JRuby gem loading · bazelruby/rules_ruby@36893fe · GitHub
[go: up one dir, main page]

Skip to content

Commit 36893fe

Browse files
committed
Support JRuby gem loading
1 parent 4b1c480 commit 36893fe

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ruby/private/bundle/create_bundle_build_file.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@
6565
#
6666
# Since OS platform is unlikely to change between Bazel builds on the same machine,
6767
# `#{gem_name}-#{gem_version}*` would be sufficient to narrow down matches to at most one.
68+
#
69+
# Library path differs across implementations as `lib/ruby` on MRI and `lib/jruby` on JRuby.
6870
GEM_PATH = ->(ruby_version, gem_name, gem_version) do
69-
Dir.glob("lib/ruby/#{ruby_version}/gems/#{gem_name}-#{gem_version}*").first
71+
Dir.glob("lib/#{RbConfig::CONFIG['RUBY_INSTALL_NAME']}/#{ruby_version}/gems/#{gem_name}-#{gem_version}*").first
7072
end
7173

7274
# For ordinary gems, this path is like 'lib/ruby/3.0.0/specifications/rspec-3.10.0.gemspec'.
@@ -76,8 +78,10 @@
7678
#
7779
# Since OS platform is unlikely to change between Bazel builds on the same machine,
7880
# `#{gem_name}-#{gem_version}*.gemspec` would be sufficient to narrow down matches to at most one.
81+
#
82+
# Library path differs across implementations as `lib/ruby` on MRI and `lib/jruby` on JRuby.
7983
SPEC_PATH = ->(ruby_version, gem_name, gem_version) do
80-
Dir.glob("lib/ruby/#{ruby_version}/specifications/#{gem_name}-#{gem_version}*.gemspec").first
84+
Dir.glob("lib/#{RbConfig::CONFIG['RUBY_INSTALL_NAME']}/#{ruby_version}/specifications/#{gem_name}-#{gem_version}*.gemspec").first
8185
end
8286

8387
require 'bundler'

0 commit comments

Comments
 (0)
0