Sha256: 0cc02b1b8bc719c4e56954dec630bf9a44abfc26901d1b19d2b00bbafdc451f0

Contents?: true

Size: 1.52 KB

Versions: 15

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true
module Rake

  # Same as a regular task, but the immediate prerequisites are done in
  # parallel using Ruby threads.
  #
  class MultiTask < Task

    # 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.
    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.options.trace
                application.trace "** Previous invocation of #{name} failed #{format_trace_flags}"
              end
              raise @invocation_exception
            else
              return
            end
          end

          if application.options.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

    private
    def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
      invoke_prerequisites_concurrently(task_args, invocation_chain)
    end
  end

end

Version data entries

15 entries across 15 versions & 4 rubygems

Version Path
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/rake-12.3.0/lib/rake/multi_task.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/rake-12.3.0/lib/rake/multi_task.rb
logstash-filter-device_detection-1.0.7-java vendor/bundle/jruby/1.9/gems/rake-12.2.1/lib/rake/multi_task.rb
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/rake-12.3.0/lib/rake/multi_task.rb
tdiary-5.0.7 vendor/bundle/gems/rake-12.3.0/lib/rake/multi_task.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/multi_task.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/multi_task.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/multi_task.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/multi_task.rb
rake-12.3.0 lib/rake/multi_task.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/rake-12.1.0/lib/rake/multi_task.rb
rake-12.2.1 lib/rake/multi_task.rb
rake-12.2.0 lib/rake/multi_task.rb
tdiary-5.0.6 vendor/bundle/gems/rake-12.1.0/lib/rake/multi_task.rb
rake-12.1.0 lib/rake/multi_task.rb