- more packaging/building work

This commit is contained in:
Jordan Sissel 2011-03-21 22:58:26 -07:00
parent f65c034b72
commit e09b412d92

View file

@ -1,25 +1,54 @@
require 'tempfile'
require 'ftools'
# Compile config grammar (ragel -> ruby)
file "lib/logstash/config/grammar.rb" => ["lib/logstash/config/grammar.rl"] do
sh "make -C lib/logstash/config grammar.rb"
end
task :compile => "lib/logstash/config/grammar.rb" do |t|
# Taken from 'jrubyc'
# Currently this code is commented out because jruby emits this:
# Failure during compilation of file logstash/web/helpers/require_param.rb:
# java.lang.RuntimeException: java.io.FileNotFoundException: File path
# /home/jls/projects/logstash/logstash/web/helpers/require_param.rb
# does not start with parent path /home/jls/projects/logstash/lib
#
# org/jruby/util/JavaNameMangler.java:105:in `mangleFilenameForClasspath'
# org/jruby/util/JavaNameMangler.java:32:in `mangleFilenameForClasspath'
#require 'jruby/jrubyc'
#args = [ "-p", "net.logstash" ]
#args += Dir.glob("**/*.rb")
#status = JRuby::Compiler::compile_argv(args)
#if (status != 0)
#puts "Compilation FAILED: #{status} error(s) encountered"
#exit status
#end
sh "rm -r lib/net"
Dir.chdir("lib") do
args = [ "-p", "net" ]
args += Dir.glob("**/*.rb")
sh "jrubyc", *args
end
end
VERSIONS = {
:jruby => "1.6.0",
:elasticsearch => "0.15.2",
:joda => "1.6.2",
:jruby => "1.6.0", # Any of CPL1.0/GPL2.0/LGPL2.1 ? Confusing, but OK.
:elasticsearch => "0.15.2", # Apache 2.0 license
:joda => "1.6.2", # Apache 2.0 license
}
namespace :vendor do
file "vendor/jar" do |t|
Dir.mkdir(t.name)
mkdir_p mkdir(t.name)
end
# Download jruby.jar
file "vendor/jar/jruby-complete-#{VERSIONS[:jruby]}.jar" => "vendor/jar" do |t|
baseurl = "http://repository.codehaus.org/org/jruby/jruby-complete"
sh "wget -O #{t.name} #{baseurl}/#{VERSIONS[:jruby]}/#{File.basename(t.name)}"
if !File.exists?(t.name)
sh "wget -O #{t.name} #{baseurl}/#{VERSIONS[:jruby]}/#{File.basename(t.name)}"
end
end # jruby
task :jruby => "vendor/jar/jruby-complete-#{VERSIONS[:jruby]}.jar" do
@ -64,13 +93,36 @@ namespace :package do
sh "gem build logstash.gemspec"
end
monolith_deps = [ "vendor:jruby", "vendor:gems", "vendor:elasticsearch" ]
namespace :monolith do
task :tar => [ "vendor:jruby", "vendor:gems", "vendor:elasticsearch" ] do
task :tar => monolith_deps do
paths = %w{ bin CHANGELOG CONTRIBUTORS etc examples Gemfile Gemfile.lock
INSTALL lib LICENSE patterns Rakefile README.md STYLE.md test
TODO USAGE vendor/bundle vendor/jar }
sh "tar -zcf logstash-monolithic-someversion.tar.gz #{paths.join(" ")}"
end
end # package:monolith:tar
task :jar => monolith_deps do
mkdir_p "build-jar"
# Unpack all the 3rdparty jars
Dir.glob("vendor/jar/**/*.jar").each do |jar|
puts "=> Unpacking #{jar} into build-jar/"
Dir.chdir("build-jar") do
sh "jar xf ../#{jar}"
end
end
# We compile stuff to lib/net/logstash/...
Dir.glob("lib/net/**/*.class").each do |file|
#target = File.join("build-jar", file.gsub("lib/", ""))
target = File.join("build-jar", file)
mkdir_p File.dirname(target)
puts "=> Copying #{file} => #{target}"
File.copy(file, target)
end
end # package:monolith:jar
end # monolith
end # package