summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorSHIBATA Hiroshi <hsbt@ruby-lang.org>2017-07-12 12:16:03 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2017-07-12 12:16:03 +0900
commitb1d3b0a3f72b4c9dc40f81dceb9aca93614cd84b (patch)
treea3396a5655dad69e4102eedb970f8ae92d5567f6 /Rakefile
parent2190eb07f34e205d8f6239000e4f037725a4e1eb (diff)
downloadpsych-b1d3b0a3f72b4c9dc40f81dceb9aca93614cd84b.zip
Added cross compilation task for mingw platform
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile17
1 files changed, 10 insertions, 7 deletions
diff --git a/Rakefile b/Rakefile
index c5d78f2..34a0f06 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,6 +1,7 @@
-require "bundler/gem_tasks"
-require "rake/testtask"
+require "bundler"
+Bundler::GemHelper.install_tasks
+require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
@@ -9,9 +10,11 @@ Rake::TestTask.new(:test) do |t|
t.warning = true
end
+spec = eval File.read("psych.gemspec")
+
if RUBY_PLATFORM =~ /java/
require 'rake/javaextensiontask'
- Rake::JavaExtensionTask.new("psych") do |ext|
+ Rake::JavaExtensionTask.new("psych", spec) do |ext|
require 'maven/ruby/maven'
# uses Mavenfile to write classpath into pkg/classpath
# and tell maven via system properties the snakeyaml version
@@ -25,17 +28,17 @@ if RUBY_PLATFORM =~ /java/
end
else
require 'rake/extensiontask'
- Rake::ExtensionTask.new("psych") do |ext|
+ Rake::ExtensionTask.new("psych", spec) do |ext|
ext.lib_dir = File.join(*['lib', ENV['FAT_DIR']].compact)
ext.cross_compile = true
ext.cross_platform = %w[x86-mingw32 x64-mingw32]
end
end
-task 'gem:native' do
+desc "Compile binaries for mingw platform using rake-compiler-dock"
+task 'build:mingw' do
require 'rake_compiler_dock'
- sh "bundle package" # Avoid repeated downloads of gems by using gem files from the host.
- RakeCompilerDock.sh "bundle --local && rake cross native gem"
+ RakeCompilerDock.sh "bundle && rake cross native gem RUBY_CC_VERSION=2.2.2:2.3.0:2.4.0"
end
task :default => [:compile, :test]