It's been a while since I was able to work on JRuby's Android support, but tonight I managed to finally circle back. And I've got something much more impressive working today: a real IRB application!
(And yes, this works just fine on the phone too)
It turned out to be incredibly easy to get this working. I'm not using any stinking plugin because they all seemed to just get in my way. So I generated a dummy application using the "android" tool, dropped the jruby jar in "libs", wrote up a quick interactive console, built and signed it, and that's all there was to it.
JRuby turns out to work very well for this sort of thing because we have an interpreter, so we can parse and execute code dynamically. Hooray for interpreted support!
I had to tweak a couple things to work around shortcomings in Android:
- I had to edit the dx tool to allow up to a 1024M heap, since JRuby's jar has a ton of stuff in it
- I had to catch and swallow an ArrayIndexOutOfBounds exception coming out of Dalvik's enum support. Bug!
- Ability to run 100% precompiled with no runtime code generation
- Strip out parser, interpreter, compiler, and bytecode-generation bits to shrink the jar
- Tidy up the AOT compiler and wire it into the app build process
- Generate some Ruby stub logic for the Android APIs, so they'll work well from Ruby
- Strip down the weirder and wilder Ruby features (eval, etc) to allow fastest-possible execution
I've pushed ruboto-irb to Github so you can check it out and play with it. I welcome contributors :)