rbs icon indicating copy to clipboard operation
rbs copied to clipboard

Native extension use in Gemfile prevents bundling on JRuby

Open headius opened this issue 8 months ago • 0 comments

There are dependencies on some native extensions not supported by JRuby (or supported, but not in the standard gems):

  • The dbm native extension library is not supported by JRuby, but it is a dependency in the stdlib tests section.
  • The pathname gem does not include native support for JRuby. We ship our own pure-Ruby pathname that has not been merged into the gem (https://github.com/ruby/pathname/issues/17).
  • rubocop-on-rbs gem has a dependency on zlib, which does not currently ship JRuby's extension (https://github.com/ruby/zlib/issues/38).
  • stackprof is a native extension specific to CRuby and not supported on JRuby.

Additionally, memory_profiler depends on CRuby-specific features and probably isn't useful on JRuby.

The following diff limits these gems to the ruby platform, but of course some tests fail when they are not available.

diff --git a/Gemfile b/Gemfile
index 095664ff..73cee00c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,7 +10,7 @@ gem "test-unit"
 gem "rspec"
 gem "rubocop"
 gem "rubocop-rubycw"
-gem "rubocop-on-rbs"
+gem "rubocop-on-rbs", platform: :ruby
 gem "json"
 gem "json-schema"
 gem "goodcheck"
@@ -26,16 +26,16 @@ group :libs do
   gem "abbrev"
   gem "base64"
   gem "bigdecimal"
-  gem "dbm"
+  gem "dbm", platform: :ruby
   gem "mutex_m"
   gem "nkf"
-  gem "pathname"
+  gem "pathname", platform: :ruby
 end
 
 group :profilers do
   # Performance profiling and benchmarking
-  gem 'stackprof'
-  gem 'memory_profiler'
+  gem 'stackprof', platform: :ruby
+  gem 'memory_profiler', platform: :ruby
   gem 'benchmark-ips'
   gem "ruby_memcheck", platform: :ruby
 end

headius avatar Apr 25 '25 14:04 headius