summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorSHIBATA Hiroshi <hsbt@ruby-lang.org>2016-07-12 09:12:42 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2016-07-12 09:12:42 +0900
commitf8d7a76156b4e20afda4be782a6d2081f798eda7 (patch)
treefea8db7b7539980fe2f833edb905068e8653b9ce /Rakefile
parent234c225e1597ab19c78d8c29dc57262f3785c21d (diff)
downloadpsych-f8d7a76156b4e20afda4be782a6d2081f798eda7.tar.gz
added java extension task
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile20
1 files changed, 19 insertions, 1 deletions
diff --git a/Rakefile b/Rakefile
index 82af4bf..af5c688 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,6 +1,7 @@
require "bundler/gem_tasks"
require "rake/testtask"
require 'rake/extensiontask'
+require 'rake/javaextensiontask'
Rake::TestTask.new(:test) do |t|
t.libs << "test"
@@ -8,6 +9,23 @@ Rake::TestTask.new(:test) do |t|
t.test_files = FileList['test/**/*_test.rb']
end
-Rake::ExtensionTask.new("psych")
+if RUBY_PLATFORM =~ /java/
+ Rake::JavaExtensionTask.new("psych") do |ext|
+ require 'maven/ruby/maven'
+ # uses Mavenfile to write classpath into pkg/classpath
+ # and tell maven via system properties the snakeyaml version
+ # this is basically the same as running from the commandline:
+ # rmvn dependency:build-classpath -Dsnakeyaml.version='use version from Psych::DEFAULT_SNAKEYAML_VERSION here'
+ Maven::Ruby::Maven.new.exec( 'dependency:build-classpath', "-Dsnakeyaml.version=#{Psych::DEFAULT_SNAKEYAML_VERSION}", '-Dverbose=true')#, '--quiet' )
+ ext.source_version = '1.7'
+ ext.target_version = '1.7'
+ ext.classpath = File.read('pkg/classpath')
+ ext.ext_dir = 'ext/java'
+ end
+else
+ Rake::ExtensionTask.new("psych") do |ext|
+ ext.lib_dir = File.join(*['lib', ENV['FAT_DIR']].compact)
+ end
+end
task :default => :test