expand target and source paths when registering a builder

This commit is contained in:
Josh Holtrop 2017-05-10 15:06:16 -04:00
parent 7cba8c8424
commit 695bf84092

View File

@ -283,7 +283,6 @@ module Rscons
cache = Cache.instance cache = Cache.instance
begin begin
while job = @job_set.get_next_job_to_run while job = @job_set.get_next_job_to_run
expand_paths(job)
# TODO: have Cache determine when checksums may be invalid based on # TODO: have Cache determine when checksums may be invalid based on
# file size and/or timestamp. # file size and/or timestamp.
cache.clear_checksum_cache! cache.clear_checksum_cache!
@ -390,6 +389,12 @@ module Rscons
# #
# @return [void] # @return [void]
def add_target(target, builder, sources, vars, args) def add_target(target, builder, sources, vars, args)
target = expand_path(target) if @build_root
target = expand_varref(target)
sources = sources.map do |source|
source = expand_path(source) if @build_root
expand_varref(source)
end.flatten
@job_set.add_job(builder, target, sources, vars) @job_set.add_job(builder, target, sources, vars)
end end
@ -654,22 +659,6 @@ module Rscons
private private
# Expand target and source paths of a job before invoking the builder.
#
# This method expand construction variable references in the target and
# source file names before passing them to the builder. It also expands
# "^/" prefixes to the Environment's build root if a build root is defined.
#
# @return [void]
def expand_paths(job)
job[:target] = expand_path(job[:target]) if @build_root
job[:target] = expand_varref(job[:target])
job[:sources] = job[:sources].map do |source|
source = expand_path(source) if @build_root
expand_varref(source)
end.flatten
end
# Parse dependencies for a given target from a Makefile. # Parse dependencies for a given target from a Makefile.
# #
# This method is used internally by Rscons builders. # This method is used internally by Rscons builders.