1
0
Fork 0
mirror of https://github.com/rubyjs/libv8 synced 2023-03-27 23:21:48 -04:00
libv8/Rakefile

83 lines
2.2 KiB
Text
Raw Normal View History

2011-05-24 14:17:58 -04:00
require 'bundler/setup'
2012-04-25 23:46:30 -04:00
require 'rspec/core/rake_task'
2014-06-14 05:26:44 -04:00
Bundler::GemHelper.install_tasks
2014-06-17 09:01:04 -04:00
RSpec::Core::RakeTask.new :spec
2011-05-24 14:17:58 -04:00
2014-06-14 05:26:44 -04:00
module Helpers
module_function
def binary_gemspec(platform = Gem::Platform.local)
2014-06-17 09:01:04 -04:00
gemspec = eval(File.read 'libv8.gemspec')
gemspec.platform = platform
2014-06-14 05:26:44 -04:00
gemspec
end
2012-05-12 06:38:07 -04:00
def binary_gem_name(platform = Gem::Platform.local)
File.basename binary_gemspec(platform).cache_file
2014-06-14 05:26:44 -04:00
end
2013-05-15 08:09:49 -04:00
end
desc "compile v8 via the ruby extension mechanism"
task :compile do
sh "ruby ext/libv8/extconf.rb"
end
2014-06-14 05:26:44 -04:00
desc "build a binary gem #{Helpers.binary_gem_name}"
task :binary => :compile do
2014-06-14 06:32:45 -04:00
gemspec = Helpers.binary_gemspec
gemspec.extensions.clear
2014-06-14 06:32:45 -04:00
# We don't need most things for the binary
gemspec.files = []
gemspec.files += ['lib/libv8.rb', 'lib/libv8/version.rb']
gemspec.files += ['ext/libv8/arch.rb', 'ext/libv8/location.rb', 'ext/libv8/paths.rb']
gemspec.files += ['ext/libv8/.location.yml']
2014-06-14 06:32:45 -04:00
# V8
gemspec.files += Dir['vendor/v8/include/*']
2012-05-01 18:04:47 -04:00
gemspec.files += Dir['vendor/v8/out/**/*.a']
2014-06-14 06:32:45 -04:00
FileUtils.chmod 0644, gemspec.files
FileUtils.mkdir_p 'pkg'
2014-06-14 06:32:45 -04:00
package = if Gem::VERSION < '2.0.0'
Gem::Builder.new(gemspec).build
else
require 'rubygems/package'
2014-06-17 09:01:04 -04:00
Gem::Package.build gemspec
end
2014-06-14 06:32:45 -04:00
2014-06-17 09:01:04 -04:00
FileUtils.mv package, 'pkg'
end
namespace :build do
2015-06-27 04:07:43 -04:00
['x86_64-linux', 'x86-linux'].each do |arch|
desc "build binary gem for #{arch}"
task arch do
arch_dir = Pathname(__FILE__).dirname.join("release/#{arch}")
Dir.chdir(arch_dir) do
sh "vagrant up"
sh "vagrant ssh -c 'cd /vagrant && rm -rf libv8 && git clone /libv8/.git libv8'"
sh "vagrant ssh -c 'cd /vagrant/libv8 && bundle install --path vendor/bundle'"
sh "vagrant ssh -c 'cd /vagrant/libv8 && bundle exec rake checkout binary'"
sh "vagrant ssh -c 'cp /vagrant/libv8/pkg/*.gem /vagrant'"
end
end
end
end
task :clean_submodules do
sh "git submodule --quiet foreach git reset --hard"
2014-06-17 08:16:02 -04:00
sh "git submodule --quiet foreach git clean -dxf"
end
desc "clean up artifacts of the build"
task :clean => [:clean_submodules] do
2012-04-25 23:46:30 -04:00
sh "rm -rf pkg"
2015-07-03 15:55:40 -04:00
sh "rm -rf vendor/v8"
2014-06-17 08:16:02 -04:00
sh "git clean -dxf"
2011-06-15 16:55:18 -04:00
end
2014-06-14 05:26:44 -04:00
task :default => [:compile, :spec]
2015-07-03 15:55:40 -04:00
task :build => [:clean]