lib/rake.rb in drake-0.8.2.1.0.6 vs lib/rake.rb in drake-0.8.2.1.0.7

- old
+ new

@@ -27,11 +27,11 @@ # # This is the main file for the Rake application. Normally it is referenced # as a library via a require statement, but it can be distributed # independently as an application. -RAKEVERSION = '0.8.2.1.0.6' +RAKEVERSION = '0.8.2.1.0.7' require 'rbconfig' require 'getoptlong' require 'fileutils' require 'singleton' @@ -593,17 +593,23 @@ if application.options.trace and application.num_threads == 1 puts "** Invoke #{name} #{format_trace_flags}" end return if @already_invoked @already_invoked = true + + if application.options.randomize + @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 needed? if application.num_threads == 1 execute(task_args) else # gather tasks for batch execution @@ -2274,12 +2280,18 @@ lambda { |value| eval(value) } ], ['--threads', '-j N', "Specifies the number of threads to run simultaneously.", lambda { |value| self.num_threads = value.to_i } ], - #['--fork', '-k', "When --threads=N given, run each thread in a separate process.", - # lambda { options.fork = true } - #], + ['--rand[=SEED]', "Randomize task prerequisite orders", + lambda { |value| + MultiTask.class_eval { remove_method(:invoke_prerequisites) } + options.randomize = true + if value + srand(value.to_i) + end + } + ], ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.", lambda { |value| $:.push(value) } ], ['--prereqs', '-P', "Display the tasks and dependencies, then exit.", lambda { |value| options.show_prereqs = true }