Calls a given target for all defined sub-builds. This is an extension
of ant for bulk project execution.
Use with directories
subant can be used with directory sets to execute a build from different directories.
2 different options are offered
-
run the same build file /somepath/otherpath/mybuild.xml
with different base directories use the genericantfile attribute
- if you want to run directory1/build.xml, directory2/build.xml, ....
use the antfile attribute. The base directory does not get set by the subant task in this case,
because you can specify it in each build file.
addDirset
public void addDirset(DirSet set)
Adds a directory set to the implicit build path.
Note that the directories will be added to the build path
in no particular order, so if order is significant, one should
use a file list instead!
set
- the directory set to add.
addFilelist
public void addFilelist(FileList list)
Adds an ordered file list to the implicit build path.
Note that contrary to file and directory sets, file lists
can reference non-existent files or directories!
list
- the file list to add.
addFileset
public void addFileset(FileSet set)
Adds a file set to the implicit build path.
Note that the directories will be added to the build path
in no particular order, so if order is significant, one should
use a file list instead!
set
- the file set to add.
addProperty
public void addProperty(Property p)
Corresponds to <ant>
's
nested <property>
element.
p
- the property to pass on explicitly to the sub-build.
addPropertyset
public void addPropertyset(PropertySet ps)
Corresponds to <ant>
's
nested <propertyset>
element.
ps
- the propertset
addReference
public void addReference(Ant.Reference r)
Corresponds to <ant>
's
nested <reference>
element.
r
- the reference to pass on explicitly to the sub-build.
createBuildpath
public Path createBuildpath()
Creates a nested build path, and add it to the implicit build path.
- the newly created nested build path.
createBuildpathElement
public Path.PathElement createBuildpathElement()
Creates a nested <buildpathelement>
,
and add it to the implicit build path.
- the newly created nested build path element.
execute
public void execute()
Runs the various sub-builds.
- execute in interface Task
handleErrorFlush
public void handleErrorFlush(String output)
Pass output sent to System.err to the new project.
- handleErrorFlush in interface Task
output
- The error output to log. Should not be null
.
- Ant 1.6.2
handleErrorOutput
public void handleErrorOutput(String output)
Pass output sent to System.err to the new project.
- handleErrorOutput in interface Task
output
- The error output to log. Should not be null
.
- Ant 1.6.2
handleFlush
public void handleFlush(String output)
Pass output sent to System.out to the new project.
- handleFlush in interface Task
output
- The output to log. Should not be null
.
- Ant 1.6.2
handleInput
public int handleInput(byte[] buffer,
int offset,
int length)
throws IOException
Process input into the ant task
- handleInput in interface Task
buffer
- the buffer into which data is to be read.offset
- the offset into the buffer at which data is stored.length
- the amount of data to read
- the number of bytes read
- Ant 1.6.2
Task.handleInput(byte[],int,int)
handleOutput
public void handleOutput(String output)
Pass output sent to System.out to the new project.
- handleOutput in interface Task
output
- a line of output
- Ant 1.6.2
setAntfile
public void setAntfile(String antfile)
This method builds the file name to use in conjunction with directories.
Defaults to "build.xml".
If
genericantfile
is set, this attribute is ignored.
antfile
- the short build file name. Defaults to "build.xml".
setBuildpath
public void setBuildpath(Path s)
Set the buildpath to be used to find sub-projects.
s
- an Ant Path object containing the buildpath.
setBuildpathRef
public void setBuildpathRef(Reference r)
Buildpath to use, by reference.
r
- a reference to an Ant Path object containing the buildpath.
setFailonerror
public void setFailonerror(boolean failOnError)
Sets whether to fail with a build exception on error, or go on.
failOnError
- the new value for this boolean flag.
setGenericAntfile
public void setGenericAntfile(File afile)
This method builds a file path to use in conjunction with directories.
Use
genericantfile
, in order to run the same build file
with different basedirs.
If this attribute is set,
antfile
is ignored.
afile
- (path of the generic ant file, absolute or relative to
project base directory)
setInheritall
public void setInheritall(boolean b)
Corresponds to <ant>
's
inheritall
attribute.
b
- the new value for this boolean flag.
setInheritrefs
public void setInheritrefs(boolean b)
Corresponds to <ant>
's
inheritrefs
attribute.
b
- the new value for this boolean flag.
setOutput
public void setOutput(String s)
Corresponds to <ant>
's
output
attribute.
s
- the filename to write the output to.
setTarget
public void setTarget(String target)
The target to call on the different sub-builds. Set to "" to execute
the default target.
target
- the target
setVerbose
public void setVerbose(boolean on)
Enable/ disable verbose log messages showing when each sub-build path is entered/ exited.
The default value is "false".
on
- true to enable verbose mode, false otherwise (default).