On Sat, Sep 27, 2008 at 9:13 AM, lacton <[EMAIL PROTECTED]> wrote:
> Thank you for your explanation, Assaf.
>
> I still find the whole rjb/jruby business tricky to understand, but
> I'm not going to complain since it's one of the feature I like a lot
> in buildr. :-)

Unfortunately.  Life would be easier if we could only use one, but
neither is good for all purposes.

Short version is, most people who will work with Java and Ruby will
use the JRuby API.  So rjb.rb goes through a bit of pain to emulate
JRuby, which is not perfect, but good enough for anything we try to do
from Buildr.

JRuby loads the VM once, and then we need to mess with the root
classpath to add some dependencies that can't live anywhere else (Ant,
JavaDoc doclets, etc).  That part is easy.

But RJB doesn't allow us to change the root classpath after the fact,
so we need to set it first (all that Java.classpath << lines) and only
then load the VM.  So Java.load does the lazy-loading for RJB, and
emulates that behavior for JRuby.

Assaf

>
> Lacton
>
> On Tue, Sep 23, 2008 at 11:23 PM, Assaf Arkin <[EMAIL PROTECTED]> wrote:
>> On Tue, Sep 23, 2008 at 1:52 PM, lacton <[EMAIL PROTECTED]> wrote:
>>> Assaf,
>>>
>>> Will you tell me what was wrong with the way I tried to factor common
>>> code between commands.rb, jruby.rb and rjb.rb?
>>
>> Because I prefer to tightly couple the tools_jar and load methods of
>> each module, then to tightly couple the modules together.
>>
>> Generally when I troubleshoot code, I'm either working against rjb.rb
>> or jruby.rb, depending on which platform I'm using.  It's much more
>> convenient to have all the code in one place, then spread it out.
>>
>> And it hides a distinction that exists between these modules: RJB's
>> tool_jars method brings with it a dependency on setting JAVA_HOME,
>> JRuby doesn't.  By having two separate methods to begin with, it's
>> easier when looking at rjb.rb to notice that JAVA_HOME is only
>> referenced once, and only by tools_jar, and to move it there from the
>> load method, where it was before.
>>
>> Assaf
>

Reply via email to