From 0c1c2b072bbfa96f75e45fb07449087f298cb5ab Mon Sep 17 00:00:00 2001 From: nicksieger Date: Wed, 17 Oct 2007 05:17:17 +0000 Subject: Getting compile and build of jruby jar working git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@668 19e92222-5c0b-0410-8929-a290d50e31e9 --- Rakefile | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 5d97d75..8d7b5ce 100644 --- a/Rakefile +++ b/Rakefile @@ -20,6 +20,8 @@ Echoe.new("mongrel") do |p| when /mswin/ p.certificate_chain = ['~/gem_certificates/mongrel-public_cert.pem', '~/gem_certificates/luislavena-mongrel-public_cert.pem'] + when /java/ + p.clean_pattern += ["lib/http11.jar"] else p.certificate_chain = ['~/p/configuration/gem_certificates/mongrel/mongrel-public_cert.pem', '~/p/configuration/gem_certificates/evan_weaver-mongrel-public_cert.pem'] @@ -31,10 +33,10 @@ Echoe.new("mongrel") do |p| extensions.clear self.files += ['lib/http11.so'] self.platform = Gem::Platform::WIN32 - when /jruby/ + when /java/ extensions.clear self.files += ['lib/http11.jar'] - self.platform = 'jruby' + self.platform = 'jruby' else add_dependency('daemons', '>= 1.0.3') add_dependency('fastthread', '>= 1.0.1') @@ -61,13 +63,28 @@ when /mswin/ end task :compile => [filename] -when /jruby/ +when /java/ filename = "lib/http11.jar" + def java_classpath_arg # myriad of ways to discover JRuby classpath + begin + require 'java' # already running in a JRuby JVM + jruby_cpath = Java::java.lang.System.getProperty('java.class.path') + rescue LoadError + end + unless jruby_cpath + jruby_cpath = ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] && + FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR) + end + cpath_arg = jruby_cpath ? "-cp #{jruby_cpath}" : "" + end file filename do - Dir.chdir("ext/http11_java") { sh "ant jar" } + mkdir_p "pkg/classes" + sh "javac -target 1.4 -source 1.4 -d pkg/classes #{java_classpath_arg} #{FileList['ext/http11_java//**/*.java'].join(' ')}" + sh "jar cf lib/http11.jar -C pkg/classes/ ." move_extensions end task :compile => [filename] + end #### Project-wide install and uninstall tasks -- cgit v1.2.3-24-ge0c7