[Rubygems-developers] Questions on 1.0.0 on JRuby

Stephen Bannasch stephen.bannasch at deanbrook.org
Tue Apr 8 00:05:00 EDT 2008

At 3:19 PM -0700 4/7/08, Eric Hodel wrote:
>Is there any particular reason why JRuby and Ruby can't use the same 
>gem repository?  (Currently Rubinius does not, but after reading this 
>thread, I think that may be a mistake).
>AFAIK, RubyGems is smart enough to pick a JRuby-platform gem only for 
>JRuby, and will Just Work if both the JRuby and non-JRuby platform 
>gems are installed.

I'll normally want to keep separate local repositories but ...

If I use the same gem repository for MRI 1.8.6 and JRuby what should happen when I am working in JRuby and install a gem like Hpricot that would normally compile a native C library when installed under MRI.

Hpricot comes with compiled Java class files in a jar which are used if  RUBY_PLATFORM =~ /java/ so there is nothing special to compile when installing it in JRuby.

But the general case for this kind of gem could include Java compilation when installed in JRuby and native C compilation when installed in 1.8 or 1.9.

While you don't normally have to do distributed compilation of Java code there could be a benefit if there are differences in performance between different versions of Java.

So that begs the reverse question -- what should happen when I install a Gem under MRI that compiles a native C library but also should compile a native Java library if installed for JRuby.

What should MRI do when asked to install a Gem that only works on Java? As long as there is no native compilation this should still work ...

Perhaps the platform-specific install tasks could be lazy ...

Scenario: when installing a Gem with JRuby and MRI 1.8.x native installation tasks under MRI only he MRI 1.8.x tasks are performed. The first time the Gem is accessed from JRuby he JRuby install tasks are performed.

I don't know enough about how Rubinius or Ruby 1.9 work with gems to include them in these questions.

If one local repository could work with multiple Ruby VMs it would certainly be nice.

More information about the Rubygems-developers mailing list