refactor into Environment#run_builder()

This commit is contained in:
Josh Holtrop 2013-10-15 13:36:25 -04:00
parent cd266c511e
commit 013995bbc0

View File

@ -136,10 +136,10 @@ module Rscons
if @targets[target][:source].map do |src|
targets_processed.include?(src) or not @targets.include?(src) or process_target.call(src)
end.all?
@targets[target][:builder].run(target,
run_builder(@targets[target][:builder],
target,
@targets[target][:source],
cache,
self,
@targets[target][:vars] || {})
else
false
@ -238,6 +238,7 @@ module Rscons
# @param sources [Array] List of source files to build.
# @param suffixes [Array] List of suffixes to try to convert source files into.
# @param cache [Cache] The Cache.
# @param vars [Hash] Extra variables to pass to the builder.
# Return a list of the converted file names.
def build_sources(sources, suffixes, cache, vars = {})
sources.map do |source|
@ -249,7 +250,7 @@ module Rscons
converted_fname = get_build_fname(source, suffix)
builder = @builders.values.find { |b| b.produces?(converted_fname, source, self) }
if builder
converted = builder.run(converted_fname, [source], cache, self, vars)
converted = run_builder(builder, converted_fname, [source], cache, vars)
return nil unless converted
break
end
@ -258,5 +259,16 @@ module Rscons
end
end
end
# Invoke a builder to build the given target based on the given sources.
# @param builder [Builder] The Builder to use.
# @param target [String] The target output file.
# @param sources [Array] List of source files.
# @param cache [Cache] The Cache.
# @param vars [Hash] Extra variables to pass to the builder.
# Return the result of the builder's run() method.
def run_builder(builder, target, sources, cache, vars)
builder.run(target, sources, cache, self, vars)
end
end
end