Expand target and sources before calling Builder#create_build_target

This commit is contained in:
Josh Holtrop 2017-06-06 16:36:44 -04:00
parent df52a7e0e1
commit 3436dc3a64
2 changed files with 33 additions and 33 deletions

View File

@ -41,7 +41,7 @@ module Rscons
def create_build_target(options)
env, target, vars = options.values_at(:env, :target, :vars)
my_options = options.dup
unless env.expand_varref(target, vars) =~ /\./
unless target["."]
my_options[:target] += env.expand_varref("${PROGSUFFIX}", vars)
end
super(my_options)

View File

@ -417,48 +417,25 @@ module Rscons
def method_missing(method, *args)
if @builders.has_key?(method.to_s)
target, sources, vars, *rest = args
unless vars.nil? or vars.is_a?(Hash) or vars.is_a?(VarSet)
vars ||= {}
unless vars.is_a?(Hash) or vars.is_a?(VarSet)
raise "Unexpected construction variable set: #{vars.inspect}"
end
sources = Array(sources)
builder = @builders[method.to_s]
target = expand_path(target)
target = expand_varref(target)
sources = Array(sources).map do |source|
source = expand_path(source)
expand_varref(source)
end.flatten
build_target = builder.create_build_target(env: self, target: target, sources: sources, vars: vars)
add_target(build_target.to_s, builder, sources, vars || {}, rest)
add_target(build_target.to_s, builder, sources, vars, rest)
build_target
else
super
end
end
# Add a build target.
#
# @param target [String] Build target file name.
# @param builder [Builder] The {Builder} to use to build the target.
# @param sources [Array<String>] Source file name(s).
# @param vars [Hash] Construction variable overrides.
# @param args [Object] Deprecated; unused.
#
# @return [void]
def add_target(target, builder, sources, vars, args)
target = expand_path(target)
target = expand_varref(target)
sources = sources.map do |source|
source = expand_path(source)
expand_varref(source)
end.flatten
setup_info = builder.setup(
target: target,
sources: sources,
env: self,
vars: vars)
@job_set.add_job(
builder: builder,
target: target,
sources: sources,
vars: vars,
setup_info: setup_info)
end
# Manually record a given target as depending on the specified files.
#
# @param target [String,BuildTarget] Target file.
@ -853,6 +830,29 @@ module Rscons
private
# Add a build target.
#
# @param target [String] Build target file name.
# @param builder [Builder] The {Builder} to use to build the target.
# @param sources [Array<String>] Source file name(s).
# @param vars [Hash] Construction variable overrides.
# @param args [Object] Deprecated; unused.
#
# @return [void]
def add_target(target, builder, sources, vars, args)
setup_info = builder.setup(
target: target,
sources: sources,
env: self,
vars: vars)
@job_set.add_job(
builder: builder,
target: target,
sources: sources,
vars: vars,
setup_info: setup_info)
end
# Start a threaded command in a new thread.
#
# @param tc [ThreadedCommand]