Compare commits

..
3 Commits
Author SHA1 Message Date
josh 289d27d41d raise Rscons::BuildError on a build failure 2013-08-12 13:13:22 -04:00
josh 052b1afe19 v0.0.3 2013-08-05 17:19:22 -04:00
josh 72976be765 fix verifying a target's checksum 2013-08-05 17:19:08 -04:00
4 changed files with 10 additions and 4 deletions

No files matched your search

+3
View File
@@ -17,4 +17,7 @@ module Rscons
Object, Object,
Program, Program,
] ]
class BuildError < Exception
end
end end
+5 -1
View File
@@ -80,6 +80,7 @@ module Rscons
# @return true value if the target is up to date, meaning that: # @return true value if the target is up to date, meaning that:
# - the target exists on disk # - the target exists on disk
# - the cache has information for the target # - the cache has information for the target
# - the target's checksum matches its checksum when it was last built
# - the command used to build the target is the same as last time # - the command used to build the target is the same as last time
# - all dependencies listed are also listed in the cache, or, if # - all dependencies listed are also listed in the cache, or, if
# :strict_deps was given in options, the list of dependencies is # :strict_deps was given in options, the list of dependencies is
@@ -93,6 +94,9 @@ module Rscons
# target must be registered in the cache # target must be registered in the cache
return false unless @cache[:targets].has_key?(target) return false unless @cache[:targets].has_key?(target)
# target must have the same checksum as when it was built last
return false unless @cache[:targets][target][:checksum] == lookup_checksum(target)
# command used to build target must be identical # command used to build target must be identical
return false unless @cache[:targets][target][:command] == command return false unless @cache[:targets][target][:command] == command
@@ -141,7 +145,7 @@ module Rscons
# Calculate and return a file's checksum # Calculate and return a file's checksum
# @param file [String] The file name. # @param file [String] The file name.
def calculate_checksum(file) def calculate_checksum(file)
@lookup_checksums[file] = Digest::MD5.hexdigest(File.read(file)).encode(__ENCODING__) rescue '' @lookup_checksums[file] = Digest::MD5.hexdigest(File.read(file, {mode: 'rb'})).encode(__ENCODING__) rescue ''
end end
end end
end end
+1 -2
View File
@@ -149,8 +149,7 @@ module Rscons
@targets.each do |target, info| @targets.each do |target, info|
next if targets_processed.include?(target) next if targets_processed.include?(target)
unless process_target.call(target) unless process_target.call(target)
$stderr.puts "Error: failed to build #{target}" raise BuildError.new("Failed to build #{target}")
break
end end
end end
cache.write cache.write
+1 -1
View File
@@ -1,4 +1,4 @@
module Rscons module Rscons
# gem version # gem version
VERSION = "0.0.2" VERSION = "0.0.4"
end end