merge Environment#build_command and #expand_varref

This commit is contained in:
Josh Holtrop 2014-05-14 14:33:09 -04:00
parent c0adb64c5d
commit 9d61fa0276

View File

@ -209,22 +209,22 @@ module Rscons
@targets = {} @targets = {}
end end
# Build a command line from the given template, resolving references to # Expand a construction variable reference.
# variables using the Environment's construction variables and any extra #
# variables specified. # @param varref [Array, String] Variable reference to expand.
# @param command_template [Array] template for the command with variable # @param extra_vars [Hash, VarSet]
# references # Extra variables to use in addition to (or replace) the Environment's
# @param extra_vars [Hash, VarSet] extra variables to use in addition to # construction variables when expanding the variable reference.
# (or replace) the Environment's construction variables when building #
# the command # @return [Array, String] Expansion of the variable reference.
def build_command(command_template, extra_vars) def expand_varref(varref, extra_vars = nil)
@varset.merge(extra_vars).expand_varref(command_template) if extra_vars.nil?
end @varset
else
# Expand a construction variable reference (String or Array) @varset.merge(extra_vars)
def expand_varref(varref) end.expand_varref(varref)
@varset.expand_varref(varref)
end end
alias_method :build_command, :expand_varref
# Execute a builder command # Execute a builder command
# @param short_desc [String] Message to print if the Environment's echo # @param short_desc [String] Message to print if the Environment's echo