From 87a15b386872b5f0ea80fe1aa046ac10ba60d150 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 8 May 2019 22:39:50 -0400 Subject: [PATCH] Do not calculate checksums for side-effect files - #92 --- lib/rscons/cache.rb | 9 ++++++++- lib/rscons/environment.rb | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/rscons/cache.rb b/lib/rscons/cache.rb index 1b36eac..343e292 100644 --- a/lib/rscons/cache.rb +++ b/lib/rscons/cache.rb @@ -238,11 +238,18 @@ module Rscons # @param options [Hash] Optional arguments. # @option options [Boolean] :install # Whether the target is for an install operation. + # @option options [Boolean] :side_effect + # Whether the target is a side-effect file (no checksum will be stored). # # @return [void] def register_build(targets, command, deps, env, options = {}) Array(targets).each do |target| - target_checksum = Rscons.phony_target?(target) ? "" : calculate_checksum(target) + target_checksum = + if options[:side_effect] or Rscons.phony_target?(target) + "" + else + calculate_checksum(target) + end @cache["targets"][get_cache_key(target)] = { "command" => Digest::MD5.hexdigest(command.inspect), "checksum" => target_checksum, diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index ca0178f..6283143 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -620,7 +620,7 @@ module Rscons # Register side-effect files as build targets so that a Cache # clean operation will remove them. builder.side_effects.each do |side_effect| - Cache.instance.register_build(side_effect, nil, [], self) + Cache.instance.register_build(side_effect, nil, [], self, side_effect: true) @side_effects.delete(side_effect) end @build_hooks[:post].each do |build_hook_block|