Project

The Phing project class. Represents a completely configured Phing project.

The class defines the project and all tasks/targets. It also contains methods to start a build as well as some properties and FileSystem abstraction.

author

Andreas Aderhold [email protected]

author

Hans Lellelid [email protected]

package

phing

Methods

Constructor, sets any default vars.

__construct() 

_makeCircularException

_makeCircularException(string $end, array $stk) : \BuildException

Arguments

$end

string

$stk

array

Response

\BuildException

_tsort

_tsort( $root,  &$state,  &$visiting,  &$ret) 
Throws
\BuildException
\Exception

Arguments

$root

$state

$visiting

$ret

addBuildListener

addBuildListener(\BuildListener $listener) 

Arguments

$listener

\BuildListener

Adds a data type definition.

addDataTypeDefinition(string $typeName, string $typeClass, string $classpath = null) 

Arguments

$typeName

string

Name of the type.

$typeClass

string

The class to use.

$classpath

string

The classpath to use.

Adds or replaces a target in the project

addOrReplaceTarget(string $targetName, \Target &$target) 

Arguments

$targetName

string

$target

\Target

Adds a reference to an object. This method is called when the parser detects a id="foo" attribute. It passes the id as $name and a reference to the object assigned to this id as $value

addReference(string $name, object $object) 

Arguments

$name

string

$object

object

Add a new target to the project

addTarget(string $targetName, \Target $target) 
Throws
\BuildException

Arguments

$targetName

string

$target

\Target

Adds a task definition.

addTaskDefinition(string $name, string $class, string $classpath = null) 

Arguments

$name

string

Name of tag.

$class

string

The class path to use.

$classpath

string

The classpat to use.

Copies all user properties that have not been set on the command line or a GUI tool from this instance to the Project instance given as the argument.

copyInheritedProperties(\Project $other) 

To copy all "user" properties, you will also have to call \#copyUserProperties.

since

phing 2.0

Arguments

$other

\Project

the project to copy the properties to. Must not be null.

Copies all user properties that have been set on the command line or a GUI tool from this instance to the Project instance given as the argument.

copyUserProperties(\Project $other) : void

To copy all "user" properties, you will also have to call \#copyInheritedProperties.

since

phing 2.0

Arguments

$other

\Project

the project to copy the properties to. Must not be null.

Creates a new condition and returns the reference to it

createCondition(string $conditionType) : \Condition
Throws
\BuildException

Arguments

$conditionType

string

Response

\Condition

Create a datatype instance and return reference to it See createTask() for explanation how this works

createDataType(string $typeName) : object
Throws
\BuildException

Exception

Arguments

$typeName

string

Type name

Response

object

A datatype object

Create a new task instance and return reference to it.

createTask(string $taskType) : \Task
Throws
\BuildException

Arguments

$taskType

string

Task name

Response

\Task

A task object

Executes a target

executeTarget(string $targetName) : void
Throws
\BuildException

Arguments

$targetName

string

Name of Target to execute

Executes a list of targets

executeTargets(array $targetNames) : void
Throws
\BuildException

Arguments

$targetNames

array

List of target names to execute

fireBuildFinished

fireBuildFinished(\Exception $exception) 

Arguments

$exception

\Exception

fireBuildStarted

fireBuildStarted() 

fireMessageLogged

fireMessageLogged(mixed $object, string $message, integer $priority, \Exception $t = null) 
Throws
\Exception

Arguments

$object

mixed

$message

string

$priority

integer

$t

\Exception

fireMessageLoggedEvent

fireMessageLoggedEvent( $event,  $message,  $priority) 

Arguments

$event

$message

$priority

fireTargetFinished

fireTargetFinished( $target,  $exception) 

Arguments

$target

$exception

fireTargetStarted

fireTargetStarted( $target) 

Arguments

$target

fireTaskFinished

fireTaskFinished( $task,  $exception) 

Arguments

$task

$exception

fireTaskStarted

fireTaskStarted( $task) 

Arguments

$task

Returns the basedir of this project

getBasedir() : \PhingFile
author

Andreas Aderhold, [email protected]

Throws
\BuildException

Response

\PhingFile

Basedir PhingFile object

getBuildListeners

getBuildListeners() : array

Response

array

Returns the data type definitions

getDataTypeDefinitions() : array

Response

array

Returns default target

getDefaultTarget() : string

Response

string

return the description, null otherwise

getDescription() : string|null

Response

string|null

getExecutedTargetNames

getExecutedTargetNames() : array<mixed,string>

Response

array<mixed,string>

returns the global filterset (future use)

getGlobalFilterSet() 

Retrieves the current input handler.

getInputHandler() : \InputHandler

Response

\InputHandler

Returns the name of this project

getName() : string
author

Andreas Aderhold, [email protected]

Response

string

projectname

Get the minimum required phing version

getPhingVersion() : string

Response

string

Returns a copy of the properties table.

getProperties() : array

Response

array

A hashtable containing all properties (including user properties).

Returns the value of a property, if it is set.

getProperty(string $name) : string

Arguments

$name

string

The name of the property. May be null, in which case the return value is also null.

Response

string

The property value, or null for no match or if a null name is provided.

Returns a specific reference.

getReference(string $key) : object

Arguments

$key

string

The reference id/key.

Response

object

Reference or null if not defined

Returns the references array.

getReferences() : array

Response

array

Get the strict-mode status for the project

getStrictmode() : boolean

Response

boolean

Returns the available targets

getTargets() : array<mixed,\Target>

Response

array<mixed,\Target>

Returns the task definitions

getTaskDefinitions() : array

Response

array

Returns a copy of the user property hashtable

getUserProperties() : array

Response

array

a hashtable containing just the user properties

Returns the value of a user property, if it is set.

getUserProperty(string $name) : string

Arguments

$name

string

The name of the property. May be null, in which case the return value is also null.

Response

string

The property value, or null for no match or if a null name is provided.

inits the project, called from main app

init() 

Return the keep-going mode. If the keepGoing settor/getter methods are used in conjunction with the <code>phing.executor.class</code> property, they will have no effect.

isKeepGoingMode() : boolean

Response

boolean

"keep-going" mode

Abstracting and simplifyling Logger calls for project messages

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

Arguments

$msg

string

$level

integer

logObject

logObject(mixed $obj, string $msg, integer $level, \Exception|null $t = null) 

Arguments

$obj

mixed

$msg

string

$level

integer

$t

\Exception|null

removeBuildListener

removeBuildListener(\BuildListener $listener) 

Arguments

$listener

\BuildListener

Replaces ${} style constructions in the given value with the string value of the corresponding data types.

replaceProperties(string $value) : string
exception

BuildException if the given value has an unclosed property name, e.g. ${xxx

Arguments

$value

string

The value string to be scanned for property references. May be null.

Response

string

the given string with embedded property names replaced by values, or null if the given string is null.

Helper function

resolveFile( $fileName, null $rootDir = null) : \PhingFile
Throws
\IOException

Arguments

$fileName

$rootDir

null

Response

\PhingFile

Set basedir object from xm

setBasedir(\PhingFile|string $dir) 
Throws
\BuildException

Arguments

$dir

\PhingFile|string

Sets default target

setDefaultTarget(string $targetName) 

Arguments

$targetName

string

Set the projects description

setDescription(string $description) 

Arguments

$description

string

Sets a user property, which cannot be overwritten by set/unset property calls. Any previous value is overwritten. Also marks these properties as properties that have not come from the command line.

setInheritedProperty(string $name, string $value) 
see \Project::setProperty()

Arguments

$name

string

The name of property to set. Must not be null.

$value

string

The new value of the property. Must not be null.

Sets the input handler

setInputHandler(\InputHandler $handler) 

Arguments

$handler

\InputHandler

Set &quot;keep-going&quot; mode. In this mode Ant will try to execute as many targets as possible. All targets that do not depend on failed target(s) will be executed. If the keepGoing settor/getter methods are used in conjunction with the <code>ant.executor.class</code> property, they will have no effect.

setKeepGoingMode(boolean $keepGoingMode) 

Arguments

$keepGoingMode

boolean

"keep-going" mode

Sets the name of the current project

setName(string $name) : void
author

Andreas Aderhold, [email protected]

Arguments

$name

string

name of project

Sets a property if no value currently exists. If the property exists already, a message is logged and the method returns with no other effect.

setNewProperty(string $name, string $value) 
since 2.0

Arguments

$name

string

The name of property to set. Must not be null.

$value

string

The new value of the property. Must not be null.

Set the minimum required phing version

setPhingVersion(string $version) 

Arguments

$version

string

Sets a property. Any existing property of the same name is overwritten, unless it is a user property.

setProperty(string $name, string $value) 

Arguments

$name

string

The name of property to set. Must not be null.

$value

string

The new value of the property. Must not be null.

Sets a property unless it is already defined as a user property (in which case the method returns silently).

setPropertyInternal(string $name, string $value) 

Arguments

$name

string

The name of the property. Must not be null.

$value

string

The property value. Must not be null.

Sets the strict-mode (status) for the current project (If strict mode is On, all the warnings would be converted to an error (and the build will be stopped/aborted)

setStrictMode( $strictmode) : void
access

public

author

Utsav Handa, [email protected]

Arguments

$strictmode

Sets system properties and the environment variables for this project.

setSystemProperties() : void

Sets a user property, which cannot be overwritten by set/unset property calls. Any previous value is overwritten.

setUserProperty(string $name, string $value) 
see \Project::setProperty()

Arguments

$name

string

The name of property to set. Must not be null.

$value

string

The new value of the property. Must not be null.

Return the boolean equivalent of a string, which is considered <code>true</code> if either <code>"on"</code>, <code>"true"</code>, or <code>"yes"</code> is found, ignoring case.

toBoolean(string $s) : \<code>true</code>
static

Arguments

$s

string

The string to convert to a boolean value.

Response

\true

if the given string is "on", "true" or "yes", or false otherwise.

Topologically sort a set of Targets.

topoSort(string $rootTarget) : array<mixed,\Target>
Throws
\BuildException
\Exception

Arguments

$rootTarget

string

is the (String) name of the root Target. The sort is created in such a way that the sequence of Targets until the root target is the minimum possible such sequence.

Response

array<mixed,\Target>

targets in sorted order

Constants

MSG_DEBUG

MSG_DEBUG

MSG_VERBOSE

MSG_VERBOSE

MSG_INFO

MSG_INFO

MSG_WARN

MSG_WARN

MSG_ERR

MSG_ERR

Properties

contains the targets

targets : array<mixed,\Target>
var

Type(s)

array<mixed,\Target>

global filterset (future use)

globalFilterSet : 

Type(s)

all globals filters (future use)

globalFilters : 

Type(s)

holds ref names and a reference to the referred object

references : 

Type(s)

The InputHandler being used by this project.

inputHandler : \InputHandler
var

Type(s)

\InputHandler

basedir (PhingFile object)

basedir : 

Type(s)

the default target name

defaultTarget : 

Type(s)

project name (required)

name : 

Type(s)

project description

description : 

Type(s)

require phing version

phingVersion : 

Type(s)

project strict mode

strictMode : 

Type(s)

a FileUtils object

fileUtils : 

Type(s)

Build listeneers

listeners : 

Type(s)

Keep going flag.

keepGoingMode : 

Type(s)

executedTargetNames

executedTargetNames : array<mixed,string>
var

Type(s)

array<mixed,string>