tasks/system/IfTask.php
Perform some tasks based on whether a given condition holds true or not.
This task is heavily based on the Condition framework that can be found in Ant 1.4 and later, therefore it cannot be used in conjunction with versions of Ant prior to 1.4.
This task doesn't have any attributes, the condition to test is specified by a nested element - see the documentation of your
task (see
the
online documentation for example) for a complete list of nested
elements.
Just like the
task, only a single
condition can be specified - you combine them using
or
conditions.
In addition to the condition, you can specify three different child elements,
,
and
. All three subelements are optional.
Both
and
must not be
used more than once inside the if task. Both are
containers for Ant tasks, just like Ant's
and
tasks - in fact they are implemented using the same class as Ant's
task.
The
behaves exactly like an
except that it cannot contain the
element inside of it. You may specify as may of these as you like, and the order they are specified is the order they are evaluated in. If the condition on the
is false, then the first
who's conditional evaluates to true will be executed. The
will be executed only if the
and all
conditions are false.
Use the following task to define the
task before you use it the first time:
<taskdef name="if" classname="net.sf.antcontrib.logic.IfTask" />
Crude Example
- Author
- Stefan Bodewig
- Package
- phing.tasks.system
\ElseIfTask
"Inner" class for IfTask.
This class has same basic structure as the IfTask, although of course it doesn't support
- Parent(s)
- \ConditionBase < \ProjectComponent
- Author
- Andreas Aderhold
- Copyright
- 2001,2002 THYRELL. All rights reserved
- Version
- $Id$
Properties


$conditions= 'array()'
array()
Details- Type
- n/a
- Inherited_from
- \ConditionBase::$$conditions


\Project
$project= 'null'
Holds a reference to the project that a project component (a task, a target, etc.) belongs to
A reference to the current project instanceInherited from: \ProjectComponent::$$project\ConditionBase::$$projectnull
Details- Type
- \Project
- Inherited_from
- \ProjectComponent::$$project
- Inherited_from
- \ConditionBase::$$project
Methods


addAvailable(
$a
)
:
void
Name | Type | Description |
---|---|---|
$a |


createAnd(
)
:
\AndCondition
Type | Description |
---|---|
\AndCondition |


createContains(
)
:
\ContainsCondition
Type | Description |
---|---|
\ContainsCondition |


createEquals(
)
:
\EqualsCondition
Type | Description |
---|---|
\EqualsCondition |


createIsFalse(
)
:
\IsFalseCondition
Type | Description |
---|---|
\IsFalseCondition |


createIsSet(
)
:
\IsSetCondition
Type | Description |
---|---|
\IsSetCondition |


createIsTrue(
)
:
\IsTrueCondition
Type | Description |
---|---|
\IsTrueCondition |


createNot(
)
:
\NotCondition
Type | Description |
---|---|
\NotCondition |


createOr(
)
:
\OrCondition
Type | Description |
---|---|
\OrCondition |


createOs(
)
:
\OsCondition
Type | Description |
---|---|
\OsCondition |


createReferenceExists(
)
:
\ReferenceExistsCondition
Type | Description |
---|---|
\ReferenceExistsCondition |


getProject(
)
:
\Project
Returns a reference to current project
Inherited from: \ProjectComponent::getProject()\ConditionBase::getProject()Type | Description |
---|---|
\Project | Reference to current porject object |


log(
string $msg, integer $level
=
Project::MSG_INFO
)
:
void
Logs a message with the given priority.
Inherited from: \ProjectComponent::log()\ConditionBase::log()Name | Type | Description |
---|---|---|
$msg | string | The message to be logged. |
$level | integer | The message's priority at this message should have |


setProject(
\Project $project
)
:
void
References the project to the current component.
Inherited from: \ProjectComponent::setProject()\ConditionBase::setProject()Name | Type | Description |
---|---|---|
$project | \Project | The reference to the current project |
\IfTask
Perform some tasks based on whether a given condition holds true or not.
This task is heavily based on the Condition framework that can be found in Ant 1.4 and later, therefore it cannot be used in conjunction with versions of Ant prior to 1.4.
This task doesn't have any attributes, the condition to test is specified by a nested element - see the documentation of your
task (see
the
online documentation for example) for a complete list of nested
elements.
Just like the
task, only a single
condition can be specified - you combine them using
or
conditions.
In addition to the condition, you can specify three different child elements,
,
and
. All three subelements are optional.
Both
and
must not be
used more than once inside the if task. Both are
containers for Ant tasks, just like Ant's
and
tasks - in fact they are implemented using the same class as Ant's
task.
The
behaves exactly like an
except that it cannot contain the
element inside of it. You may specify as may of these as you like, and the order they are specified is the order they are evaluated in. If the condition on the
is false, then the first
who's conditional evaluates to true will be executed. The
will be executed only if the
and all
conditions are false.
Use the following task to define the
task before you use it the first time:
<taskdef name="if" classname="net.sf.antcontrib.logic.IfTask" />
Crude Example
- Parent(s)
- \ConditionBase < \ProjectComponent
- Author
- Stefan Bodewig
- Copyright
- 2001,2002 THYRELL. All rights reserved
- Version
- $Id$
Properties


$conditions= 'array()'
array()
Details- Type
- n/a
- Inherited_from
- \ConditionBase::$$conditions


\Project
$project= 'null'
Holds a reference to the project that a project component (a task, a target, etc.) belongs to
A reference to the current project instanceInherited from: \ProjectComponent::$$project\ConditionBase::$$projectnull
Details- Type
- \Project
- Inherited_from
- \ProjectComponent::$$project
- Inherited_from
- \ConditionBase::$$project
Methods


addAvailable(
$a
)
:
void
Name | Type | Description |
---|---|---|
$a |


addElse(
$e
)
:
void
A nested
Not required.
Name | Type | Description |
---|---|---|
$e |


addThen(
$t
)
:
void
A nested
Not required.
Name | Type | Description |
---|---|---|
$t |


createAnd(
)
:
\AndCondition
Type | Description |
---|---|
\AndCondition |


createContains(
)
:
\ContainsCondition
Type | Description |
---|---|
\ContainsCondition |


createEquals(
)
:
\EqualsCondition
Type | Description |
---|---|
\EqualsCondition |


createIsFalse(
)
:
\IsFalseCondition
Type | Description |
---|---|
\IsFalseCondition |


createIsSet(
)
:
\IsSetCondition
Type | Description |
---|---|
\IsSetCondition |


createIsTrue(
)
:
\IsTrueCondition
Type | Description |
---|---|
\IsTrueCondition |


createNot(
)
:
\NotCondition
Type | Description |
---|---|
\NotCondition |


createOr(
)
:
\OrCondition
Type | Description |
---|---|
\OrCondition |


createOs(
)
:
\OsCondition
Type | Description |
---|---|
\OsCondition |


createReferenceExists(
)
:
\ReferenceExistsCondition
Type | Description |
---|---|
\ReferenceExistsCondition |


getProject(
)
:
\Project
Returns a reference to current project
Inherited from: \ProjectComponent::getProject()\ConditionBase::getProject()Type | Description |
---|---|
\Project | Reference to current porject object |


log(
string $msg, integer $level
=
Project::MSG_INFO
)
:
void
Logs a message with the given priority.
Inherited from: \ProjectComponent::log()\ConditionBase::log()Name | Type | Description |
---|---|---|
$msg | string | The message to be logged. |
$level | integer | The message's priority at this message should have |


setProject(
\Project $project
)
:
void
References the project to the current component.
Inherited from: \ProjectComponent::setProject()\ConditionBase::setProject()Name | Type | Description |
---|---|---|
$project | \Project | The reference to the current project |