allow passing Builder objects as sources to build targets - close #95
This commit is contained in:
1 parent
568b78e2e2
commit
008fa4844d
3 files changed
+15
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
build do
|
||||||
|
Environment.new do |env|
|
||||||
|
object = env.Object("simple.o", "simple.c")
|
||||||
|
env.Program("simple.exe", object)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -310,6 +310,7 @@ module Rscons
|
|||||||
end
|
end
|
||||||
target = expand_path(expand_varref(target))
|
target = expand_path(expand_varref(target))
|
||||||
sources = Array(sources).map do |source|
|
sources = Array(sources).map do |source|
|
||||||
|
source = source.target if sources.is_a?(Builder)
|
||||||
expand_path(expand_varref(source))
|
expand_path(expand_varref(source))
|
||||||
end.flatten
|
end.flatten
|
||||||
builder = @builders[method.to_s].new(
|
builder = @builders[method.to_s].new(
|
||||||
|
|||||||
@@ -173,6 +173,14 @@ EOF
|
|||||||
expect(`./simple.exe`).to eq "This is a simple C program\n"
|
expect(`./simple.exe`).to eq "This is a simple C program\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "allows specifying a Builder object as the source to another build target" do
|
||||||
|
test_dir("simple")
|
||||||
|
result = run_rscons(rsconscript: "builder_as_source.rb")
|
||||||
|
expect(result.stderr).to eq ""
|
||||||
|
expect(File.exists?("simple.o")).to be_truthy
|
||||||
|
expect(`./simple.exe`).to eq "This is a simple C program\n"
|
||||||
|
end
|
||||||
|
|
||||||
it 'prints commands as they are executed' do
|
it 'prints commands as they are executed' do
|
||||||
test_dir('simple')
|
test_dir('simple')
|
||||||
result = run_rscons(rsconscript: "command.rb")
|
result = run_rscons(rsconscript: "command.rb")
|
||||||
|
|||||||
Reference in new issue
Block a user