Re: [Ikvm-developers] Adding many resources with ikvmc
Brought to you by:
jfrijters
|
From: Jeroen F. <je...@su...> - 2009-04-29 12:48:35
|
Ah, good catch. Thanks! I will fix this asap (which probably means Friday). Regards, Jeroen ________________________________ From: aslak hellesoy [asl...@gm...] Sent: Wednesday, April 29, 2009 1:15 PM To: Jeroen Frijters Cc: Ikv...@li...; Charles Oliver Nutter Subject: Re: [Ikvm-developers] Adding many resources with ikvmc On Wed, Apr 29, 2009 at 1:06 PM, Jeroen Frijters <je...@su...<mailto:je...@su...>> wrote: Hi Aslak, Hmm. I'm not sure what's going on with my JRuby version, but I don't have jruby-complete.jar (just jruby.jar) and I also don't have any jruby-complete.jar is not in the zip/tgz distros. It can be found here: http://dist.codehaus.org/jruby/1.2.0/ jruby-complete.jar bundles .rb files inside, while jruby.jar does not. jruby.home file. jruby.home is not a file, but a directory inside jruby-complete.jar. It lives under META-INF/jruby.home IKVM doesn't seem to know how to find resources that are directories (and not files), so JRuby fails to load .rb files under IKVM. (This is because JRuby looks for that directory when it starts up. If it doesn't find it, it won't load .rb files in there even if they exist). Anyway, the -recurse you used will result in the META-INF directory part missing in the .exe resource names, so you'll have to use something like: mono ikvmc.exe -recurse:/Users/aslakhellesoy/scm/jruby/build/jar-complete/* ~/scm/jruby/lib/jruby-complete.jar BTW, given the directory/file names I'd assume that jruby-complete.jar already includes the META-INF/jruby.home resource in which case ikvmc will automatically include it, so maybe something else is going on? It might be class loader related, you could try using the ikvmc option: -classloader:ikvm.runtime.ClassPathAssemblyClassLoader that will result in the jruby-complete.exe class loader also being able to load from the CLASSPATH. Regards, Jeroen ________________________________ From: aslak hellesoy [asl...@gm...<mailto:asl...@gm...>] Sent: Wednesday, April 29, 2009 11:42 AM To: Jeroen Frijters Cc: Ikv...@li...<mailto:Ikv...@li...>; Charles Oliver Nutter Subject: Re: [Ikvm-developers] Adding many resources with ikvmc Hi Aslak, I'm using JRuby 1.2 RC2 and I didn't run into that when compiling jruby.jar, but ikvmc does have a switch to include an entire subtree as I'm on JRuby 1.2 and there shouldn't be any major differences there. Have you tried this? mono jruby-complete.exe -S gem list I get: no such file to load -- rubygems This is probably because it can't find /META-INF/jruby.home inside the exe (see below). resources (or classes): -recurse:/path/* Thanks - it wasn't clear to me that -recurse also works for resources. Looking at the source I see it now. Here is what I tried: mono ikvmc.exe -recurse:/Users/aslakhellesoy/scm/jruby/build/jar-complete/META-INF/* ~/scm/jruby/lib/jruby-complete.jar This doesn't seem to work though. JRuby tries to do this in RubyInstanceConfig.java: jrubyHome = getClass().getResource("/META-INF/jruby.home") Now, this is a "directory", and it evaluates to null. Does IKVM know how to get "directory" resources or does it only work with files? One you have to look out for though, is that you specify the right directory, because to get the resource names to match the relative directory names have to be from the right directory depth. I see. Does my -recurse argument above look right or should I specify it differently? Cheers, Aslak Thanks, Jeroen ________________________________ From: aslak hellesoy [asl...@gm...<mailto:asl...@gm...>] Sent: Wednesday, April 29, 2009 11:12 AM To: Ikv...@li...<mailto:Ikv...@li...> Cc: Charles Oliver Nutter Subject: [Ikvm-developers] Adding many resources with ikvmc Hi there, After seeing Jeroen's excellent presentation on IKVM at the Roots conference in Bergen yesterday I decided to package JRuby for IKVM. In order to reduce JRubys' startup time I need to ikvmc jruby-complete.jar. That actually reduced startup time from 30 secs to about 2. Good! However, If I try to run ruby code that tries to load some of the Ruby standard library files I run into problems. jruby-complete.jar bundles the Ruby standard libraries as a lot of .rb files located under /META-INF/jruby.home and it seems that these files are not automatically included in the generated jruby-complete.exe. JRuby loads these with plain old getClass().getResource(). I know there is a -resource flag I can pass to ikvmc, but it doesn't seem to work with directories. It's unpractical to enumerate all the files to include - there are hundreds of them. Any advice on how to package up all the .rb resources inside the exe? Is there a switch I don't know about or would this require a change to ikvmc? If a change is needed, do you have any pointers on where I can start looking? Thanks a lot for a fantastic product! Cheers, Aslak |