about summary refs log tree commit homepage
path: root/Rakefile
diff options
context:
space:
mode:
authornicksieger <nicksieger@19e92222-5c0b-0410-8929-a290d50e31e9>2007-10-17 05:17:17 +0000
committernicksieger <nicksieger@19e92222-5c0b-0410-8929-a290d50e31e9>2007-10-17 05:17:17 +0000
commit0c1c2b072bbfa96f75e45fb07449087f298cb5ab (patch)
treef713789cd0b3469ecbc2b8e1b7628882f5f763fe /Rakefile
parent26d35952d29d028401254e47ba1f2ad2c9a167fb (diff)
downloadunicorn-0c1c2b072bbfa96f75e45fb07449087f298cb5ab.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@668 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile25
1 files changed, 21 insertions, 4 deletions
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