# PhingTask

Extends \Task

Task that invokes phing on another build file.

Use this task, for example, if you have nested buildfiles in your project. Unlike AntTask, PhingTask can even support filesets:

      <phing>

      </phing>

author | Hans Lellelid hans@xmpl.org
version | $Id: 43be7ce86f93e18cd2030bb4c764b3e385feebe6 $
package | phing.tasks.system

### Methods

## Nested adder, adds a set of files (nested fileset attribute).

    addFileSet(\FileSet $fs) : void

### Arguments

#### $fs

`\FileSet`

## Add the references explicitly defined as nested elements to the new project. Also copy over all references that don't override existing references in the new project if inheritrefs has been requested.

    addReferences() : void

throws |

## Try to clone and reconfigure the object referenced by oldkey in the parent project and add it to the new project with the key newkey.

    copyReference(string $oldKey, string $newKey) : void

If we cannot clone it, copy the referenced object itself and keep our fingers crossed.

throws |

### Arguments

#### $oldKey

`string`

#### $newKey

`string`

## Property to pass to the new project.

    createProperty()

The property is passed as a 'user property'

## Reference element identifying a data type to carry over to the new project.

    createReference()

## Returns the textual description of the task

    getDescription() : string

inherited

### Response

`string`

The text description of the task

## Returns the location within the buildfile this task occurs. Used by {@link BuildException} to give detailed error messages.

    getLocation() : \Location

inherited

### Response

`\Location`

The location object describing the position of this task within the buildfile.

## Returns the owning target of this task.

    getOwningTarget() : \Target

inherited

### Response

`\Target`

The target object that owns this task

## Returns a reference to current project

    getProject() : \Project

inherited

### Response

`\Project`

Reference to current porject object

## Returns a name

    getRegisterSlot(string $slotName) : \RegisterSlot

inherited

### Arguments

#### $slotName

`string`

### Response

`\RegisterSlot`

## Returns the wrapper object for runtime configuration

    getRuntimeConfigurableWrapper() : \RuntimeConfigurable

inherited

### Response

`\RuntimeConfigurable`

The wrapper object used by this task

## Returns the name of task, used only for log messages

    getTaskName() : string

inherited

### Response

`string`

Name of this task

## Returns the name of the task under which it was invoked, usually the XML tagname

    getTaskType() : string

inherited

### Response

`string`

The type of this task (XML Tag)

## Called by the parser to let the task initialize properly.

    init()

inherited

Should throw a BuildException if something goes wrong with the build

This is abstract here, but may not be overloaded by subclasses.

throws |

## Configure the Project, i.e. make intance, attach build listeners (copy from father project), add Task and Datatype definitions, copy properties and references from old project if these options are set via the attributes of the XML tag.

    initializeProject()

Developer note: This function replaces the old methods "init", "_reinit" and "_initializeProject".

## Logs a message with the given priority.

    log(string $msg, integer $level = \Project::MSG_INFO) : void

inherited

### Arguments

#### $msg

`string`

The message to be logged.

#### $level

`integer`

The message's priority at this message should have

## Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice.

    main()

inherited abstract

Should throw a BuildException if someting goes wrong with the build

This is abstract here. Must be overloaded by real tasks.

## Configure this task if it hasn't been done already.

    maybeConfigure()

inherited

## Override the properties in the new project with the one explicitly defined as nested elements here.

    overrideProperties() : void

throws |

## Perfrom this task

    perform()

inherited

throws |

## Execute phing file.

    processFile() : void

throws |

## Called in execute or createProperty if newProject is null.

    reinit()

This can happen if the same instance of this task is run twice as newProject is set to null at the end of execute (to save memory and help the GC).

Sets all properties that have been defined as nested property elements.

## Alias function for setPhingfile

    setBuildfile( $s)

### Arguments

#### $s

``

## Sets a textual description of the task

    setDescription(string $desc)

inherited

### Arguments

#### $desc

`string`

The text describing the task

## The directory to use as a base directory for the new phing project.

    setDir( $d)

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.

### Arguments

#### $d

``

## If true, abort the build process if there is a problem with or in the target build file.

    setHaltOnFailure( $hof)

Defaults to false.

### Arguments

#### $hof

``

## If true, pass all properties to the new phing project.

    setInheritAll( $value)

Defaults to true.

### Arguments

#### $value

``

## If true, pass all references to the new phing project.

    setInheritRefs( $value)

Defaults to false.

### Arguments

#### $value

``

## Sets the location within the buildfile this task occurs. Called by the parser to set location information.

    setLocation(\Location $location)

inherited

### Arguments

#### $location

`\Location`

The location object describing the position of this task within the buildfile.

## Sets the owning target this task belongs to.

    setOwningTarget(\Target $target)

inherited

### Arguments

#### $target

`\Target`

## The build file to use.

    setPhingfile( $s)

Defaults to "build.xml". This file is expected to be a filename relative to the dir attribute given.

### Arguments

#### $s

``

## References the project to the current component.

    setProject(\Project $project) : void

inherited

### Arguments

#### $project

`\Project`

The reference to the current project

## Sets the wrapper object this task should use for runtime configurable elements.

    setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper)

inherited

### Arguments

#### $wrapper

`\RuntimeConfigurable`

The wrapper object this task should use

## The target of the new Phing project to execute.

    setTarget( $s)

Defaults to the new project's default target.

### Arguments

#### $s

``

## Sets the name of this task for log messages

    setTaskName(string $name) : string

inherited

### Arguments

#### $name

`string`

### Response

`string`

A string representing the name of this task for log

## Sets the type of the task. Usually this is the name of the XML tag

    setTaskType( $name)

inherited

### Arguments

#### $name

``

### Properties

## the basedir where is executed the build file

    dir :

### Type(s)

``

## build.xml (can be absolute) in this case dir will be ignored

    phingFile :

### Type(s)

``

## the target to call if any

    newTarget :

### Type(s)

``

## should we inherit properties from the parent ?

    inheritAll :

### Type(s)

``

## should we inherit references from the parent ?

    inheritRefs :

### Type(s)

``

## the properties to pass to the new project

    properties :

### Type(s)

``

## the references to pass to the new project

    references :

### Type(s)

``

## The filesets that contain the files PhingTask is to be run on.

    filesets :

### Type(s)

``

## the temporary project created to run the build file

    newProject :

### Type(s)

``

## Fail the build process when the called build fails?

    haltOnFailure :

### Type(s)

``

## Owning Target object

    target : \Target

inherited

var |

### Type(s)

`\Target`

## Description of the task

    description : string

inherited

var |

### Type(s)

`string`

## Internal taskname (req)

    taskType : string

inherited

var |

### Type(s)

`string`

## Taskname for logger

    taskName : string

inherited

var |

### Type(s)

`string`

## Stored buildfile location

    location : \Location

inherited

var |

### Type(s)

`\Location`

## Wrapper of the task

    wrapper : \RuntimeConfigurable

inherited

var |

### Type(s)

`\RuntimeConfigurable`

## Holds a reference to the project that a project component (a task, a target, etc.) belongs to

    project : \Project

inherited

var | A reference to the current project instance

### Type(s)

`\Project`