shortcut all of Environment#process if @targets is empty

This commit is contained in:
Josh Holtrop 2014-04-15 16:18:33 -04:00
parent 8be1842cf8
commit ddf00d08a7

View File

@ -171,30 +171,30 @@ module Rscons
# When a block is passed to Environment.new, this method is automatically # When a block is passed to Environment.new, this method is automatically
# called after the block returns. # called after the block returns.
def process def process
clean_target_paths!
cache = Cache.instance
cache.clear_checksum_cache!
targets_processed = {}
unless @targets.empty? unless @targets.empty?
begin clean_target_paths!
process_target = proc do |target| cache = Cache.instance
targets_processed[target] ||= begin cache.clear_checksum_cache!
@targets[target][:sources].each do |src| targets_processed = {}
if @targets.include?(src) and not targets_processed.include?(src) process_target = proc do |target|
process_target.call(src) targets_processed[target] ||= begin
end @targets[target][:sources].each do |src|
if @targets.include?(src) and not targets_processed.include?(src)
process_target.call(src)
end end
result = run_builder(@targets[target][:builder],
target,
@targets[target][:sources],
cache,
@targets[target][:vars] || {})
unless result
raise BuildError.new("Failed to build #{target}")
end
result
end end
result = run_builder(@targets[target][:builder],
target,
@targets[target][:sources],
cache,
@targets[target][:vars] || {})
unless result
raise BuildError.new("Failed to build #{target}")
end
result
end end
end
begin
@targets.each do |target, target_params| @targets.each do |target, target_params|
process_target.call(target) process_target.call(target)
end end