-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathRakefile
106 lines (85 loc) · 2.58 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# -*- mode: ruby -*-
# encoding: utf-8
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'jeweler'
jeweler_tasks = Jeweler::Tasks.new do |gem|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gem.name = "lz4-ruby"
gem.homepage = "http://github.com/komiya-atsushi/lz4-ruby"
gem.license = "MIT"
gem.summary = %Q{Ruby bindings for LZ4 (Extremely Fast Compression algorithm).}
gem.description = %Q{Ruby bindings for LZ4. LZ4 is a very fast lossless compression algorithm.}
gem.email = "[email protected]"
gem.authors = ["KOMIYA Atsushi"]
gem.extensions = ["ext/lz4ruby/extconf.rb"]
gem.files.exclude("*.sh")
gem.files.include("ext/lz4ruby/*.c")
gem.files.include("ext/lz4ruby/*.h")
gem.required_ruby_version = '>= 1.9'
# dependencies defined in Gemfile
end
Jeweler::RubygemsDotOrgTasks.new
$gemspec = jeweler_tasks.gemspec
$gemspec.version = jeweler_tasks.jeweler.version
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "lz4-ruby #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
require 'rake/extensiontask'
Rake::ExtensionTask.new("lz4ruby", $gemspec) do |ext|
ext.cross_compile = true
ext.cross_platform = ["x86-mingw32"]
end
Rake::Task.tasks.each do |task_name|
case task_name.to_s
when /^native/
task_name.prerequisites.unshift('fix_rake_compiler_gemspec_dump')
end
end
task :fix_rake_compiler_gemspec_dump do
%w{files extra_rdoc_files test_files}.each do |accessor|
$gemspec.send(accessor).instance_eval {
@exclude_procs = Array.new
}
end
end
task :gems do
sh "rake clean build:cross"
sh "rake clean build"
end
task "build:cross" => [:modify_gemspec_for_windows, :build] do
file = "pkg/lz4-ruby-#{get_version}.gem"
end
task "build:jruby" => [:modify_gemspec_for_jruby, :compile_jruby, :build]
task :modify_gemspec_for_windows do
$gemspec.extensions = []
$gemspec.files.include("lib/?.?/*.so")
$gemspec.platform = "x86-mingw32"
end
task :modify_gemspec_for_jruby do
$gemspec.extensions = []
$gemspec.files.include("lib/*.jar")
$gemspec.platform = "java"
end
task :compile_jruby do
system 'mvn package'
end
def get_version
`cat VERSION`.chomp
end