302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
|
# File 'lib/autobuild/config.rb', line 302
def self.apply(packages, buildname = "autobuild", phases = [], options = Hash.new)
options = Kernel.validate_options options,
parallel: Autobuild.parallel_build_level
if Autobuild.mail[:to]
if !Autobuild::HAS_RMAIL
Autobuild.warn "RMail is not available. Mail notification is disabled"
else
Reporting << MailReporter.new(Autobuild.mail)
end
end
if Autobuild.do_rebuild
packages.each do |pkg_name|
Autobuild::Package[pkg_name].prepare_for_rebuild
end
FileUtils.rm_rf Autobuild.prefix
elsif Autobuild.do_forced_build
packages.each do |pkg_name|
Autobuild::Package[pkg_name].prepare_for_forced_build
end
end
if phases.empty?
if Autobuild.only_doc
phases = ['doc']
else
phases = ['import']
phases += %w[prepare build] if Autobuild.do_build
phases << 'doc' if Autobuild.do_doc
end
end
phases.each do |phase|
targets = if packages.empty?
phase
else
packages.
find_all { |pkg| Rake.application.lookup("#{pkg}-#{phase}") }.
map { |pkg| "#{pkg}-#{phase}" }
end
task "#{buildname}-#{phase}" => targets
end
begin
invoker = Autobuild::RakeTaskParallelism.new(options[:parallel])
Autobuild.parallel_task_manager = invoker
phases.each do |phase|
package_tasks = packages.each_with_object({}) do |pkg_name, h|
h["#{pkg_name}-#{phase}"] = true
end
callback =
if block_given?
proc do |task|
yield(task.package, phase) if package_tasks[task.name]
end
else
proc {}
end
invoker.invoke_parallel([Rake::Task["#{buildname}-#{phase}"]],
completion_callback: callback)
end
ensure
Autobuild.parallel_task_manager = nil
end
end
|