mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 12:34:21 +00:00
- ### Problem Since https://github.com/ruby/rubygems/pull/9131, we are now compiling make rules simultaneously. The number of jobs is equal to the number of processors. This may be problematic for some users as they want to control this value. ### Solution The number of jobs passed to `make` will now be equal to the `BUNDLE_JOBS` value. ### Side note It's also worth to note that since Bundler installs gems in parallel, we may end up running multiple `make -j<JOB>` in parallel which would cause exhaust the number of processors we have. This problem can be fixed by implementing a GNU jobserver, which I plan to do. But I felt that this would be too much change in one PR. https://github.com/ruby/rubygems/commit/d51995deb9
38 lines
1.0 KiB
Ruby
38 lines
1.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
#--
|
|
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
|
# All rights reserved.
|
|
# See LICENSE.txt for permissions.
|
|
#++
|
|
|
|
class Gem::Ext::RakeBuilder < Gem::Ext::Builder
|
|
def self.build(extension, dest_path, results, args = [], lib_dir = nil, extension_dir = Dir.pwd,
|
|
target_rbconfig = Gem.target_rbconfig, n_jobs: nil)
|
|
if target_rbconfig.path
|
|
warn "--target-rbconfig is not yet supported for Rake extensions. Ignoring"
|
|
end
|
|
|
|
if /mkrf_conf/i.match?(File.basename(extension))
|
|
run([Gem.ruby, File.basename(extension), *args], results, class_name, extension_dir)
|
|
end
|
|
|
|
rake = ENV["rake"]
|
|
|
|
if rake
|
|
rake = shellsplit(rake)
|
|
else
|
|
begin
|
|
rake = ruby << "-rrubygems" << Gem.bin_path("rake", "rake")
|
|
rescue Gem::Exception
|
|
rake = [Gem.default_exec_format % "rake"]
|
|
end
|
|
end
|
|
|
|
rake_args = ["RUBYARCHDIR=#{dest_path}", "RUBYLIBDIR=#{dest_path}", *args]
|
|
run(rake + rake_args, results, class_name, extension_dir)
|
|
|
|
results
|
|
end
|
|
end
|