Skip to content

Commit

Permalink
On CI, sort files & check modified w/ digest intead of mtime (#1522)
Browse files Browse the repository at this point in the history
  • Loading branch information
swrobel authored and gauravtiwari committed Jun 3, 2018
1 parent 1169e8f commit b26e1da
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/webpacker/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def last_compilation_digest

def watched_files_digest
files = Dir[*default_watched_paths, *watched_paths].reject { |f| File.directory?(f) }
Digest::SHA1.hexdigest(files.map { |f| "#{File.basename(f)}/#{File.mtime(f).utc.to_i}" }.join("/"))
file_ids = if ENV["CI"]
files.sort.map { |f| "#{File.basename(f)}/#{Digest::SHA1.file(f).hexdigest}" }
else
files.map { |f| "#{File.basename(f)}/#{File.mtime(f).utc.to_i}" }
end
Digest::SHA1.hexdigest(file_ids.join("/"))
end

def record_compilation_digest
Expand Down

0 comments on commit b26e1da

Please sign in to comment.