From 68118c2707240e468613193d39325e3168ae6c12 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 25 Feb 2019 21:16:48 -0500 Subject: [PATCH] Remove Cache dirty-tracking It really wasn't necessary since Cache#write is not called often. --- lib/rscons/application.rb | 2 +- lib/rscons/cache.rb | 25 +++++-------------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/lib/rscons/application.rb b/lib/rscons/application.rb index bab76c2..e582178 100644 --- a/lib/rscons/application.rb +++ b/lib/rscons/application.rb @@ -156,7 +156,7 @@ module Rscons cache.configuration_data["build_dir"] = options[:build_dir] cache.configuration_data["prefix"] = options[:prefix] cache.configuration_data["configured"] = rv == 0 - cache.write! + cache.write rv end diff --git a/lib/rscons/cache.rb b/lib/rscons/cache.rb index 43fc997..05ba5d3 100644 --- a/lib/rscons/cache.rb +++ b/lib/rscons/cache.rb @@ -96,29 +96,17 @@ module Rscons # Configuration data. def configuration_data=(value) @cache["configuration_data"] = value - @dirty = true end - # Write the cache to disk if it is dirty. + # Write the cache to disk. # # @return [void] def write - if @dirty || (@cache["version"] != VERSION) - @cache["version"] = VERSION - validate_json_object(@cache) - File.open(CACHE_FILE, "w") do |fh| - fh.puts(JSON.dump(@cache)) - end + @cache["version"] = VERSION + validate_json_object(@cache) + File.open(CACHE_FILE, "w") do |fh| + fh.puts(JSON.dump(@cache)) end - @dirty = false - end - - # Force a write of the cache to disk. - # - # @return [void] - def write! - @dirty = true - write end # Check if target(s) are up to date. @@ -272,7 +260,6 @@ module Rscons } end, } - @dirty = true end end @@ -297,7 +284,6 @@ module Rscons unless File.exists?(subpath) FileUtils.mkdir_p(subpath) @cache["directories"][subpath] = true - @dirty = true end end end @@ -339,7 +325,6 @@ module Rscons @cache["directories"] ||= {} @cache["configuration_data"] ||= {} @lookup_checksums = {} - @dirty = false end # Return a file's checksum, or the previously calculated checksum for