2014-12-24 14:48:41 +00:00
|
|
|
require "rubygems"
|
|
|
|
require "rubygems/package_task"
|
|
|
|
require "rake/extensiontask" unless RUBY_PLATFORM == "java"
|
2014-11-18 22:19:58 +00:00
|
|
|
require "rake/testtask"
|
|
|
|
|
2014-12-12 23:58:26 +00:00
|
|
|
spec = Gem::Specification.load("google-protobuf.gemspec")
|
2014-11-18 22:19:58 +00:00
|
|
|
|
2014-12-24 14:48:41 +00:00
|
|
|
if RUBY_PLATFORM == "java"
|
2015-05-01 18:54:29 +00:00
|
|
|
if `which mvn` == ''
|
|
|
|
raise ArgumentError, "maven needs to be installed"
|
|
|
|
end
|
2014-12-24 14:48:41 +00:00
|
|
|
task :clean do
|
|
|
|
system("mvn clean")
|
|
|
|
end
|
2014-11-18 22:19:58 +00:00
|
|
|
|
2014-12-24 14:48:41 +00:00
|
|
|
task :compile do
|
|
|
|
system("mvn package")
|
|
|
|
end
|
|
|
|
else
|
|
|
|
Rake::ExtensionTask.new("protobuf_c", spec) do |ext|
|
|
|
|
ext.ext_dir = "ext/google/protobuf_c"
|
|
|
|
ext.lib_dir = "lib/google"
|
|
|
|
end
|
2016-02-04 18:44:22 +00:00
|
|
|
|
|
|
|
task 'gem:windows' do
|
|
|
|
require 'rake_compiler_dock'
|
|
|
|
RakeCompilerDock.sh "bundle && rake cross native gem"
|
|
|
|
end
|
2014-11-18 22:19:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
Gem::PackageTask.new(spec) do |pkg|
|
|
|
|
end
|
|
|
|
|
2014-12-24 14:48:41 +00:00
|
|
|
Rake::TestTask.new(:test => :build) do |t|
|
|
|
|
t.test_files = FileList["tests/*.rb"]
|
|
|
|
end
|
|
|
|
|
2014-11-18 22:19:58 +00:00
|
|
|
task :build => [:clean, :compile]
|
|
|
|
task :default => [:build]
|
|
|
|
|
|
|
|
# vim:sw=2:et
|