class Object

Constants

Ant

For backward compatibility

Public Instance Methods

ant(*args, &block) click to toggle source

This method has three different uses:

  1. Call an ant task or type directly:

    task :compile do # Rake task
      ant.javac { }  # Look I am calling an ant task
    end
    
  2. Provide a block to provide an impromptu ant session

    ant do
      javac {}       # Everything executes as if in an executing ant target
    end
    
  3. Provide arguments to execute ant as it's own build

    ant '-f my_build.xml my_target1'
    
    Additionally this may be passed in array format if you are worried about injection:
    
    args = ['-f', 'my_build.xml', 'my_target1']
    ant args
# File lib/rake/ant/ant.rb, line 206
def ant(*args, &block)
  Rake::Ant.ant(*args, &block)
end
ant_import(filename = 'build.xml') click to toggle source
# File lib/rake/ant/ant.rb, line 214
def ant_import(filename = 'build.xml')
  ant = Rake::Ant.ant

  abs_name = File.expand_path(filename)
  Rake::Ant::ProjectHelper.configure_project ant.project, java.io.File.new(abs_name)

  ant.project.targets.each do |target_name, target|
    name = Rake.application.lookup(target_name) ? "ant_" + target_name : target_name

    task(name) { target.project.execute_target(target_name) }
  end
end
ant_task(*args, &block) click to toggle source
# File lib/rake/ant/rake.rb, line 1
def ant_task(*args, &block)
  task(*args) do |t|
    ant.define_tasks(&block)
  end
end