Task for setting properties in buildfiles.

Use Project#createTask to register a new Task.

author Andreas Aderhold
author Hans Lellelid
version $Id: e6d7123b6331d5032ad1e67967cf54ef2aae3f7f $
package phing.tasks.system
copyright 2001,2002 THYRELL. All rights reserved

 Methods

Sets value of property to CDATA tag contents.

addText($value) 
since 2.2.0

Parameters

$value

Creates a filterchain

createFilterChain() : object
access public

Returns

objectThe created filterchain object

Returns the textual description of the task

getDescription() : string
Inherited
inherited_from \Task::getDescription()

Returns

stringThe text description of the task

getEnvironment()

getEnvironment() 

getFallback()

getFallback() 

Get the PhingFile that is being used as property source.

getFile() 

Returns the location within the buildfile this task occurs.

getLocation() : \Location
Inherited

Used by BuildException to give detailed error messages.

inherited_from \Task::getLocation()

Returns

\LocationThe location object describing the position of this task within the buildfile.

Get property component name.

getName() 

getOverride()

getOverride() 

Returns the owning target of this task.

getOwningTarget() : \Target
Inherited
inherited_from \Task::getOwningTarget()

Returns

\TargetThe target object that owns this task

getPrefix()

getPrefix() : string
since 2.0

Returns

string

Returns a reference to current project

getProject() : \Project
Inherited
inherited_from \ProjectComponent::getProject()
inherited_from \Task::getProject()

Returns

\ProjectReference to current porject object

getRefid()

getRefid() 

Returns the wrapper object for runtime configuration

getRuntimeConfigurableWrapper() : \RuntimeConfigurable
Inherited
inherited_from \Task::getRuntimeConfigurableWrapper()

Returns

\RuntimeConfigurableThe wrapper object used by this task

Returns the name of task, used only for log messages

getTaskName() : string
Inherited
inherited_from \Task::getTaskName()

Returns

stringName of this task

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

getTaskType() : string
Inherited
inherited_from \Task::getTaskType()

Returns

stringThe type of this task (XML Tag)

getUserProperty()

getUserProperty() 

Get the value of current property component.

getValue() 

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.

inherited_from \Task::init()

Exceptions

\BuildException

Provides a project level log event to the task.

log(string $msg, integer $level) 
Inherited
see \global\BuildEvent
see \global\BuildListener
inherited_from \Task::log()

Parameters

$msg

string

The message to log

$level

integer

The priority of the message

set the property in the project to the value.

main() 

if the task was give a file or env attribute here is where it is loaded

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

maybeConfigure() 
Inherited
inherited_from \Task::maybeConfigure()

Perfrom this task

perform() 
Inherited
inherited_from \Task::perform()

Sets a textual description of the task

setDescription(string $desc) 
Inherited
inherited_from \Task::setDescription()

Parameters

$desc

string

The text describing the task

the prefix to use when retrieving environment variables.

setEnvironment(\env $env) 

Thus if you specify environment="myenv" you will be able to access OS-specific environment variables via property names "myenv.PATH" or "myenv.TERM".

<

p> Note that if you supply a property name with a final "." it will not be doubled. ie environment="myenv." will still allow access of environment variables through "myenv.PATH" and "myenv.TERM". This functionality is currently only implemented on select platforms. Feel free to send patches to increase the number of platforms this functionality is supported on ;).
Note also that properties are case sensitive, even if the environment variables on your operating system are not, e.g. it will be ${env.Path} not ${env.PATH} on Windows 2000.

Parameters

$env

\env

prefix

setFallback()

setFallback(\Project $p) 

Parameters

Set a file to use as the source for properties.

setFile($file) 

Parameters

$file

Sets the location within the buildfile this task occurs.

setLocation(\Location $location) 
Inherited

Called by the parser to set location information.

inherited_from \Task::setLocation()

Parameters

$location

\Location

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

Sets a the name of current property component

setName($name) 

Parameters

$name

setOverride()

setOverride($v) 

Parameters

$v

Sets the owning target this task belongs to.

setOwningTarget(\Target $target) 
Inherited
inherited_from \Task::setOwningTarget()

Parameters

$target

\Target

Reference to owning target

Prefix to apply to properties loaded using <code>file</code>.

setPrefix(string $prefix) : void

A "." is appended to the prefix if not specified.

since 2.0

Parameters

$prefix

string

prefix string

References the project to the current component.

setProject(\Project $project) 
Inherited
inherited_from \ProjectComponent::setProject()
inherited_from \Task::setProject()

Parameters

$project

\Project

The reference to the current project

setRefid()

setRefid(\Reference $ref) 

Parameters

$ref

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

setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper) 
Inherited
inherited_from \Task::setRuntimeConfigurableWrapper()

Parameters

$wrapper

\RuntimeConfigurable

The wrapper object this task should use

Sets the name of this task for log messages

setTaskName(string $name) : string
Inherited
inherited_from \Task::setTaskName()

Parameters

$name

string

Returns

stringA string representing the name of this task for log

Sets the type of the task.

setTaskType(string $name) 
Inherited

Usually this is the name of the XML tag

inherited_from \Task::setTaskType()

Parameters

$name

string

The type of this task (XML Tag)

Set whether this is a user property (ro).

setUserProperty(boolean $v) 

This is deprecated in Ant 1.5, but the userProperty attribute of the class is still being set via constructor, so Phing will allow this method to function.

Parameters

$v

boolean

Sets a the value of current property component.

setValue(mixed $value) 

Parameters

$value

mixed

Value of name, all scalars allowed

toString()

toString() 

iterate through a set of properties, resolve them then assign them

addProperties($props) 

Parameters

$props

add a name value pair to the project property set

addProperty(string $name, string $value) 

Parameters

$name

string

name of property

$value

string

value to set

Returns a name

getRegisterSlot(string $slotName) 
Inherited
inherited_from \Task::getRegisterSlot()

Parameters

$slotName

string

load the environment values

loadEnvironment(string $prefix) 

Parameters

$prefix

string

prefix to place before them

load properties from a file.

loadFile(\PhingFile $file) 

Parameters

$file

\PhingFile

This method will parse a string containing ${value} style property values into two lists.

parsePropertyString(string $value, array $fragments, array $propertyRefs) 

The first list is a collection of text fragments, while the other is a set of string property names null entries in the first list indicate a property reference from the second list.

This is slower than regex, but useful for this class, which has to handle multiple parsing passes for properties.

Parameters

$value

string

The string to be scanned for property references

$fragments

array

&$fragments The found fragments

$propertyRefs

array

&$propertyRefs The found refs

Given a Properties object, this method goes through and resolves any references to properties within the object.

resolveAllProperties(\Properties $props) : void

Parameters

$props

\Properties

The collection of Properties that need to be resolved.

 Properties

 

$description : string
Inherited
inherited_from \Task::$$description
 

$env 
 

$fallback 
 

$file 
 

$filterChains 
 

$location : \Location
Inherited
inherited_from \Task::$$location
 

$name 
 

$override 
 

$prefix 
 

$project : \Project
Inherited
inherited_from \ProjectComponent::$$project
inherited_from \Task::$$project
 

$ref 
 

$reference 
 

$target : \Target
Inherited
inherited_from \Task::$$target
 

$taskName : string
Inherited
inherited_from \Task::$$taskName
 

$taskType : string
Inherited
inherited_from \Task::$$taskType
 

$userProperty 
 

$value 
 

$wrapper : \RuntimeConfigurable
Inherited
inherited_from \Task::$$wrapper