2016-02-01 12:43:26 +00:00
|
|
|
# frozen_string_literal: true
|
2007-11-10 07:48:56 +00:00
|
|
|
#--
|
|
|
|
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
|
|
|
# All rights reserved.
|
|
|
|
# See LICENSE.txt for permissions.
|
|
|
|
#++
|
|
|
|
|
2018-10-22 00:27:02 +00:00
|
|
|
require "shellwords"
|
|
|
|
|
2007-11-10 07:48:56 +00:00
|
|
|
class Gem::Ext::RakeBuilder < Gem::Ext::Builder
|
|
|
|
|
2018-05-30 13:01:35 +00:00
|
|
|
def self.build(extension, dest_path, results, args=[], lib_dir=nil)
|
2018-11-21 10:20:47 +00:00
|
|
|
if File.basename(extension) =~ /mkrf_conf/i
|
2018-10-31 03:23:30 +00:00
|
|
|
run([Gem.ruby, File.basename(extension), *args], results)
|
2007-11-10 07:48:56 +00:00
|
|
|
end
|
|
|
|
|
2011-01-28 23:46:47 +00:00
|
|
|
rake = ENV['rake']
|
|
|
|
|
2018-10-31 03:23:30 +00:00
|
|
|
if rake
|
|
|
|
rake = rake.shellsplit
|
|
|
|
else
|
|
|
|
begin
|
2019-06-01 12:45:11 +03:00
|
|
|
rake = [Gem.ruby, "-I#{File.expand_path("..", __dir__)}", "-rrubygems", Gem.bin_path('rake', 'rake')]
|
2018-10-31 03:23:30 +00:00
|
|
|
rescue Gem::Exception
|
|
|
|
rake = [Gem.default_exec_format % 'rake']
|
|
|
|
end
|
|
|
|
end
|
2011-01-28 23:46:47 +00:00
|
|
|
|
2018-10-22 00:27:02 +00:00
|
|
|
rake_args = ["RUBYARCHDIR=#{dest_path}", "RUBYLIBDIR=#{dest_path}", *args]
|
2018-10-31 03:23:30 +00:00
|
|
|
run(rake + rake_args, results)
|
2007-11-10 07:48:56 +00:00
|
|
|
|
|
|
|
results
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|