Josh Holtrop b882f8de99 Rework builder interface to only use #run method - close #91
The builder's #run method will be called repeatedly until it returns
true or false. The Builder#wait_for method can be used to cause a
builder to wait for a Thread, Command, or another Builder.
2019-02-17 22:08:39 -05:00

31 lines
593 B
Ruby

class MySource < Rscons::Builder
def run(options)
File.open(@target, 'w') do |fh|
fh.puts <<EOF
#define THE_VALUE #{@env.expand_varref("${the_value}")}
EOF
end
true
end
end
build do
e1 = Environment.new do |env|
env.add_builder(MySource)
env["one"] = "5"
env[:cfg] = {val: "9"}
env["two"] = lambda do |args|
args[:env][:cfg][:val]
end
env["the_value"] = lambda do |args|
"${one}${two}78"
end
end
e1.clone do |env|
env[:cfg][:val] = "6"
env.MySource('inc.h', [])
env.Program('program.exe', Dir['*.c'])
end
end