Changeset 836

Show
Ignore:
Timestamp:
10/29/07 16:25:19 (10 months ago)
Author:
evanweaver
Message:

backport rakefile so luis can package for win32

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tags/rel_1-0-4/Rakefile

    r828 r836  
    77  p.summary = "A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps." 
    88  p.author ="Zed A. Shaw" 
    9   p.clean_pattern = ['ext/http11/*.{bundle,so,o,obj,pdb,lib,def,exp}', 'ext/http11/Makefile', 'pkg', 'lib/*.bundle', '*.gem', 'site/output', '.config'
    10   p.rdoc_pattern = ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc', 'ext/http11/http11.c'
     9  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'
     10  p.rdoc_pattern = ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc'
    1111  p.ignore_pattern = /^(pkg|site|projects|doc|log)|CVS|\.log/ 
    1212  p.ruby_version = '>= 1.8.4' 
     
    1616  p.need_tgz = true 
    1717 
    18   p.certificate_chain = ['~/p/configuration/gem_certificates/mongrel/mongrel-public_cert.pem',  
     18  case RUBY_PLATFORM  
     19  when /mswin/ 
     20    p.certificate_chain = ['~/gem_certificates/mongrel-public_cert.pem',  
     21      '~/gem_certificates/luislavena-mongrel-public_cert.pem'] 
     22  else 
     23    p.certificate_chain = ['~/p/configuration/gem_certificates/mongrel/mongrel-public_cert.pem',  
    1924      '~/p/configuration/gem_certificates/evan_weaver-mongrel-public_cert.pem'] 
     25  end 
    2026 
    2127  p.eval = proc do   
     
    2531      self.files += ['lib/http11.so'] 
    2632      self.platform = Gem::Platform::WIN32 
     33    when /java/ 
     34      extensions.clear 
     35      self.files += ['lib/http11.jar'] 
     36      self.platform = 'jruby' 
    2737    else 
    2838      add_dependency('daemons', '>= 1.0.3') 
     
    4353    raise "Failed to build C source" unless File.exist? target 
    4454  end 
     55  Dir.chdir "ext/http11" do 
     56    target = "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java" 
     57    File.unlink target if File.exist? target 
     58    sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" 
     59    raise "Failed to build Java source" unless File.exist? target 
     60  end 
     61end 
     62 
     63#### XXX Hack around JRuby test/unit interaction problems 
     64 
     65desc "Run each test suite in isolation on JRuby" 
     66task :test_java do 
     67  e.test_pattern.each do |f| 
     68    sh "/opt/local/jruby/bin/jruby -w -Ilib:ext:bin:test -e 'require \"#{f}\"'" rescue nil 
     69  end 
    4570end 
    4671 
     
    4974def move_extensions 
    5075  Dir["ext/**/*.#{Config::CONFIG['DLEXT']}"].each { |file| cp file, "lib/" } 
     76end 
     77 
     78def java_classpath_arg  
     79  # A myriad of ways to discover the JRuby classpath 
     80  classpath = begin 
     81    require 'java'  
     82    # Already running in a JRuby JVM 
     83    Java::java.lang.System.getProperty('java.class.path') 
     84  rescue LoadError 
     85    ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] && FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR) 
     86  end 
     87  classpath ? "-cp #{classpath}" : "" 
    5188end 
    5289 
     
    5491when /mswin/ 
    5592  filename = "lib/http11.so" 
    56   file filename do     
    57     cp "#{filename}.win32", filename 
     93  file filename do 
     94    Dir.chdir("ext/http11") do  
     95      ruby "extconf.rb" 
     96      system(PLATFORM =~ /mswin/ ? 'nmake' : 'make') 
     97    end 
     98    move_extensions 
    5899  end  
    59100  task :compile => [filename] 
     101 
     102when /java/ 
     103  filename = "lib/http11.jar" 
     104  file filename do 
     105    build_dir = "ext/http11_java/classes" 
     106    mkdir_p build_dir 
     107    sources = FileList['ext/http11_java/**/*.java'].join(' ') 
     108    sh "javac -target 1.4 -source 1.4 -d #{build_dir} #{java_classpath_arg} #{sources}" 
     109    sh "jar cf lib/http11.jar -C #{build_dir} ." 
     110    move_extensions       
     111  end       
     112  task :compile => [filename] 
     113 
    60114end 
    61115 
     
    80134  sub_project("mongrel_cluster", :package) 
    81135  sub_project("mongrel_service", :package) if RUBY_PLATFORM =~ /mswin/ 
     136  sh("rake java package") unless RUBY_PLATFORM =~ /java/ 
     137  # sh("rake mswin package") unless RUBY_PLATFORM =~ /mswin/ 
    82138end 
    83139 
     
    137193     
    138194    # XXX Hack, because only Luis can package for Win32 right now 
    139     sh "cp ~/Downloads/mongrel-#{e.version}-mswin32.gem pkg/gems/" 
    140     sh "cp ~/Downloads/mongrel_service-0.3.3-mswin32.gem pkg/gems/"   
     195    # sh "cp ~/Downloads/mongrel-#{e.version}-mswin32.gem pkg/gems/" 
     196    # sh "cp ~/Downloads/mongrel_service-0.3.3-mswin32.gem pkg/gems/"   
    141197    sh "rm -rf pkg/mongrel*" 
    142198    sh "gem generate_index -d pkg"   
     
    150206  task :web do 
    151207    # Requires the 'webgem' gem and the 'atom-tools' gem 
    152     sh "cd site; webgen; ruby atom.rb > output/feed.atom; rsync -azv --no-perms --no-times output/* rubyforge.org:/var/www/gforge-projects/mongrel/" 
     208    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/" 
    153209  end 
    154210   
    155211  desc "Upload the rdocs" 
    156   task :rdoc => [:redoc] do 
    157     sh "rsync -azv doc/* rubyforge.org:/var/www/gforge-projects/mongrel/rdoc/" 
    158     sh "cd projects/gem_plugin; rake site
     212  task :rdoc => [:doc] do 
     213    sh "rsync -azv --no-perms --no-times doc/* rubyforge.org:/var/www/gforge-projects/mongrel/rdoc/" 
     214    sh "cd projects/gem_plugin; rake site:rdoc
    159215  end 
    160216   
    161217  desc "Upload the coverage report" 
    162218  task :coverage => [:rcov] do 
    163     sh "rsync -azv test/coverage/* rubyforge.org:/var/www/gforge-projects/mongrel/coverage/" 
     219    sh "rsync -azv --no-perms --no-times test/coverage/* rubyforge.org:/var/www/gforge-projects/mongrel/coverage/" rescue nil 
    164220  end 
    165221   
    166222  desc "Upload the website, the rdocs, and the coverage report" 
    167   task :all => [:web, :rdoc, :coverage] 
    168    
    169 end 
     223  task :all => [:clean, :web, :rdoc, :coverage] 
     224   
     225end