This repository has been archived by the owner on Jan 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Rakefile
66 lines (53 loc) · 1.95 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
$: << 'lib'
require 'bundler/setup'
require 'rspec/core/rake_task'
require 'msgpack/version'
task :default => :spec
RSpec::Core::RakeTask.new(:spec) do |r|
r.rspec_opts = '--tty'
end
task :spec => :package
task :clean do
rm Dir['ext/java/**/*.class']
end
task :compile do
classpath = (Dir["lib/ext/*.jar"] + ["#{ENV['MY_RUBY_HOME']}/lib/jruby.jar"]).join(':')
system %(javac -Xlint:-options -deprecation -source 1.6 -target 1.6 -cp #{classpath} ext/java/*.java ext/java/org/msgpack/jruby/*.java)
exit($?.exitstatus) unless $?.success?
end
task :package => :compile do
class_files = Dir['ext/java/**/*.class'].map { |path| path = path.sub('ext/java/', ''); "-C ext/java '#{path}'" }
system %(jar cf lib/ext/msgpack_jruby.jar #{class_files.join(' ')})
exit($?.exitstatus) unless $?.success?
end
task :release => :package do
version_string = "v#{MessagePack::VERSION}"
unless %x(git tag -l).split("\n").include?(version_string)
system %(git tag -a #{version_string} -m #{version_string})
end
system %(gem build msgpack-jruby.gemspec && gem push msgpack-jruby-*.gem && mv msgpack-jruby-*.gem pkg)
end
namespace :benchmark do
BENCHMARK_RUBIES = ['1.9.2-p0', 'jruby-1.6.5', 'jruby-head']
BENCHMARK_GEMSET = 'msgpack-jruby-benchmarking'
BENCHMARK_FILE = 'spec/benchmarks/shootout_bm.rb'
task :run do
rubies = BENCHMARK_RUBIES.map { |rb| "#{rb}@#{BENCHMARK_GEMSET}" }
cmd = %(rvm #{rubies.join(',')} exec viiite run #{BENCHMARK_FILE} | tee benchmark | viiite report --hierarchy --regroup=bench,lib,ruby)
puts cmd
system cmd
end
task :quick do
cmd = %(IMPLEMENTATIONS=msgpack viiite run #{BENCHMARK_FILE} | viiite report --hierarchy --regroup=bench)
puts cmd
system cmd
end
task :setup do
rubies = BENCHMARK_RUBIES.map { |rb| "#{rb}@#{BENCHMARK_GEMSET}" }
rubies.each do |ruby_version|
cmd = %(rvm-shell #{ruby_version} -c 'bundle check || bundle install')
puts cmd
system cmd
end
end
end