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.
This commit is contained in:
josh committed 2019-02-17 22:08:39 -05:00
1 parent 8426a54a57
commit b882f8de99
38 files changed
+580 -665

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ class MySource < Rscons::Builder
#define THE_VALUE 5678
EOF
end
@target
true
end
end
+1 -1
View File
@@ -5,7 +5,7 @@ class MySource < Rscons::Builder
#define THE_VALUE 678
EOF
end
@target
true
end
end
+1 -1
View File
@@ -5,7 +5,7 @@ class MySource < Rscons::Builder
#define THE_VALUE #{@env.expand_varref("${the_value}")}
EOF
end
@target
true
end
end
@@ -0,0 +1,8 @@
build do
Environment.new do |env|
env.add_builder(:MyBuilder) do |options|
"hi"
end
env.MyBuilder("foo")
end
end
@@ -0,0 +1,8 @@
build do
Environment.new do |env|
env.add_builder(:MyBuilder) do |options|
wait_for(1)
end
env.MyBuilder("foo")
end
end
@@ -8,7 +8,7 @@ class CHGen < Rscons::Builder
File.open(h_fname, "w") {|fh| fh.puts "extern int THE_VALUE;"}
@cache.register_build([c_fname, h_fname], "", @sources, @env)
end
@target
true
end
end
@@ -0,0 +1,21 @@
class MyBuilder < Rscons::Builder
def run(options)
if @thread
true
else
@env.print_builder_run_message("#{name} #{target}", nil)
@thread = Thread.new do
sleep 2
FileUtils.touch(@target)
end
wait_for(@thread)
end
end
end
build do
Environment.new do |env|
env.add_builder(MyBuilder)
env.MyBuilder("foo")
end
end