C.46 PearPackageTask
Prev | Appendix C. Optional tasks | Next

## C.46 PearPackageTask

With the PearPackageTask, you can create a package.xml which can be installed using the PEAR installer. Use this in conjunction with the Section C.80, “TarTask” to completely script the building of a PEAR package.

### Note

Note that this task creates a `version 1` package.xml file.

This task uses the `PEAR_PackageFileManager` class. In order to be maximally flexible, the majority of options are set generically (using `<option>` tag) and are set using `PEAR_PackageFileManager::setOptions()` . Use the `<mapping>` tag to represent complex values (which are turned into associative arrays and also set using `setOptions()` method).

Table C.56: Attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
`name` | `String` | The name of the PEAR package. | n/a | Yes
`dir` | `String` | The base directory of files to add to package. | n/a | Yes
`destFile` | `String` | The file to create. | package.xml in base directory | No

### C.46.1 Example

    <pearpkg name="phing" dir="${build.src.dir}" destFile="${build.base.dir}/package.xml">
    <fileset dir=".">
      <include name="**"/>
    </fileset>
    <option name="notes">Sample release notes here.</option>
    <option name="description">Package description</option>
    <option name="summary">Short description</option>
    <option name="version" value="2.0.0b1"/>
    <option name="state" value="beta"/>
     <mapping name="maintainers">
      <element>
       <element key="handle" value="hlellelid"/>
       <element key="name" value="Hans"/>
       <element key="email" value="hans@xmpl.org"/>
       <element key="role" value="lead"/>
      </element>
    </mapping>
    </pearpkg>

### C.46.2 Supported Nested Tags

- `fileset`

- `option`

- `mapping`

  The <mapping> tag represents a complex data type. You can use nested <mapping> (and nested <element> with <element> tags) to represent the full complexity of the structure. Bear in mind that what you are creating will be mapped to an associative array that will be passed in via `PEAR_PackageFileMaintainer::setOptions()` .

      <mapping name="option_name">
          <element key="key_name" value="key_val"/>
          <element key="key_name" value="key_val"/>
      </mapping>

- `role` See PEAR_PackageFileManager::addRole for more information.

  Table C.57: Available options

  Name | Type | Description | Default | Required
  --- | --- | --- | --- | ---
  `extension` | `String` | The file extension | n/a | Yes
  `role` | `String` | The file extension | n/a | Yes

Prev | Up | Next
C.45 PDOSQLExecTask | Home | C.47 PearPackage2Task