support phony targets - close #25
This commit is contained in:
1 parent
7698fbf618
commit
7a04bec2ff
5 files changed
+85
-14
No files matched your search
@@ -932,4 +932,35 @@ EOF
|
||||
end
|
||||
end
|
||||
|
||||
context "phony targets" do
|
||||
it "allows specifying a Symbol as a target name and reruns the builder if the sources or command have changed" do
|
||||
test_dir("simple")
|
||||
env = Rscons::Environment.new do |env|
|
||||
env.add_builder(:Checker) do |target, sources, cache, env, vars|
|
||||
unless cache.up_to_date?(target, :Checker, sources, env)
|
||||
puts "Checker #{sources.first}" if env.echo != :off
|
||||
cache.register_build(target, :Checker, sources, env)
|
||||
end
|
||||
target
|
||||
end
|
||||
env.Program("simple.exe", "simple.c")
|
||||
env.Checker(:checker, "simple.exe")
|
||||
end
|
||||
expect(lines).to eq(["CC simple.o", "LD simple.exe", "Checker simple.exe"])
|
||||
|
||||
env.clone do |env|
|
||||
env.Checker(:checker, "simple.exe")
|
||||
end
|
||||
expect(lines).to eq([])
|
||||
|
||||
File.open("simple.exe", "w") do |fh|
|
||||
fh.puts "Changed simple.exe"
|
||||
end
|
||||
env.clone do |env|
|
||||
env.Checker(:checker, "simple.exe")
|
||||
end
|
||||
expect(lines).to eq(["Checker simple.exe"])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user