ruby / ruby/rbs

Native extension use in Gemfile prevents bundling on JRuby

Open
#2,432 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.2k
Forks
256
Avg merge
6d 17h
Merged PRs (30d)
37

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Gemfile and inspect the listed dependencies and their platform declarations, then verify dependency resolution on JRuby. Check the tests that fail when these gems are unavailable; done means JRuby can bundle the project without unsupported native extensions while the relevant tests are handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.