Remove Cache dirty-tracking

It really wasn't necessary since Cache#write is not called often.
This commit is contained in:
Josh Holtrop 2019-02-25 21:16:48 -05:00
parent 6ce3d59ad9
commit 68118c2707
2 changed files with 6 additions and 21 deletions

View File

@ -156,7 +156,7 @@ module Rscons
cache.configuration_data["build_dir"] = options[:build_dir] cache.configuration_data["build_dir"] = options[:build_dir]
cache.configuration_data["prefix"] = options[:prefix] cache.configuration_data["prefix"] = options[:prefix]
cache.configuration_data["configured"] = rv == 0 cache.configuration_data["configured"] = rv == 0
cache.write! cache.write
rv rv
end end

View File

@ -96,29 +96,17 @@ module Rscons
# Configuration data. # Configuration data.
def configuration_data=(value) def configuration_data=(value)
@cache["configuration_data"] = value @cache["configuration_data"] = value
@dirty = true
end end
# Write the cache to disk if it is dirty. # Write the cache to disk.
# #
# @return [void] # @return [void]
def write def write
if @dirty || (@cache["version"] != VERSION) @cache["version"] = VERSION
@cache["version"] = VERSION validate_json_object(@cache)
validate_json_object(@cache) File.open(CACHE_FILE, "w") do |fh|
File.open(CACHE_FILE, "w") do |fh| fh.puts(JSON.dump(@cache))
fh.puts(JSON.dump(@cache))
end
end end
@dirty = false
end
# Force a write of the cache to disk.
#
# @return [void]
def write!
@dirty = true
write
end end
# Check if target(s) are up to date. # Check if target(s) are up to date.
@ -272,7 +260,6 @@ module Rscons
} }
end, end,
} }
@dirty = true
end end
end end
@ -297,7 +284,6 @@ module Rscons
unless File.exists?(subpath) unless File.exists?(subpath)
FileUtils.mkdir_p(subpath) FileUtils.mkdir_p(subpath)
@cache["directories"][subpath] = true @cache["directories"][subpath] = true
@dirty = true
end end
end end
end end
@ -339,7 +325,6 @@ module Rscons
@cache["directories"] ||= {} @cache["directories"] ||= {}
@cache["configuration_data"] ||= {} @cache["configuration_data"] ||= {}
@lookup_checksums = {} @lookup_checksums = {}
@dirty = false
end end
# Return a file's checksum, or the previously calculated checksum for # Return a file's checksum, or the previously calculated checksum for