net.sf.antcontrib.logic
Class AntCallBack
Task
net.sf.antcontrib.logic.AntCallBack
public class AntCallBack
extends Task
Identical (copy and paste, even) to the 'Ant' task, with the exception that
properties from the new project can be copied back into the original project.
Further modified to emulate "antcall". Build a sub-project.
<target name="foo" depends="init">
<ant antfile="build.xml" target="bar" >
<property name="property1" value="aaaaa" />
<property name="foo" value="baz" />
</ant> </target> <target name="bar"
depends="init"> <echo message="prop is ${property1}
${foo}" /> </target>
Developed for use with Antelope, migrated to ant-contrib Oct 2003.
Credit to Costin for the original <ant> task, on which this is based.
- costin@dnt.ro
- Dale Anson, danson@germane-software.com
static class | AntCallBack.Reference - Helper class that implements the nested <reference> element of
<ant> and <antcall>.
|
void | addReference(AntCallBack.Reference r) - Reference element identifying a data type to carry over to the new
project.
|
Property | createParam() - Property to pass to the invoked target.
|
Property | createProperty() - Property to pass to the new project.
|
void | execute() - Do the execution.
|
protected void | handleErrorOutput(String line) - Pass output sent to System.err to the new project.
|
protected void | handleOutput(String line) - Pass output sent to System.out to the new project.
|
void | init() - Creates a Project instance for the project to call.
|
void | setAntfile(String s) - The build file to use.
|
void | setDir(File d) - The directory to use as a base directory for the new Ant project.
|
void | setInheritAll(boolean value) - If true, pass all properties to the new Ant project.
|
void | setInheritRefs(boolean value) - If true, pass all references to the new Ant project.
|
void | setOutput(String s) - Filename to write the output to.
|
void | setReturn(String r) - Set the property or properties that are set in the new project to be
transfered back to the original project.
|
void | setTarget(String s) - The target of the new Ant project to execute.
|
addReference
public void addReference(AntCallBack.Reference r)
Reference element identifying a data type to carry over to the new
project.
r
- The feature to be added to the Reference attribute
createParam
public Property createParam()
Property to pass to the invoked target.
createProperty
public Property createProperty()
Property to pass to the new project. The property is passed as a 'user
property'
- Description of the Return Value
execute
public void execute()
throws BuildException
Do the execution.
handleErrorOutput
protected void handleErrorOutput(String line)
Pass output sent to System.err to the new project.
line
- Description of the Parameter
handleOutput
protected void handleOutput(String line)
Pass output sent to System.out to the new project.
line
- Description of the Parameter
init
public void init()
Creates a Project instance for the project to call.
setAntfile
public void setAntfile(String s)
The build file to use. Defaults to "build.xml". This file is expected to
be a filename relative to the dir attribute given.
s
- The new antfile value
setDir
public void setDir(File d)
The directory to use as a base directory for the new Ant project. Defaults
to the current project's basedir, unless inheritall has been set to false,
in which case it doesn't have a default value. This will override the
basedir setting of the called project.
setInheritAll
public void setInheritAll(boolean value)
If true, pass all properties to the new Ant project. Defaults to true.
value
- The new inheritAll value
setInheritRefs
public void setInheritRefs(boolean value)
If true, pass all references to the new Ant project. Defaults to false.
value
- The new inheritRefs value
setOutput
public void setOutput(String s)
Filename to write the output to. This is relative to the value of the dir
attribute if it has been set or to the base directory of the current
project otherwise.
setReturn
public void setReturn(String r)
Set the property or properties that are set in the new project to be
transfered back to the original project. As with all properties, if the
property already exists in the original project, it will not be overridden
by a different value from the new project.
r
- the name of a property in the new project to set in the original
project. This may be a comma separate list of properties.
setTarget
public void setTarget(String s)
The target of the new Ant project to execute. Defaults to the new
project's default target.