buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djspie...@apache.org
Subject svn commit: r787487 - /buildr/trunk/lib/buildr/core/shell.rb
Date Tue, 23 Jun 2009 00:07:18 GMT
Author: djspiewak
Date: Tue Jun 23 00:07:17 2009
New Revision: 787487

URL: http://svn.apache.org/viewvc?rev=787487&view=rev
Log:
JavaRebel + JRUBY_HOME launch

Modified:
    buildr/trunk/lib/buildr/core/shell.rb

Modified: buildr/trunk/lib/buildr/core/shell.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/shell.rb?rev=787487&r1=787486&r2=787487&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/shell.rb (original)
+++ buildr/trunk/lib/buildr/core/shell.rb Tue Jun 23 00:07:17 2009
@@ -17,20 +17,48 @@
       end
       
       def launch
-        if jruby_home and not rebel_home     # if JRuby is installed, use it for non-JavaRebel
-          cp = project.compile.dependencies.join(File::PATH_SEPARATOR) + 
-            File::PATH_SEPARATOR + project.path_to(:target, :classes)
-          
-          cp_var = ENV['CLASSPATH']
-          if cp_var
-            ENV['CLASSPATH'] += File::PATH_SEPARATOR
-          else
-            ENV['CLASSPATH'] = ''
+        if jruby_home     # if JRuby is installed, use it
+          cp = project.compile.dependencies + 
+            [project.path_to(:target, :classes)] +
+            Dir.glob("#{jruby_home}#{File::SEPARATOR}lib#{File::SEPARATOR}*.jar")
+          
+          props = {
+            'jruby.home' => jruby_home,
+            'jruby.lib' => "#{jruby_home}#{File::SEPARATOR}lib"
+          }
+          
+          if not Util.win_os?
+            uname = `uname -m`
+            cpu = if uname =~ /i[34567]86/
+              'i386'
+            elsif uname == 'i86pc'
+              'x86'
+            elsif uname =~ /amd64|x86_64/
+              'amd64'
+            end
+            
+            os = `uname -s | tr '[A-Z]' '[a-z]'`
+            path = if os == 'darwin'
+              'darwin'
+            else
+              "#{os}-#{cpu}"
+            end
+            
+            props['jna.boot.library.path'] = "#{jruby_home}/lib/native/#{path}"
           end
-          ENV['CLASSPATH'] += cp
           
-          trace "Running jirb using JRUBY_HOME: #{jruby_home}"
-          system(File.expand_path('bin/jirb' + SUFFIX, jruby_home))
+          props['jruby.script'] = if Utils.win_os? then 'jruby.bat' else 'jruby' end
+          props['jruby.shell'] = if Utils.win_os? then 'cmd.exe' else '/bin/sh' end
+          
+          args = [
+            "-Xbootclasspath/a:#{Dir.glob(jruby_home + '/lib/jruby*.jar').join File::PATH_SEPARATOR}"
+          ]
+          
+          Java::Commands.java 'org.jruby.Main', "#{jruby_home}/bin/jirb", {
+            :properties => props.merge(rebel_props project),
+            :classpath => cp,
+            :java_args => args + rebel_args
+          }
         else
           cp = project.compile.dependencies + [
               "org.jruby:jruby-complete:jar:#{JRUBY_VERSION}",



Mime
View raw message