Expand target and sources before calling Builder#create_build_target
This commit is contained in:
parent
df52a7e0e1
commit
3436dc3a64
@ -41,7 +41,7 @@ module Rscons
|
|||||||
def create_build_target(options)
|
def create_build_target(options)
|
||||||
env, target, vars = options.values_at(:env, :target, :vars)
|
env, target, vars = options.values_at(:env, :target, :vars)
|
||||||
my_options = options.dup
|
my_options = options.dup
|
||||||
unless env.expand_varref(target, vars) =~ /\./
|
unless target["."]
|
||||||
my_options[:target] += env.expand_varref("${PROGSUFFIX}", vars)
|
my_options[:target] += env.expand_varref("${PROGSUFFIX}", vars)
|
||||||
end
|
end
|
||||||
super(my_options)
|
super(my_options)
|
||||||
|
@ -417,48 +417,25 @@ module Rscons
|
|||||||
def method_missing(method, *args)
|
def method_missing(method, *args)
|
||||||
if @builders.has_key?(method.to_s)
|
if @builders.has_key?(method.to_s)
|
||||||
target, sources, vars, *rest = args
|
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}"
|
raise "Unexpected construction variable set: #{vars.inspect}"
|
||||||
end
|
end
|
||||||
sources = Array(sources)
|
|
||||||
builder = @builders[method.to_s]
|
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)
|
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
|
build_target
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
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.
|
# Manually record a given target as depending on the specified files.
|
||||||
#
|
#
|
||||||
# @param target [String,BuildTarget] Target file.
|
# @param target [String,BuildTarget] Target file.
|
||||||
@ -853,6 +830,29 @@ module Rscons
|
|||||||
|
|
||||||
private
|
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.
|
# Start a threaded command in a new thread.
|
||||||
#
|
#
|
||||||
# @param tc [ThreadedCommand]
|
# @param tc [ThreadedCommand]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user