diff --git a/Gemfile b/Gemfile index f9da9e2c..486cbe9f 100644 --- a/Gemfile +++ b/Gemfile @@ -8,4 +8,5 @@ group :development do gem 'ruby-maven', :platforms => :jruby gem 'test-unit' gem 'test-unit-ruby-core' + gem 'ruby-core-tasks', github: 'ruby/ruby-core-tasks' end diff --git a/Rakefile b/Rakefile index 7eb5e4a3..12a74221 100644 --- a/Rakefile +++ b/Rakefile @@ -4,6 +4,8 @@ require "rdoc/task" name = "stringio" +helper = Bundler::GemHelper.instance + case RUBY_ENGINE when "jruby" require 'rake/javaextensiontask' @@ -13,30 +15,24 @@ when "jruby" ext.target_version = '1.8' ext.ext_dir = 'ext/java' end + libs = [extask.lib_dir] task :build => "#{extask.lib_dir}/#{extask.name}.jar" when "ruby" - require 'rake/extensiontask' - extask = Rake::ExtensionTask.new(name) do |x| - x.lib_dir << "/#{RUBY_VERSION}/#{x.platform}" - end + require "ruby-core/extensiontask" + libs = RubyCore::ExtensionTask.new(helper.gemspec).libs + task :test => :compile else task :compile end Rake::TestTask.new(:test) do |t| - if extask - ENV["RUBYOPT"] = "-I" + [extask.lib_dir, "test/lib"].join(File::PATH_SEPARATOR) - t.libs << extask.lib_dir - else - ENV["RUBYOPT"] = "-Itest/lib" - end - t.libs << "test/lib" + t.libs.push(*libs, "test/lib") + ENV["RUBYOPT"] = "-I" + t.libs.join(File::PATH_SEPARATOR) t.ruby_opts << "-rhelper" t.test_files = FileList["test/**/test_*.rb"] end -helper = Bundler::GemHelper.instance RDoc::Task.new do |rdoc| rdoc.rdoc_files.push("COPYING", "LICENSE.txt", "NEWS.md", "README.md",