class Rake::Task

Constants

APPLY
BINARY
COMMANDLINE
CONFIG
CUSTOM
DEPFILE
EXECUTABLE
LIBRARY
MAKE
MODULE
OBJECT
RUN
SHARED_LIBRARY
SOURCEMULTI
STANDARD
UNKNOWN
UTIL

Attributes

output_disabled[RW]
deps[RW]
failure[RW]
ignore[R]
immediate_output[RW]
output_after_execute[RW]
output_string[RW]
prerequisites[RW]
tags[W]
transparent_timestamp[RW]
type[RW]

Public Class Methods

bail_on_first_error() click to toggle source
# File lib/cxxproject/ext/rake.rb, line 220
def self.bail_on_first_error
  return @@bail_on_first_error
end
bail_on_first_error=(v) click to toggle source
# File lib/cxxproject/ext/rake.rb, line 223
def self.bail_on_first_error=(v)
  @@bail_on_first_error = v
end
needed?() click to toggle source
# File lib/cxxproject/ext/rake.rb, line 312
def self.needed?
   true
end

Public Instance Methods

calc_dirty_for_prerequsites() click to toggle source
# File lib/cxxproject/ext/rake_dirty.rb, line 14
def calc_dirty_for_prerequsites
  res = prerequisites.find do |p|
    t = Task[p]
    if t != nil
      if t.dirty?
        true
      else
        false
      end
    else
      false
    end
  end
  return res != nil
end
dirty?() click to toggle source

return true if this or one of the prerequisites is dirty

# File lib/cxxproject/ext/rake_dirty.rb, line 5
def dirty?
  return calc_dirty_for_prerequsites if apply?(name)

  if needed?
    return true
  end
  return calc_dirty_for_prerequsites
end
handle_error(exception, isSysCmd) click to toggle source
# File lib/cxxproject/ext/rake.rb, line 381
def handle_error(exception, isSysCmd)
   if not application.raise_exceptions
      if not Rake.application.idei.get_abort()
         if not isSysCmd
            Cxxproject::Printer.printError "Error for task #{@name}: #{exception.message}"
            if Rake.application.options.trace
               exception.backtrace.each do |t|
                  Cxxproject::Printer.printError t
               end
            end
         end
      end
      begin
         FileUtils.rm(@name) if File.exists?(@name)
      rescue Exception => follow_up_exception
         Cxxproject::Printer.printError "Error: Could not delete #{@name}: #{follow_up_exception.message}"
      end
      set_failed
   else
      raise exception
   end
end
ignore_missing_file() click to toggle source
# File lib/cxxproject/ext/rake.rb, line 432
def ignore_missing_file
  @ignore = true
end
new_execute(execute_org, arg) click to toggle source
# File lib/cxxproject/ext/rake.rb, line 355
def new_execute(execute_org, arg)
  if not @immediate_output
    s = name == 'console' ? nil : StringIO.new
    tmp = Thread.current[:stdout]
    Thread.current[:stdout] = s unless tmp
  end

  begin
    execute_org.bind(self).call(arg)
  rescue Cxxproject::ExitHelperException
    raise
  rescue Cxxproject::SystemCommandFailed => scf
    handle_error(scf, true)
  rescue SystemExit => exSys
    Rake.application.idei.set_abort(true)
  rescue Exception => ex1
    handle_error(ex1, false)
  end

  if not @immediate_output
    self.output_string = s.string
    Thread.current[:stdout] = tmp
    output(nil, self.output_string)
  end
end
new_invoke_prerequisites(task_args, invocation_chain) click to toggle source
# File lib/cxxproject/ext/rake.rb, line 291
def new_invoke_prerequisites(task_args, invocation_chain)
  orgLength = 0
  while @prerequisites.length > orgLength do
    orgLength = @prerequisites.length

    @prerequisites.dup.each do |n| # dup needed when apply tasks changes that array
      break if Rake.application.idei.get_abort
      #break if @failure

      prereq = nil
      begin
        prereq = application[n, @scope]
        prereq_args = task_args.new_scope(prereq.arg_names)
        prereq.invoke_with_call_chain(prereq_args, invocation_chain)
        set_failed if prereq.failure
      rescue Cxxproject::ExitHelperException
        raise
      rescue Exception => e
         if not application.raise_exceptions
            if prereq and Rake::Task[n].ignore
               @prerequisites.delete(n)
               def self.needed?
                  true
               end
               return
            end
            Cxxproject::Printer.printError "Error #{name}: #{e.message}"
            if RakeFileUtils.verbose == true
               puts e.backtrace
            end
            set_failed
            if e.message.include?('Circular dependency detected')
               Rake.application.idei.set_abort(true)
            end
         else 
            raise e
         end
      end

    end
  end
end
output(name, to_output) click to toggle source
# File lib/cxxproject/ext/rake.rb, line 404
def output(name, to_output)
  return if Rake::Task.output_disabled
  return unless output_after_execute

  if to_output and to_output.length > 0
    puts to_output
  end
end
set_failed() click to toggle source
# File lib/cxxproject/ext/rake.rb, line 334
def set_failed()
  @failure = true
  if Rake::Task.bail_on_first_error
    Rake.application.idei.set_abort(true)
  end
end
tags() click to toggle source
# File lib/cxxproject/ext/rake.rb, line 239
def tags
  @tags = Set.new unless @tags
  return @tags
end
visit(&block) click to toggle source
# File lib/cxxproject/ext/rake.rb, line 436
def visit(&block)
  if block.call(self)
    prerequisite_tasks.each do |t|
      t.visit(&block)
    end
  end
end