fix Cache#up_to_date?() checking dependency subset - initial rebuilding only when necessary working

This commit is contained in:
Josh Holtrop 2013-07-14 23:14:59 -04:00
parent 0bf71ae4d1
commit 833cc5915e
2 changed files with 3 additions and 2 deletions

View File

@ -60,7 +60,8 @@ module Rscons
# command line used to build target must be identical # command line used to build target must be identical
return false unless @cache[target][:command] == command return false unless @cache[target][:command] == command
# all dependencies passed in must exist in cache (but cache may have more) # all dependencies passed in must exist in cache (but cache may have more)
return false unless (Set.new(deps) - Set.new(@cache[target][:deps])).empty? cached_deps = @cache[target][:deps].map { |dc| dc[:fname] }
return false unless (Set.new(deps) - Set.new(cached_deps)).empty?
# all cached dependencies must have their checksums match # all cached dependencies must have their checksums match
@cache[target][:deps].map do |dep_cache| @cache[target][:deps].map do |dep_cache|
dep_cache[:checksum] == lookup_checksum(dep_cache[:fname]) dep_cache[:checksum] == lookup_checksum(dep_cache[:fname])

View File

@ -79,7 +79,7 @@ describe Rscons do
`./header`.should == "The value is 5\n" `./header`.should == "The value is 5\n"
end end
xit 'does not rebuild a C module when its dependencies have not changed' do it 'does not rebuild a C module when its dependencies have not changed' do
lines = test_dir('header') lines = test_dir('header')
`./header`.should == "The value is 2\n" `./header`.should == "The value is 2\n"
lines.should == [ lines.should == [