Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
289d27d41d | ||
|
|
052b1afe19 | ||
|
|
72976be765 |
No files matched your search
@@ -17,4 +17,7 @@ module Rscons
|
|||||||
Object,
|
Object,
|
||||||
Program,
|
Program,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
class BuildError < Exception
|
||||||
|
end
|
||||||
end
|
end
|
||||||
+5
-1
@@ -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
|
||||||
@@ -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,4 +1,4 @@
|
|||||||
module Rscons
|
module Rscons
|
||||||
# gem version
|
# gem version
|
||||||
VERSION = "0.0.2"
|
VERSION = "0.0.4"
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user