B.39 PhingCallTask

The PhingCallTask calls a target within the same Phing project.

A <phingcall> tag may contain <property> tags that define new properties in the called project. Nested properties are passed as user properties. They can replace ordinary properties inherited from the calling project. Properties set on the command line retain their original values, even when override="true" is specified on the nested property.

Inside the called target, ordinary <property> assignments cannot change user properties, even with override="true". See Section B.47, “PropertyTask” for the userProperty attribute and how it affects overriding.

When a target is invoked by phingcall, all of its dependent targets will also be called within the context of any new parameters. For example. if the target "doSomethingElse" depended on the target "init", then using phingcall to execute "doSomethingElse" will also execute "init". Note: the top level tasks of a project will always be executed!

Table B.40: Attributes

NameType/ValuesDescriptionDefaultRequired
target String The name of the target in the same project that is to be called.n/aYes
inheritAll Boolean If true, pass all properties to the called project. User properties, including those set on the command line, are passed even if this attribute is false. true No
inheritRefs Boolean false No

Note

Local scope.

Every <phingcall> tag creates a new local scope. Thus, any properties or other variables set inside that scope will cease to exist (or revert to their previous value) once the <phingcall> tag completes.

B.39.1 Examples

<target name="foo">
    <phingcall target="bar">
        <property name="property1" value="aaaaa" />
        <property name="foo" value="baz" />
    </phingcall>
</target>
        

In the example above, the properties property1 and foo are defined and only accessible inside the called target.

<target name="bar" depends="init">
    <echo message="prop is ${property1} ${foo}" />
</target>
        

B.39.2 Supported Nested Tags

  • property

  • param (alias for property)