Changeset 6140

Show
Ignore:
Timestamp:
11/27/06 22:35:02
Author:
jan
Message:

doc

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/README

    r6138 r6140  
    3131== Installation 
    3232 
    33 You need to have Ruby and rubygems installed. The Windows version of Ruby already ships with gem. 
    34 On Debian systems (testing) you can install it using apt-get: 
     33You need to have Ruby and rubygems installed. The Windows version of Ruby already ships with rubygems  
     34preinstalled. On Debian systems (testing) you can install it using apt-get: 
    3535   
    3636  % apt-get install rubygems 
     
    3939 
    4040  % gem install rake 
     41  % gem install builder 
    4142  % gem install rjb 
    42   % gem install builder 
    4343   
    44 The installation of Rjb requires that the JDK is installed and JAVA_HOME set up 
    45 accordingly. Finally jerbil needs to be installed: 
     44The installation of Rjb can be a bit tricky for non-Windows users because  
     45JAVA_HOME needs to be set up correctly. Also, a C compiler is required in order to  
     46build the JNI extension for Ruby. 
     47 
     48Finally jerbil needs to be installed: 
    4649 
    4750  % gem install jerbil --source http://code.trampolinesystems.com 
     
    6669        Jerbil::JavacTask.new(:compile, FILES)  
    6770 
    68 The JVM gets loaded once via the +load_jvm+ method. This initialization step is 
     71The JVM gets loaded once via the Jerbil::JavaHelper load_jvm method. This initialization step is 
    6972required, otherwise the task will fail. <tt>Jerbil::JavacTask.new(:compile, FILES)</tt> 
    7073defines a new task (<tt>:compile</tt>) which will compile all Java files found in directory 
    7174+src+ to +build+. 
    7275 
     76=== Debugging 
     77 
     78As all the code runs in a single JVM, debugging can only be enabled on a global level. 
     79Just add the environment variable +JAVA_DEBUG+.  
     80 
     81  % JAVA_DEBUG='1' rake test 
     82 
     83This will load the JVM in debug mode, listening on port 8000. To specify a different port, 
     84use JAVA_DEBUG='port=33333'. Adding +suspend+ to the +JAVA_DEBUG+ environment will suspend execution 
     85until the debugging client connects. 
     86 
     87=== Specifiying additional jvm options 
     88 
     89  % JAVA_OPTS = '-Xmx=256M' rake test 
     90or 
     91  load_jvm(CLASSPATH, BUILD, :java_opts=>"-Xmx=256M") 
     92   
    7393== Example 
    7494 
     
    7696in the repository. 
    7797 
    78   % svn checkout http://svn.trampolinesystems.com/jerbil/trunk/example 
     98  % svn co http://svn.trampolinesystems.com/jerbil/trunk/example 
    7999 
    80100== Advantages over Ant 
     
    87107  MODULES = [ "common", "core", "server" ] 
    88108  MODULES.each_with_index do |m,i| 
    89     Jerbil::JavacTask.new("compile_#{m}") do |jct| 
    90       jct.java_files = JavaFileList.new(File.join(m,SOURCE_DIR), JAVA_BUILD_DIR) 
    91       MODULES[0..i-1].each {|prev| jct.depends_on "compile_#{prev}" } if i>0 
     109    Jerbil::JavacTask.new("compile_#{m}") do |t| 
     110      t.java_files = JavaFileList.new(File.join(m,SRC_DIR), DST_DIR) 
     111      MODULES[0..i-1].each { 
     112        |prev| t.depends_on "compile_#{prev}"  
     113      } if i>0 
    92114    end 
    93115  end 
    94116 
    95 This snippet creates several build targets (:compile_common, :compile_core, :compile_server)  
    96 including correct dependencies
     117This snippet creates several build targets (+:compile_common+, +:compile_core+, 
     118+:compile_server+) including correct dependency setup
    97119 
    98120Lastly, all the tasks run in one single JVM, speeding up the build significantly. 
  • trunk/lib/jerbil/java_helper.rb

    r6138 r6140  
    9090      #need verbose java exceptions 
    9191      $VERBOSE = true 
    92     
     92     
     93      guess_java_home   
     94      java_home = options[:java_home] || ENV['JAVA_HOME'] 
     95       
     96      puts "using JDK in #{java_home}" if Rake.application.options.trace 
     97       
    9398      #include tools.jar from JDK (needed for javac etc.) 
    94       guess_java_home 
    95        
    96       java_home =  options[:java_home] || ENV['JAVA_HOME'] 
    97        
    98       puts "using JDK in #{java_home}" if Rake.application.options.trace 
    99        
    10099      classpath.include(File.join(java_home, "lib", "tools.jar")) if java_home     
    101100      #include custom classloader 
     
    108107      if ENV['JAVA_DEBUG'] 
    109108        suspend = ENV['JAVA_DEBUG'].to_s.index('suspend') ? 'y' : 'n' 
     109        port = 8000 
     110        if ENV['JAVA_DEBUG'] =~ /port=([0-9]+)/ 
     111          port = $1 
     112        end 
     113        
    110114        jvmargs += [ 
    111115        "-Xdebug", 
    112116        "-Xnoagent", 
    113         "-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=#{suspend}" ] 
    114       end 
    115        
    116       #java_home = ENV['JAVA_HOME']     
    117       #ENV['LD_LIBRARY_PATH'] = "#{java_home}/jre/lib/i386:#{java_home}/jre/lib/i386/client" 
    118        
    119       #puts "lib:" + ENV['LD_LIBRARY_PATH'] 
    120       #jvmargs << "-Djava.library.path=#{ENV['JAVA_HOME']}/jre/lib/i386" 
    121        
     117        "-Xrunjdwp:transport=dt_socket,address=#{port},server=y,suspend=#{suspend}" ] 
     118      end 
     119          
    122120      if build_dir 
    123121        jerbil_debug = ENV['JERBIL_DEBUG'] ? 'true' : 'false'