rscons/build_tests/simple/cache_debugging.rb
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

39 lines
947 B
Ruby

class DebugBuilder < Rscons::Builder
def run(options)
if @command
finalize_command
else
@command = %W[gcc -c -o #{@target} #{@sources.first}]
if Rscons.vars["command_change"]
@command += %w[-Wall]
end
if Rscons.vars["new_dep"]
@sources += ["extra"]
end
if Rscons.vars["strict_deps1"]
@sources += ["extra"]
strict_deps = true
end
if Rscons.vars["strict_deps2"]
@sources = ["extra"] + @sources
strict_deps = true
end
if @cache.up_to_date?(@target, @command, @sources, @env, debug: true, strict_deps: strict_deps)
true
else
register_command("#{name} #{target}", @command)
end
end
end
end
build do
Environment.new do |env|
env.add_builder(DebugBuilder)
if Rscons.vars["new_user_dep"]
env.depends("foo.o", "new_dep")
end
env.DebugBuilder("foo.o", "simple.c")
end
end