Class: Rake::MultiTask
Overview
Same as a regular task, but the immediate prerequisites are done in parallel using Ruby threads.
Instance Attribute Summary
Attributes inherited from Task
#actions, #already_invoked, #application, #locations, #prerequisites, #scope, #sources
Instance Method Summary collapse
-
#invoke_with_call_chain(task_args, invocation_chain) ⇒ Object
Same as invoke, but explicitly pass a call chain to detect circular dependencies.
Methods inherited from Task
[], #add_description, #all_prerequisite_tasks, #arg_description, #arg_names, #clear, clear, #clear_actions, #clear_args, #clear_comments, #clear_prerequisites, #comment, #comment=, create_rule, define_task, #enhance, #execute, #full_comment, #initialize, #inspect, #investigation, #invoke, #invoke_prerequisites_concurrently, #name, #name_with_args, #needed?, #prerequisite_tasks, #reenable, scope_name, #set_arg_names, #source, task_defined?, tasks, #timestamp, #to_s
Constructor Details
This class inherits a constructor from Rake::Task
Instance Method Details
#invoke_with_call_chain(task_args, invocation_chain) ⇒ Object
Same as invoke, but explicitly pass a call chain to detect circular dependencies. This is largely copied from Rake::Task but has been updated such that if multiple tasks depend on this one in parallel, they will all fail if the first execution of this task fails.
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 |
# File 'lib/rake/multi_task.rb', line 13 def invoke_with_call_chain(task_args, invocation_chain) new_chain = Rake::InvocationChain.append(self, invocation_chain) @lock.synchronize do begin if @already_invoked if @invocation_exception if application..trace application.trace "** Previous invocation of #{name} failed #{format_trace_flags}" end raise @invocation_exception else return end end if application..trace application.trace "** Invoke #{name} #{format_trace_flags}" end @already_invoked = true invoke_prerequisites(task_args, new_chain) execute(task_args) if needed? rescue Exception => ex add_chain_to(ex, new_chain) @invocation_exception = ex raise end end end |