change Builder#create_build_target and BuildTarget#initialize to accept a Hash of options
This commit is contained in:
parent
d9eea10363
commit
8fc95b5d69
@ -3,11 +3,16 @@ module Rscons
|
||||
class BuildTarget
|
||||
# Create a BuildTarget object.
|
||||
#
|
||||
# @param env [Environment] The Environment.
|
||||
# @param target [String] Name of the target file.
|
||||
def initialize(env, target)
|
||||
@env = env
|
||||
@target = target
|
||||
# @param options [Hash] Options to create the BuildTarget with.
|
||||
# @option options [Environment] :env
|
||||
# The Environment.
|
||||
# @option options [String] :target
|
||||
# The user-supplied target name.
|
||||
# @option options [Array<String>] :sources
|
||||
# The user-supplied source file name(s).
|
||||
def initialize(options)
|
||||
@env = options[:env]
|
||||
@target = options[:target]
|
||||
end
|
||||
|
||||
# Manually record a given target as depending on the specified files.
|
||||
|
@ -24,12 +24,17 @@ module Rscons
|
||||
# Builder sub-classes can override this method to manipulate parameters
|
||||
# (for example, add a suffix to the user-given target file name).
|
||||
#
|
||||
# @param env [Environment] The Environment.
|
||||
# @param target [String] The user-supplied target name.
|
||||
# @param options [Hash] Options to create the BuildTarget with.
|
||||
# @option options [Environment] :env
|
||||
# The Environment.
|
||||
# @option options [String] :target
|
||||
# The user-supplied target name.
|
||||
# @option options [Array<String>] :sources
|
||||
# The user-supplied source file name(s).
|
||||
#
|
||||
# @return [BuildTarget]
|
||||
def create_build_target(env, target)
|
||||
BuildTarget.new(env, target)
|
||||
def create_build_target(options)
|
||||
BuildTarget.new(options)
|
||||
end
|
||||
|
||||
# Return whether this builder object is capable of producing a given target
|
||||
|
@ -18,11 +18,12 @@ module Rscons
|
||||
}
|
||||
end
|
||||
|
||||
def create_build_target(env, target)
|
||||
unless target =~ /\./
|
||||
target += env.expand_varref("${PROGSUFFIX}")
|
||||
def create_build_target(options)
|
||||
my_options = options.dup
|
||||
unless my_options[:target] =~ /\./
|
||||
my_options[:target] += options[:env].expand_varref("${PROGSUFFIX}")
|
||||
end
|
||||
super(env, target)
|
||||
super(my_options)
|
||||
end
|
||||
|
||||
def run(target, sources, cache, env, vars)
|
||||
|
@ -261,7 +261,7 @@ module Rscons
|
||||
end
|
||||
sources = Array(sources)
|
||||
builder = @builders[method.to_s]
|
||||
build_target = builder.create_build_target(self, target)
|
||||
build_target = builder.create_build_target(env: self, target: target, sources: sources)
|
||||
add_target(build_target.to_s, builder, sources, vars, rest)
|
||||
build_target
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user