From 9c66bad9f3d522d50d4a45ef8a3a92abbf93229f Mon Sep 17 00:00:00 2001 From: drbrain Date: Thu, 15 Nov 2012 21:59:37 +0000 Subject: * lib/rake*: Updated to rake 0.9.3 * test/rake*: ditto * bin/rake: ditto * NEWS: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rake/task.rb | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'lib/rake/task.rb') diff --git a/lib/rake/task.rb b/lib/rake/task.rb index f977d18711..afa1b6153d 100644 --- a/lib/rake/task.rb +++ b/lib/rake/task.rb @@ -123,6 +123,7 @@ module Rake def clear clear_prerequisites clear_actions + clear_comments self end @@ -138,6 +139,13 @@ module Rake self end + # Clear the existing comments on a rake task. + def clear_comments + @full_comment = nil + @comment = nil + self + end + # Invoke the task if it is needed. Prerequisites are invoked first. def invoke(*args) task_args = TaskArguments.new(arg_names, args) @@ -150,7 +158,7 @@ module Rake new_chain = InvocationChain.append(self, invocation_chain) @lock.synchronize do if application.options.trace - $stderr.puts "** Invoke #{name} #{format_trace_flags}" + application.trace "** Invoke #{name} #{format_trace_flags}" end return if @already_invoked @already_invoked = true @@ -171,10 +179,24 @@ module Rake # Invoke all the prerequisites of a task. def invoke_prerequisites(task_args, invocation_chain) # :nodoc: - prerequisite_tasks.each { |prereq| - prereq_args = task_args.new_scope(prereq.arg_names) - prereq.invoke_with_call_chain(prereq_args, invocation_chain) - } + if application.options.always_multitask + invoke_prerequisites_concurrently(task_args, invocation_chain) + else + prerequisite_tasks.each { |prereq| + prereq_args = task_args.new_scope(prereq.arg_names) + prereq.invoke_with_call_chain(prereq_args, invocation_chain) + } + end + end + + # Invoke all the prerequisites of a task in parallel. + def invoke_prerequisites_concurrently(args, invocation_chain) # :nodoc: + futures = @prerequisites.collect do |p| + application.thread_pool.future(p) do |r| + application[r, @scope].invoke_with_call_chain(args, invocation_chain) + end + end + futures.each { |f| f.value } end # Format the trace flags for display. @@ -190,11 +212,11 @@ module Rake def execute(args=nil) args ||= EMPTY_TASK_ARGS if application.options.dryrun - $stderr.puts "** Execute (dry run) #{name}" + application.trace "** Execute (dry run) #{name}" return end if application.options.trace - $stderr.puts "** Execute #{name}" + application.trace "** Execute #{name}" end application.enhance_with_matching_rule(name) if @actions.empty? @actions.each do |act| -- cgit v1.2.3