Permalink
Browse files

Use JRake to build project, strip out JNI libs from jruby.jar

  • Loading branch information...
1 parent be138b2 commit 3129e378a1590e131ecd7f6ba9a4645d82c6e1d3 @jberkel jberkel committed May 25, 2010
Showing with 33 additions and 10 deletions.
  1. +1 −0 .gitignore
  2. +32 −10 Rakefile
View
@@ -3,3 +3,4 @@ gen
tmp
nbproject/private
local.properties
+generated_libs
View
@@ -1,19 +1,41 @@
+raise "Needs JRuby 1.5" unless RUBY_PLATFORM =~ /java/
+require 'ant'
require 'rake/clean'
-stdlib = File.join(File.dirname(__FILE__), "libs/jruby-stdlib.jar")
-stdlib_precompiled = File.join(File.dirname(__FILE__), "libs/jruby-stdlib-precompiled.jar")
-dirs = ['tmp/ruby', 'tmp/precompiled']
-
-CLEAN << 'tmp'
+generated_libs = 'generated_libs'
+stdlib = 'libs/jruby-stdlib.jar'
+jruby_jar = 'libs/jruby.jar'
+stdlib_precompiled = File.join(generated_libs, 'jruby-stdlib-precompiled.jar')
+jruby_ruboto_jar = File.join(generated_libs, 'jruby-ruboto.jar')
+ant.property :name=>'external.libs.dir', :value => generated_libs
+dirs = ['tmp/ruby', 'tmp/precompiled', generated_libs]
dirs.each { |d| directory d }
+CLEAN.include('tmp', 'bin', generated_libs)
+
+ant_import
+
file stdlib_precompiled => :compile_stdlib
+file jruby_ruboto_jar => generated_libs do
+ ant.zip(:destfile=>jruby_ruboto_jar) do
+ zipfileset(:src=>jruby_jar) do
+ exclude(:name=>'jni/**')
+ end
+ end
+end
desc "precompile ruby stdlib"
task :compile_stdlib => [:clean, *dirs] do
- Dir.chdir('tmp/ruby') {
- sh "jar xfv #{stdlib}"
- sh "jrubyc . -t ../precompiled"
- }
- sh "jar cfv libs/jruby-stdlib-precompiled.jar -C tmp/precompiled ."
+ ant.unzip(:src=>stdlib, :dest=>'tmp/ruby')
+ Dir.chdir('tmp/ruby') { sh "jrubyc . -t ../precompiled" }
+ ant.zip(:destfile=>stdlib_precompiled, :basedir=>'tmp/precompiled')
end
+
+task :generate_libs => [generated_libs, jruby_ruboto_jar] do
+ cp stdlib, generated_libs
+end
+
+task :debug => :generate_libs
+task :release => :generate_libs
+
+task :default => :debug

0 comments on commit 3129e37

Please sign in to comment.