| 28 | | <p> In the structure of a Phing buildfile, there must be exactly one <em>Project</em> |
|---|
| 29 | | defined; the <em><project> </em>tag is the root element of the buildfile, |
|---|
| 30 | | meaning that everything else in the buildfile is contained within the <em><project</em> |
|---|
| | 28 | <p> In the structure of a Phing buildfile, there must be exactly one <em>Project</em> |
|---|
| | 29 | defined; the <em><project> </em>tag is the root element of the buildfile, |
|---|
| | 30 | meaning that everything else in the buildfile is contained within the <em><project</em> |
|---|
| 41 | | <p> The listing above shows a sample <em><project></em> tag that has all |
|---|
| 42 | | attributes available for Projects. The <em>name</em> and <em>description</em> |
|---|
| 43 | | attributes are fairly self-explanatory; the <em>default</em> attribute specifies |
|---|
| 44 | | the default <em>Target</em> to execute if no target is specified (<a href="#Target">Targets</a> |
|---|
| 45 | | are described below). For a complete reference, see <a href="appendixes/AppendixD-ProjectComponents.html#Project">Appendix |
|---|
| | 41 | <p> The listing above shows a sample <em><project></em> tag that has all |
|---|
| | 42 | attributes available for Projects. The <em>name</em> and <em>description</em> |
|---|
| | 43 | attributes are fairly self-explanatory; the <em>default</em> attribute specifies |
|---|
| | 44 | the default <em>Target</em> to execute if no target is specified (<a href="#Target">Targets</a> |
|---|
| | 45 | are described below). For a complete reference, see <a href="appendixes/AppendixD-ProjectComponents.html#Project">Appendix |
|---|
| 50 | | <p> Project components are everything you can be find inside a project. So Targets |
|---|
| 51 | | are project components, as are Tasks, Types, etc. Project components may have |
|---|
| 52 | | attributes and nested tags. Attributes only contain simple values, i.e. strings, |
|---|
| 53 | | integers etc. Nested elements may be complex Phing types (like FileSets) or |
|---|
| 54 | | simple wrapper classes for values with custom keys (see <a href="appendixes/AppendixC-CoreTypes.html#Fileset">FileSet</a> |
|---|
| | 50 | <p> Project components are everything you can be find inside a project. So Targets |
|---|
| | 51 | are project components, as are Tasks, Types, etc. Project components may have |
|---|
| | 52 | attributes and nested tags. Attributes only contain simple values, i.e. strings, |
|---|
| | 53 | integers etc. Nested elements may be complex Phing types (like FileSets) or |
|---|
| | 54 | simple wrapper classes for values with custom keys (see <a href="appendixes/AppendixC-CoreTypes.html#Fileset">FileSet</a> |
|---|
| 57 | | <p> Any nested elements must be supported by the class that implements the project |
|---|
| 58 | | component, and because the nested tags are handled by the project component |
|---|
| 59 | | class the same nested tag may have different meanings (and different attributes) |
|---|
| 60 | | depending on the context. So, for example, the nested tag <em><param</em>.../> |
|---|
| 61 | | within the <em><phingcall></em> tag is handled very differently from the<em><param.../></em> |
|---|
| 62 | | tag within the <em><xsltfilter></em> tag -- in the first case setting |
|---|
| | 57 | <p> Any nested elements must be supported by the class that implements the project |
|---|
| | 58 | component, and because the nested tags are handled by the project component |
|---|
| | 59 | class the same nested tag may have different meanings (and different attributes) |
|---|
| | 60 | depending on the context. So, for example, the nested tag <em><param</em>.../> |
|---|
| | 61 | within the <em><phingcall></em> tag is handled very differently from the<em><param.../></em> |
|---|
| | 62 | tag within the <em><xsltfilter></em> tag -- in the first case setting |
|---|
| 67 | | <p> Targets are collections of project components (but not other targets) that |
|---|
| 68 | | are assigned a unique name within their project. A target generally performs |
|---|
| 69 | | a specific task -- or calls other targets that perform specific tasks -- and |
|---|
| 70 | | therefore a target is a bit like a <em> function</em> (but a target has no return |
|---|
| | 67 | <p> Targets are collections of project components (but not other targets) that |
|---|
| | 68 | are assigned a unique name within their project. A target generally performs |
|---|
| | 69 | a specific task -- or calls other targets that perform specific tasks -- and |
|---|
| | 70 | therefore a target is a bit like a <em> function</em> (but a target has no return |
|---|
| 72 | | <p>Targets may <em>depend</em> on other targets. For example, if target A depends |
|---|
| 73 | | on a target B, then when target A is called to be executed, target B will be |
|---|
| 74 | | executed first. Phing automatically resolves these dependencies. You cannot |
|---|
| 75 | | have circular references like: "target A depends on target B that depends |
|---|
| | 72 | <p>Targets may <em>depend</em> on other targets. For example, if target A depends |
|---|
| | 73 | on a target B, then when target A is called to be executed, target B will be |
|---|
| | 74 | executed first. Phing automatically resolves these dependencies. You cannot |
|---|
| | 75 | have circular references like: "target A depends on target B that depends |
|---|
| 98 | | <p> Tasks are responsible for doing the work in Phing. Basically, tasks are the |
|---|
| 99 | | individual actions that your buildfile can perform. For example, tasks exist |
|---|
| 100 | | to copy a file, create a directory, TAR files in a directory. Tasks may also |
|---|
| 101 | | be more complex such as XsltTask which copies a file and transforms the file |
|---|
| 102 | | using XSLT, SmartyTask which does something similar using Smarty templates, |
|---|
| 103 | | or CreoleTask which executes SQL statements against a specified DB. See <a href="appendixes/AppendixB-CoreTasks.html#XsltTask">Appendix |
|---|
| | 98 | <p> Tasks are responsible for doing the work in Phing. Basically, tasks are the |
|---|
| | 99 | individual actions that your buildfile can perform. For example, tasks exist |
|---|
| | 100 | to copy a file, create a directory, TAR files in a directory. Tasks may also |
|---|
| | 101 | be more complex such as XsltTask which copies a file and transforms the file |
|---|
| | 102 | using XSLT, SmartyTask which does something similar using Smarty templates, |
|---|
| | 103 | or CreoleTask which executes SQL statements against a specified DB. See <a href="appendixes/AppendixB-CoreTasks.html#XsltTask">Appendix |
|---|
| 121 | | <p> <em>Note:</em> There are special values that are not mapped to strings, but |
|---|
| 122 | | to boolean values instead. The values <em>true</em>, <em>false</em>, <em>yes</em>, |
|---|
| 123 | | <em>no</em>, <em>on</em> and <em>off</em> are translated to true/false boolean |
|---|
| | 121 | <p> <em>Note:</em> There are special values that are not mapped to strings, but |
|---|
| | 122 | to boolean values instead. The values <em>true</em>, <em>false</em>, <em>yes</em>, |
|---|
| | 123 | <em>no</em>, <em>on</em> and <em>off</em> are translated to true/false boolean |
|---|
| 141 | | <p> Here, <em>CopyTask</em> is passed a complex parameter, a Fileset. Tasks may |
|---|
| 142 | | support multiple complex types in addition to simple parameters. Note that the |
|---|
| 143 | | names of the nested tags used to create the complex types depend on the task |
|---|
| 144 | | implementation. Tasks may support default Phing types (see <a href="#Types">below</a>) |
|---|
| | 141 | <p> Here, <em>CopyTask</em> is passed a complex parameter, a Fileset. Tasks may |
|---|
| | 142 | support multiple complex types in addition to simple parameters. Note that the |
|---|
| | 143 | names of the nested tags used to create the complex types depend on the task |
|---|
| | 144 | implementation. Tasks may support default Phing types (see <a href="#Types">below</a>) |
|---|
| 179 | | <p> An additional fact about types you should notice is the possibility of <em>referencing</em> |
|---|
| 180 | | type instances, i.e. you define your type somewhere in your build file and assign |
|---|
| 181 | | an id to it. Later, you can refer to that type by the id you assigned. Example: |
|---|
| | 179 | <p> An additional fact about types you should notice is the possibility of <em>referencing</em> |
|---|
| | 180 | type instances, i.e. you define your type somewhere in your build file and assign |
|---|
| | 181 | an id to it. Later, you can refer to that type by the id you assigned. Example: |
|---|
| 234 | | <p> The use of patterns is quite straightforward: If you simply want to match |
|---|
| 235 | | a part of a filename or dirname, you use <strong>*</strong>. If you want to |
|---|
| 236 | | include multiple directories and/or files, you use <strong>**</strong>. This |
|---|
| | 234 | <p> The use of patterns is quite straightforward: If you simply want to match |
|---|
| | 235 | a part of a filename or dirname, you use <strong>*</strong>. If you want to |
|---|
| | 236 | include multiple directories and/or files, you use <strong>**</strong>. This |
|---|
| 243 | | <p>Besides being able to refer to nonexistent files, another thing that FileLists |
|---|
| 244 | | allow you to do is specify files <em>in a certain order</em>. Files in FileSets |
|---|
| 245 | | are ordered based on the OS-level directory listing functions, in some cases |
|---|
| 246 | | you may want to specify a list of files to be processed in a certain order -- |
|---|
| | 243 | <p>Besides being able to refer to nonexistent files, another thing that FileLists |
|---|
| | 244 | allow you to do is specify files <em>in a certain order</em>. Files in FileSets |
|---|
| | 245 | are ordered based on the OS-level directory listing functions, in some cases |
|---|
| | 246 | you may want to specify a list of files to be processed in a certain order -- |
|---|
| 269 | | <p> FilterChain usage is quite straightforward: you pass the complex Phing type |
|---|
| 270 | | <em>filterchain</em> to a task that supports FilterChains and add individual |
|---|
| 271 | | filters to the FilterChain. In the course of executing the task, the filters |
|---|
| 272 | | are applied (in the order in which they appear in the XML) to the contents of |
|---|
| | 269 | <p> FilterChain usage is quite straightforward: you pass the complex Phing type |
|---|
| | 270 | <em>filterchain</em> to a task that supports FilterChains and add individual |
|---|
| | 271 | filters to the FilterChain. In the course of executing the task, the filters |
|---|
| | 272 | are applied (in the order in which they appear in the XML) to the contents of |
|---|
| 285 | | </filterchain> |
|---|
| 286 | | </pre> |
|---|
| 287 | | <p> The code listing above shows you some example of how to use filter chains. |
|---|
| 288 | | For a complete reference see <a href="appendixes/AppendixC-CoreTypes.html#Filters">Appendix |
|---|
| 289 | | C</a>. This filter chain would replace all occurences of <em>BC_PATH</em> and |
|---|
| 290 | | <em>BC_PATH_USER</em> with the values assigned to them in lines 4 and 5. Additionally, |
|---|
| | 285 | </filterchain> |
|---|
| | 286 | </pre> |
|---|
| | 287 | <p> The code listing above shows you some example of how to use filter chains. |
|---|
| | 288 | For a complete reference see <a href="appendixes/AppendixC-CoreTypes.html#Filters">Appendix |
|---|
| | 289 | C</a>. This filter chain would replace all occurences of <em>BC_PATH</em> and |
|---|
| | 290 | <em>BC_PATH_USER</em> with the values assigned to them in lines 4 and 5. Additionally, |
|---|
| 307 | | <p> As the pipe concept in Unix, the filter concept is quite complex but powerful. |
|---|
| 308 | | To get a better understanding of different filters and how they can be used, |
|---|
| 309 | | take a look at any of the many uses of FilterChains in the build files for the |
|---|
| | 307 | <p> As the pipe concept in Unix, the filter concept is quite complex but powerful. |
|---|
| | 308 | To get a better understanding of different filters and how they can be used, |
|---|
| | 309 | take a look at any of the many uses of FilterChains in the build files for the |
|---|
| 334 | | <p>Consider the example below to see how Mappers can be used in a build file. |
|---|
| 335 | | This example includes some of the other concepts introduced in this chapter, |
|---|
| 336 | | such as FilterChains and FileSets. If you don't understand everything, don't |
|---|
| 337 | | worry. The important point is that Mappers are types too, which can be used |
|---|
| | 334 | <p>Consider the example below to see how Mappers can be used in a build file. |
|---|
| | 335 | This example includes some of the other concepts introduced in this chapter, |
|---|
| | 336 | such as FilterChains and FileSets. If you don't understand everything, don't |
|---|
| | 337 | worry. The important point is that Mappers are types too, which can be used |
|---|