Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

backport rakefile so luis can package for win32

git-svn-id: svn://rubyforge.org/var/svn/mongrel/tags/rel_1-0-4@836 19e92222-5c0b-0410-8929-a290d50e31e9
  • Loading branch information...
commit 936af1c02591f51247563513f5e595b09396473e 1 parent afe984c
evanweaver authored
Showing with 69 additions and 13 deletions.
  1. +69 −13 Rakefile
View
82 Rakefile
@@ -6,8 +6,8 @@ require 'echoe'
e = Echoe.new("mongrel") do |p|
p.summary = "A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps."
p.author ="Zed A. Shaw"
- p.clean_pattern = ['ext/http11/*.{bundle,so,o,obj,pdb,lib,def,exp}', 'ext/http11/Makefile', 'pkg', 'lib/*.bundle', '*.gem', 'site/output', '.config']
- p.rdoc_pattern = ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc', 'ext/http11/http11.c']
+ p.clean_pattern = ['ext/http11/*.{bundle,so,o,obj,pdb,lib,def,exp}', 'ext/http11/Makefile', 'pkg', 'lib/*.bundle', '*.gem', 'site/output', '.config', 'lib/http11.jar', 'ext/http11_java/classes', 'coverage']
+ p.rdoc_pattern = ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc']
p.ignore_pattern = /^(pkg|site|projects|doc|log)|CVS|\.log/
p.ruby_version = '>= 1.8.4'
p.dependencies = ['gem_plugin >=0.2.3', 'cgi_multipart_eof_fix >=2.4']
@@ -15,8 +15,14 @@ e = Echoe.new("mongrel") do |p|
p.need_tar_gz = false
p.need_tgz = true
- p.certificate_chain = ['~/p/configuration/gem_certificates/mongrel/mongrel-public_cert.pem',
+ case RUBY_PLATFORM
+ when /mswin/
+ p.certificate_chain = ['~/gem_certificates/mongrel-public_cert.pem',
+ '~/gem_certificates/luislavena-mongrel-public_cert.pem']
+ else
+ p.certificate_chain = ['~/p/configuration/gem_certificates/mongrel/mongrel-public_cert.pem',
'~/p/configuration/gem_certificates/evan_weaver-mongrel-public_cert.pem']
+ end
p.eval = proc do
case RUBY_PLATFORM
@@ -24,6 +30,10 @@ e = Echoe.new("mongrel") do |p|
extensions.clear
self.files += ['lib/http11.so']
self.platform = Gem::Platform::WIN32
+ when /java/
+ extensions.clear
+ self.files += ['lib/http11.jar']
+ self.platform = 'jruby'
else
add_dependency('daemons', '>= 1.0.3')
add_dependency('fastthread', '>= 1.0.1')
@@ -42,6 +52,21 @@ task :ragel do
sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}"
raise "Failed to build C source" unless File.exist? target
end
+ Dir.chdir "ext/http11" do
+ target = "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java"
+ File.unlink target if File.exist? target
+ sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}"
+ raise "Failed to build Java source" unless File.exist? target
+ end
+end
+
+#### XXX Hack around JRuby test/unit interaction problems
+
+desc "Run each test suite in isolation on JRuby"
+task :test_java do
+ e.test_pattern.each do |f|
+ sh "/opt/local/jruby/bin/jruby -w -Ilib:ext:bin:test -e 'require \"#{f}\"'" rescue nil
+ end
end
#### XXX Hack around RubyGems and Echoe for pre-compiled extensions.
@@ -50,13 +75,42 @@ def move_extensions
Dir["ext/**/*.#{Config::CONFIG['DLEXT']}"].each { |file| cp file, "lib/" }
end
+def java_classpath_arg
+ # A myriad of ways to discover the JRuby classpath
+ classpath = begin
+ require 'java'
+ # Already running in a JRuby JVM
+ Java::java.lang.System.getProperty('java.class.path')
+ rescue LoadError
+ ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] && FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
+ end
+ classpath ? "-cp #{classpath}" : ""
+end
+
case RUBY_PLATFORM
when /mswin/
filename = "lib/http11.so"
- file filename do
- cp "#{filename}.win32", filename
+ file filename do
+ Dir.chdir("ext/http11") do
+ ruby "extconf.rb"
+ system(PLATFORM =~ /mswin/ ? 'nmake' : 'make')
+ end
+ move_extensions
end
task :compile => [filename]
+
+when /java/
+ filename = "lib/http11.jar"
+ file filename do
+ build_dir = "ext/http11_java/classes"
+ mkdir_p build_dir
+ sources = FileList['ext/http11_java/**/*.java'].join(' ')
+ sh "javac -target 1.4 -source 1.4 -d #{build_dir} #{java_classpath_arg} #{sources}"
+ sh "jar cf lib/http11.jar -C #{build_dir} ."
+ move_extensions
+ end
+ task :compile => [filename]
+
end
#### Project-wide install and uninstall tasks
@@ -79,6 +133,8 @@ task :package_all => [:package] do
sub_project("mongrel_console", :package)
sub_project("mongrel_cluster", :package)
sub_project("mongrel_service", :package) if RUBY_PLATFORM =~ /mswin/
+ sh("rake java package") unless RUBY_PLATFORM =~ /java/
+ # sh("rake mswin package") unless RUBY_PLATFORM =~ /mswin/
end
task :install_requirements do
@@ -136,8 +192,8 @@ namespace :site do
FileList["**/*.tgz"].each {|tgz| mv tgz, "pkg/tars" }
# XXX Hack, because only Luis can package for Win32 right now
- sh "cp ~/Downloads/mongrel-#{e.version}-mswin32.gem pkg/gems/"
- sh "cp ~/Downloads/mongrel_service-0.3.3-mswin32.gem pkg/gems/"
+ # sh "cp ~/Downloads/mongrel-#{e.version}-mswin32.gem pkg/gems/"
+ # sh "cp ~/Downloads/mongrel_service-0.3.3-mswin32.gem pkg/gems/"
sh "rm -rf pkg/mongrel*"
sh "gem generate_index -d pkg"
sh "scp -r CHANGELOG pkg/* rubyforge.org:/var/www/gforge-projects/mongrel/releases/"
@@ -149,21 +205,21 @@ namespace :site do
desc "Upload the website"
task :web do
# Requires the 'webgem' gem and the 'atom-tools' gem
- sh "cd site; webgen; ruby atom.rb > output/feed.atom; rsync -azv --no-perms --no-times output/* rubyforge.org:/var/www/gforge-projects/mongrel/"
+ sh "cd site; webgen; webgen; ruby atom.rb > output/feed.atom; rsync -azv --no-perms --no-times output/* rubyforge.org:/var/www/gforge-projects/mongrel/"
end
desc "Upload the rdocs"
- task :rdoc => [:redoc] do
- sh "rsync -azv doc/* rubyforge.org:/var/www/gforge-projects/mongrel/rdoc/"
- sh "cd projects/gem_plugin; rake site"
+ task :rdoc => [:doc] do
+ sh "rsync -azv --no-perms --no-times doc/* rubyforge.org:/var/www/gforge-projects/mongrel/rdoc/"
+ sh "cd projects/gem_plugin; rake site:rdoc"
end
desc "Upload the coverage report"
task :coverage => [:rcov] do
- sh "rsync -azv test/coverage/* rubyforge.org:/var/www/gforge-projects/mongrel/coverage/"
+ sh "rsync -azv --no-perms --no-times test/coverage/* rubyforge.org:/var/www/gforge-projects/mongrel/coverage/" rescue nil
end
desc "Upload the website, the rdocs, and the coverage report"
- task :all => [:web, :rdoc, :coverage]
+ task :all => [:clean, :web, :rdoc, :coverage]
end
Please sign in to comment.
Something went wrong with that request. Please try again.