fix variable references that expand to arrays in build target sources - fix #20

This commit is contained in:
Josh Holtrop 2015-01-20 21:26:45 -05:00
parent cb3cc9a0de
commit 76610a07a9
3 changed files with 12 additions and 1 deletions

View File

@ -388,6 +388,7 @@ http://rubydoc.info/github/holtrop/rscons/frames.
- fix Rscons.set_suffix to append the given suffix if the filename has none
- rework Preprocess builder to consider deep dependencies
- remove ${CFLAGS} from default CPP_CMD
- fix variable references that expand to arrays in build target sources
### v1.8.1

View File

@ -683,7 +683,7 @@ module Rscons
sources = target_params[:sources].map do |source|
source = expand_path(source) if @build_root
expand_varref(source)
end
end.flatten
target = expand_path(target) if @build_root
target = expand_varref(target)
result[target] = target_params.merge(sources: sources)

View File

@ -754,4 +754,14 @@ EOF
expect(File.read("pp")).to match(%r{abc88xyz}m)
end
it "allows construction variable references which expand to arrays in sources of a build target" do
test_dir("simple")
Rscons::Environment.new do |env|
env["sources"] = Dir["*.c"]
env.Program("simple", "${sources}")
end
expect(File.exists?("simple.o")).to be_truthy
expect(`./simple`).to eq "This is a simple C program\n"
end
end