Re: Fwd: [PEAR-DEV] Phing and PEAR packages
| From: | Greg Beaver | Date: | Tue, 06 Jan 2004 23:19:35 +0000 |
| Subject: | Re: Fwd: [PEAR-DEV] Phing and PEAR packages | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-24832@lists.php.net to get a copy of this message | ||
This is pretty awesome, glad my code could be helpful in designing something even better :).
Greg
Hans Lellelid wrote:
I'm sorry -- I didn't mean to send this as a reply to Informix thread.
-HL
-------- Original Message --------
As of the latest 2.0b1 release, Phing has the ability to create PEAR package.xml files using the PEAR_PackageFileManager class. For those who don't know, Phing is a PHP[5] port of Apache Ant, the project build tool. Phing uses XML buildfiles that invoke simple PHP "task" classes to perform the build work. More information & documentation can be found at http://phing.info . In addition to being able to create PEAR packages using Phing, you can also (not coincidentally) now install Phing using the PEAR installer. You do need PHP5 to run Phing v2.
We found PEAR_PackageFileManager to be a great package -- saved us a lot of time writing XSL or PHP that would create the package.xml from info in our XML buildfile. The main reason why we use Phing + PEAR_PackageFileManager to build the package.xml -- instead of just writing it statically or even using PEAR_PackageFileManager alone -- is that Phing has powerful filesystem tasks that can perform very selective inclusion/exclusion of files or even radically transform a directory structure in order to prepare it for packaging.
For example, to copy all ".php" and "schema-*.xml" files, exclude files from any "test" directories, and only copy files modified after Jan 1, 2004 or files that are smaller than 1Mb you could do this:
<copy todir="${build.dir}">
<fileset dir=".">
<include name="**/*.php"/>
<include name="**/schema-*.xml"/>
<exclude name="**/test/**"/>
<or>
<size value="1" units="M" when="less"/>
<date datetime="2004-01-01" when="after"/>
</or>
</fileset>
</copy>
The combination of the globbing include/exclude support and the easily-extensible selectors makes this a pretty powerful packaging solution.
These filesets can also be used in conjunction with the Phing task that uses PEAR_PackageFileManager, through that package's support for custom file listers. For Phing we use fileset with PEAR_PackageFileManager and then copy the files into a build directory and create a TGZ. It's worked out great for us, and I figured that other PEAR packages with complex directory structures could probably take advantage of this.
Cheers,
Hans