Top Level Namespace

Includes:
Rake::DSL

Defined Under Namespace

Modules: Rake Classes: Ant, FileList, RakeWrapper

Instance Method Summary collapse

Instance Method Details

#ant(*args, &block) ⇒ Object

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
    


206
207
208
# File 'lib/rake/ant/ant.rb', line 206

def ant(*args, &block)
  Ant.ant(*args, &block)
end

#ant_import(filename = 'build.xml') ⇒ Object



213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/rake/ant/ant.rb', line 213

def ant_import(filename = 'build.xml')
  ant = Ant.ant

  abs_name = File.expand_path(filename)
  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) ⇒ Object



1
2
3
4
5
# File 'lib/rake/ant/rake.rb', line 1

def ant_task(*args, &block)
  task(*args) do |t|
    ant.define_tasks(&block)
  end
end