Skip to content

Commit

Permalink
misc cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
quix committed Apr 6, 2009
1 parent 4899bef commit 3b43c5c
Showing 1 changed file with 12 additions and 27 deletions.
39 changes: 12 additions & 27 deletions lib/rake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,8 @@ def clear_actions
end

def base_invoke(*args) #:nodoc:
invoke_with_call_chain(
TaskArguments.new(arg_names, args),
InvocationChain::EMPTY)
task_args = TaskArguments.new(arg_names, args)
invoke_with_call_chain(task_args, InvocationChain::EMPTY)
end

# Invoke the task if it is needed. Prerequites are invoked first.
Expand Down Expand Up @@ -618,28 +617,17 @@ def invoke_with_call_chain(task_args, invocation_chain) # :nodoc:
@prerequisites = @prerequisites.sort_by { rand }
end

prereqs =
if application.num_threads == 1
invoke_prerequisites(task_args, new_chain)
nil
else
invoke_prerequisites_parallel(task_args, new_chain)
end

if application.num_threads == 1
#
# single-threaded mode
#
if needed?
execute(task_args)
end
invoke_prerequisites(task_args, new_chain)
execute(task_args) if needed?
else
#
# parallel mode
#
# Either the task knows it's needed or we've marked it as
# such. See next comments.
#
prereqs = invoke_prerequisites_parallel(task_args, new_chain)
if application.parallel_parent_flags[self] or needed?
# gather tasks for batch execution
application.parallel_tasks[name] = [task_args, prereqs]
Expand All @@ -650,8 +638,7 @@ def invoke_with_call_chain(task_args, invocation_chain) # :nodoc:
# the 'needed?' flag does not propagate.
#
unless invocation_chain == InvocationChain::EMPTY
application.
parallel_parent_flags[invocation_chain.value] = true
application.parallel_parent_flags[invocation_chain.value] = true
end
end
end
Expand Down Expand Up @@ -1028,19 +1015,17 @@ def import(*fns)
#
# +seq+ : Force tasks to be executed sequentially.
#
(class << self ; self ; end).class_eval {
# use this form to cleanly hide the lambda
seq_lambda = lambda { |*task_names|
def seq
Rake::SEQ_LAMBDA
end
module Rake
SEQ_LAMBDA = lambda { |*task_names|
(1...task_names.size).each { |n|
task task_names[n] => task_names[n - 1]
}
task_names.last
}

define_method(:seq) {
seq_lambda
}
}
end

# ###########################################################################
# This a FileUtils extension that defines several additional commands to be
Expand Down

0 comments on commit 3b43c5c

Please sign in to comment.