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