autobuild 1.20.0 → 1.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +25 -0
  3. data/.github/workflows/test.yml +30 -0
  4. data/.rubocop.yml +14 -7
  5. data/autobuild.gemspec +7 -6
  6. data/bin/autobuild +1 -1
  7. data/lib/autobuild/build_logfile.rb +1 -2
  8. data/lib/autobuild/config.rb +5 -5
  9. data/lib/autobuild/environment.rb +126 -58
  10. data/lib/autobuild/exceptions.rb +13 -6
  11. data/lib/autobuild/import/archive.rb +33 -23
  12. data/lib/autobuild/import/cvs.rb +6 -6
  13. data/lib/autobuild/import/darcs.rb +4 -4
  14. data/lib/autobuild/import/git-lfs.rb +4 -4
  15. data/lib/autobuild/import/git.rb +155 -73
  16. data/lib/autobuild/import/hg.rb +7 -7
  17. data/lib/autobuild/import/svn.rb +17 -10
  18. data/lib/autobuild/importer.rb +37 -39
  19. data/lib/autobuild/mail_reporter.rb +5 -2
  20. data/lib/autobuild/package.rb +28 -15
  21. data/lib/autobuild/packages/autotools.rb +6 -10
  22. data/lib/autobuild/packages/cmake.rb +13 -9
  23. data/lib/autobuild/packages/dummy.rb +0 -4
  24. data/lib/autobuild/packages/gnumake.rb +1 -1
  25. data/lib/autobuild/packages/orogen.rb +11 -4
  26. data/lib/autobuild/packages/pkgconfig.rb +2 -2
  27. data/lib/autobuild/packages/python.rb +19 -8
  28. data/lib/autobuild/packages/ruby.rb +5 -5
  29. data/lib/autobuild/parallel.rb +9 -17
  30. data/lib/autobuild/pkgconfig.rb +1 -0
  31. data/lib/autobuild/progress_display.rb +67 -43
  32. data/lib/autobuild/rake_task_extension.rb +6 -0
  33. data/lib/autobuild/reporting.rb +15 -9
  34. data/lib/autobuild/subcommand.rb +30 -26
  35. data/lib/autobuild/test_utility.rb +6 -3
  36. data/lib/autobuild/timestamps.rb +3 -3
  37. data/lib/autobuild/utility.rb +22 -4
  38. data/lib/autobuild/version.rb +1 -1
  39. data/lib/autobuild.rb +0 -3
  40. metadata +28 -26
  41. data/.travis.yml +0 -19
@@ -4,15 +4,10 @@ module Autobuild
4
4
  # Since autobuild does not use task arguments, we don't support them for
5
5
  # simplicity
6
6
  class RakeTaskParallelism
7
- attr_reader :available_workers
8
- attr_reader :finished_workers
9
- attr_reader :workers
10
-
11
- attr_reader :job_server
7
+ attr_reader :available_workers, :finished_workers, :workers, :job_server
12
8
 
13
9
  class JobServer
14
- attr_reader :rio
15
- attr_reader :wio
10
+ attr_reader :rio, :wio
16
11
 
17
12
  def initialize(level)
18
13
  @rio, @wio = IO.pipe
@@ -76,14 +71,10 @@ module Autobuild
76
71
  end
77
72
 
78
73
  class ProcessingState
79
- attr_reader :reverse_dependencies
80
- attr_reader :processed
81
- attr_reader :started_packages
82
- attr_reader :active_tasks
83
- attr_reader :queue
84
- attr_reader :priorities
85
-
86
- def initialize(reverse_dependencies, completion_callback: proc { })
74
+ attr_reader :reverse_dependencies, :processed, :started_packages,
75
+ :active_tasks, :queue, :priorities
76
+
77
+ def initialize(reverse_dependencies, completion_callback: proc {})
87
78
  @reverse_dependencies = reverse_dependencies
88
79
  @completion_callback = completion_callback
89
80
  @processed = Set.new
@@ -97,7 +88,8 @@ module Autobuild
97
88
  if task.respond_to?(:package)
98
89
  started_packages[task.package] ||= -started_packages.size
99
90
  queue[task] = started_packages[task.package]
100
- else queue[task] = base_priority
91
+ else
92
+ queue[task] = base_priority
101
93
  end
102
94
  end
103
95
 
@@ -156,7 +148,7 @@ module Autobuild
156
148
 
157
149
  # Invokes the provided tasks. Unlike the rake code, this is a toplevel
158
150
  # algorithm that does not use recursion
159
- def invoke_parallel(required_tasks, completion_callback: proc { })
151
+ def invoke_parallel(required_tasks, completion_callback: proc {})
160
152
  tasks = Set.new
161
153
  reverse_dependencies = Hash.new { |h, k| h[k] = Set.new }
162
154
  required_tasks.each do |t|
@@ -5,6 +5,7 @@ class PkgConfig
5
5
 
6
6
  def initialize(name)
7
7
  @name = name
8
+ super()
8
9
  end
9
10
 
10
11
  def to_s
@@ -1,3 +1,6 @@
1
+ require "concurrent/atomic/atomic_boolean"
2
+ require "concurrent/array"
3
+
1
4
  module Autobuild
2
5
  # Management of the progress display
3
6
  class ProgressDisplay
@@ -5,7 +8,7 @@ module Autobuild
5
8
  @io = io
6
9
  @cursor = TTY::Cursor
7
10
  @last_formatted_progress = []
8
- @progress_messages = []
11
+ @progress_messages = Concurrent::Array.new
9
12
 
10
13
  @silent = false
11
14
  @color = color
@@ -14,6 +17,15 @@ module Autobuild
14
17
  @next_progress_display = Time.at(0)
15
18
  @progress_mode = :single_line
16
19
  @progress_period = 0.1
20
+
21
+ @message_queue = Queue.new
22
+ @forced_progress_display = Concurrent::AtomicBoolean.new(false)
23
+ end
24
+
25
+ def synchronize(&block)
26
+ result = @display_lock.synchronize(&block)
27
+ refresh_display
28
+ result
17
29
  end
18
30
 
19
31
  # Set the minimum time between two progress messages
@@ -33,7 +45,7 @@ module Autobuild
33
45
  # Valid progress modes
34
46
  #
35
47
  # @see progress_mode=
36
- PROGRESS_MODES = %I[single_line newline off]
48
+ PROGRESS_MODES = %I[single_line newline off].freeze
37
49
 
38
50
  # Sets how progress messages will be displayed
39
51
  #
@@ -45,7 +57,7 @@ module Autobuild
45
57
  unless PROGRESS_MODES.include?(mode)
46
58
  raise ArgumentError,
47
59
  "#{mode} is not a valid mode, expected one of "\
48
- "#{PROGRESS_MODES.join(", ")}"
60
+ "#{PROGRESS_MODES.join(', ')}"
49
61
  end
50
62
  @progress_mode = mode
51
63
  end
@@ -60,9 +72,7 @@ module Autobuild
60
72
  @silent
61
73
  end
62
74
 
63
- def silent=(flag)
64
- @silent = flag
65
- end
75
+ attr_writer :silent
66
76
 
67
77
  def silent
68
78
  silent = @silent
@@ -86,17 +96,9 @@ module Autobuild
86
96
  return if silent? && !force
87
97
 
88
98
  io = args.pop if args.last.respond_to?(:to_io)
99
+ @message_queue << [message, args, io]
89
100
 
90
- @display_lock.synchronize do
91
- if @progress_mode == :single_line
92
- io.print @cursor.clear_screen_down
93
- end
94
- io.puts @color.call(message, *args)
95
-
96
- io.flush if @io != io
97
- display_progress
98
- @io.flush
99
- end
101
+ refresh_display
100
102
  end
101
103
 
102
104
  def progress_start(key, *args, done_message: nil)
@@ -105,13 +107,13 @@ module Autobuild
105
107
  formatted_message = @color.call(*args)
106
108
  @progress_messages << [key, formatted_message]
107
109
  if progress_enabled?
108
- @display_lock.synchronize do
109
- display_progress(consider_period: false)
110
- end
110
+ @forced_progress_display.make_true
111
111
  else
112
112
  message " #{formatted_message}"
113
113
  end
114
114
 
115
+ refresh_display
116
+
115
117
  if block_given?
116
118
  begin
117
119
  result = yield
@@ -125,46 +127,67 @@ module Autobuild
125
127
  end
126
128
 
127
129
  def progress(key, *args)
128
- @display_lock.synchronize do
129
- found = false
130
- @progress_messages.map! do |msg_key, msg|
131
- if msg_key == key
132
- found = true
133
- [msg_key, @color.call(*args)]
134
- else
135
- [msg_key, msg]
136
- end
130
+ found = false
131
+ @progress_messages.map! do |msg_key, msg|
132
+ if msg_key == key
133
+ found = true
134
+ [msg_key, @color.call(*args)]
135
+ else
136
+ [msg_key, msg]
137
137
  end
138
- @progress_messages << [key, @color.call(*args)] unless found
139
- display_progress
140
138
  end
139
+ @progress_messages << [key, @color.call(*args)] unless found
140
+
141
+ refresh_display
141
142
  end
142
143
 
143
144
  def progress_done(key, display_last = true, message: nil)
144
- changed = @display_lock.synchronize do
145
- current_size = @progress_messages.size
146
- @progress_messages.delete_if do |msg_key, msg|
147
- if msg_key == key
148
- message = msg if display_last && !message
149
- true
150
- end
145
+ current_size = @progress_messages.size
146
+ @progress_messages.delete_if do |msg_key, msg|
147
+ if msg_key == key
148
+ message = msg if display_last && !message
149
+ true
151
150
  end
152
- current_size != @progress_messages.size
153
151
  end
152
+ changed = current_size != @progress_messages.size
154
153
 
155
154
  if changed
156
155
  if message
157
156
  message(" #{message}")
158
- # Note: message calls display_progress already
157
+ # NOTE: message updates the display already
159
158
  else
160
- @display_lock.synchronize do
161
- display_progress
162
- end
159
+ refresh_display
163
160
  end
164
161
  true
165
162
  end
166
163
  end
167
164
 
165
+ def refresh_display
166
+ return unless @display_lock.try_lock
167
+
168
+ begin
169
+ refresh_display_under_lock
170
+ ensure
171
+ @display_lock.unlock
172
+ end
173
+ end
174
+
175
+ def refresh_display_under_lock
176
+ # Display queued messages
177
+ until @message_queue.empty?
178
+ message, args, io = @message_queue.pop
179
+ io.print @cursor.clear_screen_down if @progress_mode == :single_line
180
+ io.puts @color.call(message, *args)
181
+
182
+ io.flush if @io != io
183
+ end
184
+
185
+ # And re-display the progress
186
+ display_progress(consider_period: @forced_progress_display.false?)
187
+ @forced_progress_display.make_false
188
+ @io.flush
189
+ end
190
+
168
191
  def display_progress(consider_period: true)
169
192
  return unless progress_enabled?
170
193
  return if consider_period && (@next_progress_display > Time.now)
@@ -223,7 +246,8 @@ module Autobuild
223
246
  groups.last[1] = (current_group.first..group_end_index)
224
247
  groups << [prefix, [idx, other_idx]]
225
248
  grouping = true
226
- else break
249
+ else
250
+ break
227
251
  end
228
252
  end
229
253
  end
@@ -1,5 +1,10 @@
1
1
  module Autobuild
2
2
  module RakeTaskExtension
3
+ def initialize(*, **)
4
+ super
5
+ @disabled = false
6
+ end
7
+
3
8
  def already_invoked?
4
9
  @already_invoked
5
10
  end
@@ -19,6 +24,7 @@ module Autobuild
19
24
  end
20
25
  end
21
26
  end
27
+
22
28
  class Rake::Task # rubocop:disable Style/ClassAndModuleChildren
23
29
  include Autobuild::RakeTaskExtension
24
30
  end
@@ -47,6 +47,10 @@ module Autobuild
47
47
  @display.progress_enabled?
48
48
  end
49
49
 
50
+ def self.progress_display_synchronize(&block)
51
+ @display.synchronize(&block)
52
+ end
53
+
50
54
  # @deprecated use {progress_display_mode=} instead
51
55
  def self.progress_display_enabled=(value)
52
56
  @display.progress_enabled = value
@@ -101,8 +105,8 @@ module Autobuild
101
105
  interrupted = e
102
106
  rescue Autobuild::Exception => e
103
107
  return report_finish_on_error([e],
104
- on_package_failures: on_package_failures,
105
- interrupted_by: interrupted)
108
+ on_package_failures: on_package_failures,
109
+ interrupted_by: interrupted)
106
110
  end
107
111
 
108
112
  # If ignore_erorrs is true, check if some packages have failed
@@ -114,8 +118,8 @@ module Autobuild
114
118
  end
115
119
 
116
120
  report_finish_on_error(errors,
117
- on_package_failures: on_package_failures,
118
- interrupted_by: interrupted)
121
+ on_package_failures: on_package_failures,
122
+ interrupted_by: interrupted)
119
123
  end
120
124
 
121
125
  # @api private
@@ -126,7 +130,8 @@ module Autobuild
126
130
  # :exit if debug is false, or :raise if it is true
127
131
  def self.default_report_on_package_failures
128
132
  if Autobuild.debug then :raise
129
- else :exit
133
+ else
134
+ :exit
130
135
  end
131
136
  end
132
137
 
@@ -159,14 +164,15 @@ module Autobuild
159
164
  raise interrupted_by if interrupted_by
160
165
 
161
166
  e = if errors.size == 1 then errors.first
162
- else CompositeException.new(errors)
167
+ else
168
+ CompositeException.new(errors)
163
169
  end
164
170
  raise e
165
171
  elsif %i[report_silent report].include?(on_package_failures)
166
172
  if interrupted_by
167
173
  raise interrupted_by
168
174
  else
169
- return errors
175
+ errors
170
176
  end
171
177
  elsif %i[exit exit_silent].include?(on_package_failures)
172
178
  exit 1
@@ -240,8 +246,8 @@ module Autobuild
240
246
  scaled_size = (size / scale)
241
247
  if scaled_size > 1
242
248
  return format("%3.1<scaled>f%<scale_name>s",
243
- scaled: scaled_size,
244
- scale_name: name)
249
+ scaled: scaled_size,
250
+ scale_name: name)
245
251
  end
246
252
  end
247
253
  end
@@ -161,6 +161,7 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
161
161
  def initialize(status, do_retry)
162
162
  @status = status
163
163
  @retry = do_retry
164
+ super()
164
165
  end
165
166
  end
166
167
 
@@ -222,12 +223,14 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
222
223
 
223
224
  if command.last.kind_of?(Hash)
224
225
  options = command.pop
225
- options = Kernel.validate_options options,
226
+ options = Kernel.validate_options(
227
+ options,
226
228
  input: nil, working_directory: nil, retry: false,
227
229
  input_streams: [],
228
230
  env: ENV.to_hash,
229
231
  env_inherit: true,
230
232
  encoding: 'BINARY'
233
+ )
231
234
 
232
235
  input_streams << File.open(options[:input]) if options[:input]
233
236
  input_streams.concat(options[:input_streams]) if options[:input_streams]
@@ -248,15 +251,16 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
248
251
  end
249
252
  logdir = if target.respond_to?(:logdir)
250
253
  target.logdir
251
- else Autobuild.logdir
254
+ else
255
+ Autobuild.logdir
252
256
  end
253
257
 
254
258
  if target.respond_to?(:working_directory)
255
259
  options[:working_directory] ||= target.working_directory
256
260
  end
257
261
 
258
- logname = File.join(logdir, "#{target_name.gsub(/[:]/, '_')}-"\
259
- "#{phase.to_s.gsub(/[:]/, '_')}.log")
262
+ logname = File.join(logdir, "#{target_name.gsub(/:/, '_')}-"\
263
+ "#{phase.to_s.gsub(/:/, '_')}.log")
260
264
  unless File.directory?(File.dirname(logname))
261
265
  FileUtils.mkdir_p File.dirname(logname)
262
266
  end
@@ -268,7 +272,8 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
268
272
 
269
273
  open_flag = if Autobuild.keep_oldlogs then 'a'
270
274
  elsif Autobuild.registered_logfile?(logname) then 'a'
271
- else 'w'
275
+ else
276
+ 'w'
272
277
  end
273
278
  open_flag << ":BINARY"
274
279
 
@@ -312,8 +317,9 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
312
317
  if Autobuild.windows?
313
318
  Dir.chdir(options[:working_directory]) do
314
319
  unless system(*command)
315
- raise Failed.new($CHILD_STATUS.exitstatus, nil),
316
- "'#{command.join(' ')}' returned status #{status.exitstatus}"
320
+ exit_code = $CHILD_STATUS.exitstatus
321
+ raise Failed.new(exit_code, nil),
322
+ "'#{command.join(' ')}' returned status #{exit_code}"
317
323
  end
318
324
  end
319
325
  return # rubocop:disable Lint/NonLocalExitFromIterator
@@ -322,7 +328,6 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
322
328
  cwrite.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
323
329
 
324
330
  pid = fork do
325
- begin
326
331
  logfile.puts "in directory #{options[:working_directory] || Dir.pwd}"
327
332
 
328
333
  cwrite.sync = true
@@ -340,20 +345,19 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
340
345
  end
341
346
 
342
347
  exec(env, *command,
343
- chdir: options[:working_directory] || Dir.pwd,
344
- close_others: false)
345
- rescue Errno::ENOENT
348
+ chdir: options[:working_directory] || Dir.pwd,
349
+ close_others: false)
350
+ rescue Errno::ENOENT
346
351
  cwrite.write([CONTROL_COMMAND_NOT_FOUND].pack('I'))
347
352
  exit(100)
348
- rescue Interrupt
353
+ rescue Interrupt
349
354
  cwrite.write([CONTROL_INTERRUPT].pack('I'))
350
355
  exit(100)
351
- rescue ::Exception => e
356
+ rescue ::Exception => e
352
357
  STDERR.puts e
353
358
  STDERR.puts e.backtrace.join("\n ")
354
359
  cwrite.write([CONTROL_UNEXPECTED].pack('I'))
355
360
  exit(100)
356
- end
357
361
  end
358
362
 
359
363
  readbuffer = StringIO.new
@@ -372,7 +376,7 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
372
376
  end
373
377
  rescue Errno::ENOENT => e
374
378
  raise Failed.new(nil, false),
375
- "cannot open input files: #{e.message}", retry: false
379
+ "cannot open input files: #{e.message}", retry: false
376
380
  end
377
381
  pwrite.close
378
382
  end
@@ -382,15 +386,14 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
382
386
  value = cread.read(4)
383
387
  if value
384
388
  # An error occured
385
- value = value.unpack('I').first
386
- if value == CONTROL_COMMAND_NOT_FOUND
387
- raise Failed.new(nil, false),
388
- "command '#{command.first}' not found"
389
- elsif value == CONTROL_INTERRUPT
389
+ value = value.unpack1('I')
390
+ case value
391
+ when CONTROL_COMMAND_NOT_FOUND
392
+ raise Failed.new(nil, false), "command '#{command.first}' not found"
393
+ when CONTROL_INTERRUPT
390
394
  raise Interrupt, "command '#{command.first}': interrupted by user"
391
395
  else
392
- raise Failed.new(nil, false),
393
- "something unexpected happened"
396
+ raise Failed.new(nil, false), "something unexpected happened"
394
397
  end
395
398
  end
396
399
 
@@ -439,10 +442,10 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
439
442
 
440
443
  if status.termsig
441
444
  raise Failed.new(status.exitstatus, nil),
442
- "'#{command.join(' ')}' terminated by signal #{status.termsig}"
445
+ "'#{command.join(' ')}' terminated by signal #{status.termsig}"
443
446
  else
444
447
  raise Failed.new(status.exitstatus, nil),
445
- "'#{command.join(' ')}' returned status #{status.exitstatus}"
448
+ "'#{command.join(' ')}' returned status #{status.exitstatus}"
446
449
  end
447
450
  end
448
451
 
@@ -458,9 +461,10 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
458
461
  subcommand_output
459
462
  rescue Failed => e
460
463
  error = Autobuild::SubcommandFailed.new(target, command.join(" "),
461
- logname, e.status, subcommand_output)
464
+ logname, e.status, subcommand_output)
462
465
  error.retry = if e.retry?.nil? then options[:retry]
463
- else e.retry?
466
+ else
467
+ e.retry?
464
468
  end
465
469
  error.phase = phase
466
470
  raise error, e.message
@@ -24,7 +24,8 @@ module Autobuild
24
24
  def coverage_enabled?
25
25
  if @coverage_enabled.nil?
26
26
  TestUtility.coverage_enabled?
27
- else @coverage_enabled
27
+ else
28
+ @coverage_enabled
28
29
  end
29
30
  end
30
31
 
@@ -53,7 +54,8 @@ module Autobuild
53
54
  if @coverage_source_dir
54
55
  relative = if package.respond_to?(:builddir)
55
56
  package.builddir
56
- else package.srcdir
57
+ else
58
+ package.srcdir
57
59
  end
58
60
  File.expand_path(@coverage_source_dir, relative)
59
61
  end
@@ -73,7 +75,8 @@ module Autobuild
73
75
  def coverage_target_dir
74
76
  if @coverage_target_dir
75
77
  File.expand_path(@coverage_target_dir, package.prefix)
76
- else File.join(target_dir, 'coverage')
78
+ elsif (target_dir = self.target_dir)
79
+ File.join(target_dir, 'coverage')
77
80
  end
78
81
  end
79
82
 
@@ -58,8 +58,7 @@ module Autobuild
58
58
  class SourceTreeTask < Rake::Task
59
59
  attr_accessor :exclude
60
60
 
61
- attr_reader :newest_file
62
- attr_reader :newest_time
61
+ attr_reader :newest_file, :newest_time
63
62
 
64
63
  def initialize(*args, &block)
65
64
  @exclude = Autobuild.ignored_files.dup
@@ -71,10 +70,11 @@ module Autobuild
71
70
 
72
71
  @newest_file, @newest_time =
73
72
  Autobuild.tree_timestamp(name,
74
- %r{(?:^|/)(?:CVS|_darcs|\.svn)$}, *@exclude)
73
+ %r{(?:^|/)(?:CVS|_darcs|\.svn)$}, *@exclude)
75
74
  @newest_time
76
75
  end
77
76
  end
77
+
78
78
  def self.source_tree(path, &block)
79
79
  task = SourceTreeTask.define_task(path)
80
80
  block&.call(task)
@@ -30,6 +30,7 @@ module Autobuild
30
30
  @target_dir = nil
31
31
  @install_on_error = install_on_error
32
32
 
33
+ @no_results = false
33
34
  @invoked = false
34
35
  @success = false
35
36
  @installed = false
@@ -58,6 +59,23 @@ module Autobuild
58
59
  # not install anything
59
60
  attr_writer :target_dir
60
61
 
62
+ # Controls whether this utility generates results or not
63
+ #
64
+ # By default, Autobuild assumes that utilities generate report or
65
+ # artifact files, that are saved in {#target_dir}. Set this flag to
66
+ # true to disable this behavior, in which case the only report will
67
+ # be the console output during run
68
+ #
69
+ # @see no_results?
70
+ attr_writer :no_results
71
+
72
+ # Whether this utility generates results or not
73
+ #
74
+ # @see no_results=
75
+ def no_results?
76
+ @no_results
77
+ end
78
+
61
79
  # Absolute path to where the utility product files have to be installed.
62
80
  # Returns nil if {target_dir} is not set.
63
81
  #
@@ -66,7 +84,7 @@ module Autobuild
66
84
  if @target_dir
67
85
  utility_prefix = Autobuild.send("#{name}_prefix") || name
68
86
  File.expand_path(@target_dir,
69
- File.expand_path(utility_prefix, package.prefix))
87
+ File.expand_path(utility_prefix, package.prefix))
70
88
  else
71
89
  File.join(package.logdir, "#{name}-results", package.name)
72
90
  end
@@ -108,13 +126,13 @@ module Autobuild
108
126
  yield if block_given?
109
127
  @success = true
110
128
  rescue StandardError => e
111
- install if install_on_error? && !@installed && target_dir
129
+ install if install_on_error? && !@installed && !no_results?
112
130
  raise
113
131
  end
114
132
 
115
133
  # Allow the user to install manually in the task
116
134
  # block
117
- install if !@installed && target_dir
135
+ install if !@installed && !no_results?
118
136
  rescue StandardError => e
119
137
  @success = false
120
138
 
@@ -138,7 +156,7 @@ module Autobuild
138
156
  #
139
157
  # @return [Boolean]
140
158
  def available?
141
- @available && (source_dir && @task)
159
+ @available && @task && (no_results? || source_dir)
142
160
  end
143
161
 
144
162
  # True if this utility should be executed
@@ -1,3 +1,3 @@
1
1
  module Autobuild
2
- VERSION = "1.20.0".freeze unless defined? Autobuild::VERSION
2
+ VERSION = "1.23.0".freeze unless defined? Autobuild::VERSION
3
3
  end
data/lib/autobuild.rb CHANGED
@@ -17,11 +17,9 @@ require 'etc'
17
17
  require 'find'
18
18
  require 'pathname'
19
19
  require 'shellwords'
20
- require 'find'
21
20
  require 'rake/tasklib'
22
21
  require 'fileutils'
23
22
  require 'optparse'
24
- require 'rake'
25
23
  require 'singleton'
26
24
  require 'pastel'
27
25
  require 'tty-prompt'
@@ -43,7 +41,6 @@ require 'autobuild/config'
43
41
  require 'autobuild/importer'
44
42
  require 'autobuild/import/cvs'
45
43
  require 'autobuild/import/darcs'
46
- require 'autobuild/importer'
47
44
  require 'autobuild/import/git'
48
45
  require 'autobuild/import/hg'
49
46
  require 'autobuild/import/svn'