How to group targets in Phing?

Viewed 4129

Is there a way to group targets in Phing? I have a number of targets that can be reused by running them in different orders and combinations. For example to create a new dev build:

$ phing clean
$ phing prepare
$ phing build
$ phing runtests

Or to update a dev build from a repo:

$ phing update
$ phing runtests

Is there a way to group these targets to run them as single command? I'm aware that you can chain targets eg:

$ phing clean prepare build runtests
$ phing update runtests

But ideally I'd like to run a command such as:

$ phing cleanbuild

This would run all four targets. This way the build file can separated out into reusable targets. Creating a new target that does this will result in duplication of code from the existing targets. I know that you can use the depends parameter to execute other targets but I want each target to be independent of each other.

The Phing documentation doesn't seem to be very clear on how to do this but I'm sure it's possible to call targets within other targets as it must be a pretty common way of doing things. Many thanks.

2 Answers
Related