Hi Keith,
As you mentioned, you have the following in your gemspec:
unless /java/ === RUBY_PLATFORM spec.add_dependency 'rjb' end
The gemspec file is the description of how to package your gem, so the
RUBY_PLATFORM here will be the one of the ruby you use to build/package
your gem, not the one you�ll be using at runtime. This means you have
to package the gem for MRI with MRI, and the gem for JRuby with JRuby.
I am not sure what your library contains, but typically a MRI extension
contains C code, and a JRuby extension contains Java code �
rake-compiler comes in handy to handle cross-compilation, but you don�t
have to use it. The documentation is still useful to understand the
whole process.
Regards,
S�bastien.
Le 12/06/2013 22:15, Keith Bennett a �crit :
> Sebastien -
>
> I've been trying to get your instructions to work but have been unable.
> I've tried the following:
>
> > rake native gem # in MRI
> ...Don't know how to build task 'ext/my_gem_name/extconf.rb'...
>
> > rake java gem # in JRuby
> ...javac: no source files...
>
> > rake gem
> ...Don't know how to build task 'gem'...
>
> I gem installed rake-compiler. Is it not there?
>
> In my case, I don't need to compile anything. The *only* difference is
> that MRI has a dependency that JRuby does not (RJB). What am I doing wrong?
>
> - Keith
>
>
>
> On Wed, Jun 12, 2013 at 4:00 PM, S�bastien Le Callonnec <
slc...@yahoo.ie
> <mailto:
slc...@yahoo.ie>> wrote:
>
> Hi Keith,
>
> You do need to create a separate gem for the different platforms �
> thankfully, rake-compiler
> (
https://github.com/__luislavena/rake-compiler
> <
https://github.com/luislavena/rake-compiler>) makes it easy to do so.
> I had described how over at SO
> (
http://stackoverflow.com/a/__13540730/289466
> <
http://stackoverflow.com/a/13540730/289466>), but I should probably
> stick that somewhere in the wiki too.
>
> Regards,
> S�bastien.
>
> Le mer. 12 juin 2013 19:26:12 IST, Keith Bennett a �crit :
>
> Hi, everyone.
>
> I'm writing a gem that can be used from both MRI Ruby and JRuby to
> talk to a Java library in a jar file. In JRuby talking to the Java
> library requires no special configuration, but from MRI Ruby I
> need to
> use the rjb (Ruby Java Bridge) gem.
> So, I want to install the rjb gem if in MRI Ruby, bot want *not* to
> install it if in JRuby, since it requires some native building.
> I have this in my gemspec, which works fine:
> unless /java/ === RUBY_PLATFORM spec.add_dependency 'rjb' end
> However, when I run bundle in MRI, the resulting Gemfile.lock
> contains
> the rjb dependency without any condition not to use it in JRuby:
> ... rake (10.0.4) rjb (1.4.6) rspec (2.13.0)...So if I
> build
>
> the gem, distribute it, and then gem install it in JRuby, the gem
> install tries to build rjb, and fails because of the native
> extensions.
> What's the best way to deal with this? Should I duplicate the gem
> dependencies, putting them in the Gemfile instead of the 'gemspec'
> that's there now? Or build two different gems (I hope not)?
> Thanks,Keith
>
>
> ------------------------------__------------------------------__---------
> To unsubscribe from this list, please visit:
>
>
http://xircles.codehaus.org/__manage_email
> <
http://xircles.codehaus.org/manage_email>