A task to create a PEAR package.xml version 2.0 file.
This class uses the PEAR_PackageFileManager2 class to perform the work.
This class is designed to be very flexible -- i.e. account for changes to the package.xml w/o requiring changes to this class. We've accomplished this by having generic <option> and <mapping> nested elements. All options are set using PEAR_PackageFileManager2::setOptions().
The <option> tag is used to set a simple option value.
The <mapping> tag represents a complex data type. You can use nested <element> (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_PackageFileManager2::setOptions().
<
pearpkg2 name=
"phing" dir=
"${build.src.dir}">
<include name="**"/>
</fileset>
<option name="outputdirectory" value="./build"/>
<option name="packagefile" value="package2.xml"/>
<option name="packagedirectory" value="./${build.dist.dir}"/>
<option name="baseinstalldir" value="${pkg.prefix}"/>
<option name="channel" value="my.pear-channel.com"/>
<option name="summary" value="${pkg.summary}"/>
<option name="description" value="${pkg.description}"/>
<option name="apiversion" value="${pkg.version}"/>
<option name="apistability" value="beta"/>
<option name="releaseversion" value="${pkg.version}"/>
<option name="releasestability" value="beta"/>
<option name="license" value="none"/>
<option name="phpdep" value="5.0.0"/>
<option name="pearinstallerdep" value="1.4.6"/>
<option name="packagetype" value="php"/>
<option name="notes" value="${pkg.relnotes}"/>
<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>
</pearpkg2>
Look at the build.xml in the Phing base directory (assuming you have the full distro / CVS version of Phing) to see a more complete example of how to call this script.