Environment: rework process()

- improve efficiency
- give errors for the dependency that failed instead of the top-level target
This commit is contained in:
josh committed 2013-11-05 12:43:50 -05:00
1 parent 7ce5a8f9d9
commit e863c9a564
2 files changed
+33 -17

No files matched your search

+15 -1
View File
@@ -113,6 +113,20 @@ module Rscons
env.process
end
it "builds dependent targets first" do
env = Environment.new
env.Program("a.out", "main.o")
env.Object("main.o", "other.cc")
cache = "cache"
Cache.should_receive(:new).and_return(cache)
env.should_receive(:run_builder).with(anything, "main.o", ["other.cc"], cache, {}).and_return("main.o")
env.should_receive(:run_builder).with(anything, "a.out", ["main.o"], cache, {}).and_return("a.out")
cache.should_receive(:write)
env.process
end
it "raises a BuildError when building fails" do
env = Environment.new
env.Program("a.out", "main.o")
@@ -123,7 +137,7 @@ module Rscons
env.should_receive(:run_builder).with(anything, "main.o", ["other.cc"], cache, {}).and_return(false)
cache.should_receive(:write)
expect { env.process }.to raise_error BuildError, /Failed.to.build.a\.out/
expect { env.process }.to raise_error BuildError, /Failed.to.build.main.o/
end
end