Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable JRuby and Rubinius 1.9 mode in Travis #24

Closed

Conversation

kyledrake
Copy link
Contributor

JRuby 1.7 and RBX 2.0.0rc1 seem to be stable for Grocer, so I thought it would be nice to try again and see if it passes on Travis as well. Multithreaded APNS FTW

@stevenharman
Copy link
Member

RBX looks good, but Travis seems to be failing on the JRuby in 1.9 mode.

LoadError: no such file to load -- json

@alindeman Any thoughts?

@kyledrake
Copy link
Contributor Author

Aha! There is a json dependency in lib/grocer/notification.rb and lib/grocer/notification_reader.rb that are missing! That gem is not explicitly listed as a dependency in the gemspec. Let me fix that now.

@kyledrake
Copy link
Contributor Author

Let's try that..

@alindeman
Copy link
Member

json is in the standard library as of 1.9. No gem should be needed.

@alindeman
Copy link
Member

Ah, this latest failure points to JRuby's need for a gem to do SSL. We should add that conditionally in grocer.gemspec. Do you want to take it, @kyledrake? Otherwise I don't mind.

Thanks for pointing out that we are close on supporting JRuby.

@stevenharman
Copy link
Member

That's what I thought too. However, after a brand new install of JRuby 1.6.8

☺ $ ruby --1.9 --version
jruby 1.6.8 (ruby-1.9.2-p312) (2012-09-18 1772b40) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_37) [darwin-x86_64-java]
☺ $ jruby --1.9 -S irb
irb: RUBY_VERSION
===> "1.9.2"
irb: RUBY_PLATFORM
===> "java"
irb: JSON
NameError: uninitialized constant JSON
    from org/jruby/RubyModule.java:2647:in `const_missing'
    from /Users/steven/.rbenv/versions/jruby-1.6.8/lib/ruby/1.9/rake.rb:2482:in `const_missing'
    from (irb):3:in `evaluate'
    from org/jruby/RubyKernel.java:1117:in `eval'
    from org/jruby/RubyKernel.java:1439:in `loop'
    from org/jruby/RubyKernel.java:1226:in `catch'
    from org/jruby/RubyKernel.java:1226:in `catch'
    from /Users/steven/.rbenv/versions/jruby-1.6.8/bin/jirb:13:in `(root)'
irb: require 'json'
LoadError: no such file to load -- json
    from org/jruby/RubyKernel.java:1071:in `require'
    from /Users/steven/.rbenv/versions/jruby-1.6.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from (irb):4:in `evaluate'
    from org/jruby/RubyKernel.java:1117:in `eval'
    from org/jruby/RubyKernel.java:1439:in `loop'
    from org/jruby/RubyKernel.java:1226:in `catch'
    from org/jruby/RubyKernel.java:1226:in `catch'
    from /Users/steven/.rbenv/versions/jruby-1.6.8/bin/jirb:13:in `(root)'
irb: 

Then, after a gem install json

☺ $ jruby --1.9 -S irb
irb: JSON
NameError: uninitialized constant JSON
    from org/jruby/RubyModule.java:2647:in `const_missing'
    from /Users/steven/.rbenv/versions/jruby-1.6.8/lib/ruby/1.9/rake.rb:2482:in `const_missing'
    from (irb):1:in `evaluate'
    from org/jruby/RubyKernel.java:1117:in `eval'
    from org/jruby/RubyKernel.java:1439:in `loop'
    from org/jruby/RubyKernel.java:1226:in `catch'
    from org/jruby/RubyKernel.java:1226:in `catch'
    from /Users/steven/.rbenv/versions/jruby-1.6.8/bin/jirb:13:in `(root)'
irb: require 'json'
===> true
irb: JSON
===> JSON
irb: 

WTF?

@stevenharman
Copy link
Member

It seems that JRuby 1.7.0 (1.9.3p203) does include some version of json in the stdlib. So perhaps this is only a JRuby 1.6.8 issue? A bug on that platform/version combination, perhaps?

@alindeman
Copy link
Member

It seems that JRuby 1.7.0 (1.9.3p203) does include some version of json in the stdlib. So perhaps this is only a JRuby 1.6.8 issue? A bug on that platform/version combination, perhaps?

I seem to remember tweeting at @headius about this a while ago but I'm having trouble digging it up. From what I remember, json in the stdlib is a 1.7.0 addition.

@kyledrake
Copy link
Contributor Author

I will fix this shortly, thx for investigating!

On Thursday, November 15, 2012, Andy Lindeman wrote:

It seems that JRuby 1.7.0 (1.9.3p203) does include some version of json in
the stdlib. So perhaps this is only a JRuby 1.6.8 issue? A bug on that
platform/version combination, perhaps?

I seem to remember tweeting at @headius https://github.com/headiusabout this a while ago but I'm having trouble digging it up. From what I
remember, json in the stdlib is a 1.7.0 addition.


Reply to this email directly or view it on GitHubhttps://github.com/highgroove/grocer/pull/24#issuecomment-10433158.

@stevenharman
Copy link
Member

According to @vanstee, we can't fully support JRuby yet due to some issues with PKCS12 certs. See Issue #17.

To that end, what if we back JRuby out, for now, and just take in the RBX changes?

@stevenharman
Copy link
Member

Not to mention that we need to build two different versions of the gem, one for Ruby and one for JRuby so we can ensure the proper dependencies are installed. @alindeman mentioned using conditional dependencies, but those are only executed when the gem is built, not when it's installed.

So if we really want JRuby support, we'll need to automate the job of building both the standard, Ruby-only, gem and then a Java-only version. Nokogiri does just that (plus some other hacking for Windows support).

@kyledrake
Copy link
Contributor Author

@stevenharman I don't believe Grocer interfaces the PKCS12 directly, but uses PEM instead? If it's just PEM then I think JRuby works fine.

Here is the code snipping needed to do direct p12 processing via Ruby (with a command line shellout for JRuby): https://gist.github.com/3077989

@vanstee
Copy link
Member

vanstee commented Nov 16, 2012

@kyledrake jruby-head on travis seems to be green. Mind using that for now?

https://travis-ci.org/highgroove/grocer/builds/3232696

@kyledrake
Copy link
Contributor Author

@stevenharman The developer will be warned on jruby that they need to install jruby-openssl, correct. This is just for the Gemfile to fix the tests.

Platform specific gemset dependencies are not really a concept yet unfortunately AFAICT.

@stevenharman
Copy link
Member

Agreed that Rubygems doesn't support platform-specific dependencies.

I'd prefer a user to be able to install the gem and get all necessary dependencies installed - hence the need for two different gems: grocer-x.y.z.gem and grocer-x.y.z-java.gem. The required mechanics are a conditional dependency in the grocer.gemspec, and setting the platform.

gem.platform = 'java' if RUBY_PLATFORM == 'java'

gem.add_runtime_dependency('jruby-openssl') if RUBY_PLATFORM == 'java'

And then building the gem on both a Ruby-only platform, and then again on a JRuby platform. Of course, we should automate this. But perhaps that is outside the scope of what we're going for here?

@kyledrake
Copy link
Contributor Author

Yeah, I think that should be a separate thing and we should just merge this in for now. Most JRuby devs at this point will know about the jruby-openssl requirement. If this was a huge project the java version would be nice, but I think it's unneccessary here.

I made a note about it in the README that will inform developers that are not aware of this.

@stevenharman
Copy link
Member

Sounds legit.

@stevenharman
Copy link
Member

Damn it... hub confused me and I pushed before merging the last two commits. I've rebased them atop my change, so everything is good now.

Closed with d4d4279

@kyledrake
Copy link
Contributor Author

Thank you!!

@stevenharman
Copy link
Member

Thank you, sir!

@headius
Copy link

headius commented Nov 17, 2012

FWIW, JRuby 1.7+ ship jruby-openssl in the box, with optional updating via the gem. Targeting only 1.7+ would be completely fine as far as we're concerned...we want to get people off 1.6.x anyway.

And if you run into any issues in the future, please let us know.

@kyledrake
Copy link
Contributor Author

@headius Thanks for the info!

The one outstanding issue for us is this: jruby/jruby-ossl#8

We can't do p12 to pem conversion without a shell command in JRuby, which isn't the end of the world, but would be a nice feature to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants