多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# C.65 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.107](apcs107.html "C.107 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.78:聽Attributes NameTypeDescriptionDefaultRequired`name``String`The name of the PEAR package.n/aYes`dir``String`The base directory of files to add to package.n/aYes`destFile``String`The file to create.package.xml in base directoryNo C.65.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.65.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](http://pear.php.net/manual/en/package.pear.pear-packagefilemanager.pear-packagefilemanager.addrole.php) for more information. Table C.79:聽Available options NameTypeDescriptionDefaultRequired`extension``String`The file extensionn/aYes`role``String`The file extensionn/aYes