6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/origen/generator/comparator.rb', line 6
def check_for_changes(new, old, options = {})
options = {
comment_char: Origen.app.tester ? Origen.app.tester. : nil,
quiet: false,
compile_job: false,
suspend_string: 'STOPDIFF',
resume_string: 'STARTDIFF'
}.merge(options)
if File.exist?(old)
if Utility::Diff.new(file_a: new, file_b: old, ignore_blank_lines: options[:ignore_blank_lines],
comment_char: options[:comment_char],
suspend_string: options[:suspend_string],
resume_string: options[:resume_string]).diffs?
unless options[:quiet]
cmd = "*** CHANGE DETECTED *** To update the reference: #{Origen.config.copy_command} #{relative_path_to(new)} #{relative_path_to(old)}"
cmd += ' /Y' if Origen.running_on_windows?
Origen.log.info cmd
Origen.log.info "#{Origen.config.diff_command} #{relative_path_to(old)} #{relative_path_to(new)} &"
Origen.log.info '**********************************************************************'
end
if options[:compile_job]
stats.changed_files += 1
else
stats.changed_patterns += 1
end
true
end
else
unless options[:quiet]
Origen.log.info "*** NEW FILE *** To save it: #{Origen.config.copy_command} #{relative_path_to(new)} #{relative_path_to(old)}"
Origen.log.info '**********************************************************************'
end
if options[:compile_job]
stats.new_files += 1
else
stats.new_patterns += 1
end
true
end
end
|