Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
235 lines (195 sloc) 7.63 KB
<?xml version="1.0"?>
description="Phing tasks for Pirum integration."
This is the Phing build file for Phing-Pirum.
Phing is a build tool. Learn more about it at
Copyright (c) 2010, Matt Butcher, some rights reserved.
Phing-Pirum is released under an MIT license. See COPYING-MIT.txt for details.
<target name="info" description="Information on using the Phing-Pirum Phing build.">
To build:
phing build -Dversion=1.0.0
To run tests:
phing test
To emit a sample Phing-Pirum config:
phing tasks
The end.
<target name="tasks">
Set the include path to get to our tasks. Then load our tasks.
The includepath is only needed if Phing reports that it can't find pirumbuild/pirumadd.
<!-- includepath classpath="path/to/PhingPirum"/ -->
<taskdef classname="PhingPirum.Task.PirumBuildTask" name="pirumbuild"/>
<taskdef classname="PhingPirum.Task.PirumAddTask" name="pirumadd"/>
All tasks are for actual building and testing of Phing-Pirum.
<!-- Global properties -->
<property name="srcdir" value="./src"/>
<property name="testdir" value="./tests"/>
<property name="builddir" value="./bin/build"/>
<property name="docsdir" value="./doc"/>
<property name="packagedir" value="./dist"/>
<property name="pearchannel" value="../"/>
<!-- Set the include path to get to our tasks. Then load our tasks. -->
<includepath classpath="./src"/>
<taskdef classname="PhingPirum.Task.PirumBuildTask" name="pirumbuild"/>
<taskdef classname="PhingPirum.Task.PirumAddTask" name="pirumadd"/>
<!-- Files that must be included in the release -->
<!-- include name="INSTALL.mdown"/ -->
<fileset id="licensefiles" dir=".">
<include name=""/>
<include name="COPYING-MIT.txt"/>
<!-- Files to be treated as source code -->
<fileset id="sourcecode" dir="${srcdir}">
<include name="**/*.php" />
<!-- Unit tests and auxilliary files -->
<fileset id="unittests" dir="${testdir}/Tests">
<include name="**/*Test.php" />
<!-- Documentation -->
<fileset id="docs" dir="./doc">
<include name="**/*" />
<!-- BUILD: The primary build target. -->
<target name="build" depends="lint, setup, fullBuild"
description="Generate docs, minimal, and full builds and then creates packages."
<!-- Target that should be run always. -->
<target name="setup" description="Run required configuration for any build.">
<!-- Default version -->
<property name="version" value="dev-${DSTAMP}"/>
<!-- Build the full package -->
<target name="fullBuild" description="Full Phing-Pirum build, including docs."
<property name="releasedir" value="${builddir}/PhingPirum-${version}" override="true"/>
<delete dir="${releasedir}" />
<!-- Make all necessary directories. -->
<mkdir dir="${releasedir}"/>
<mkdir dir="${releasedir}/src"/>
<mkdir dir="${releasedir}/examples"/>
<mkdir dir="${releasedir}/tests"/>
<mkdir dir="${releasedir}/doc"/>
<!-- Copy license files. -->
<copy todir="${releasedir}">
<fileset refid="licensefiles"/>
<!-- Copy source code, doing token replacement on version. -->
<copy todir="${releasedir}">
<replacetokens begintoken="@" endtoken="@">
<token key="UNSTABLE" value="${version}"/>
<fileset refid="sourcecode"/>
<!-- Generate PEAR package. -->
<pearpkg2 name="PhingPirum" dir="./">
<fileset dir="${releasedir}">
<include name="**/**"/>
<option name="uri" value=""/>
<option name="packagefile" value="package2.xml"/>
<option name="channel" value=""/>
<option name="baseinstalldir" value="PhingPirum"/>
<option name="summary" value="Pirum tasks for Phing"/>
<option name="description" value="Provides Pirum integration with Phing. Easily build PEAR channels and add packages to your channels."/>
<option name="apiversion" value="${version}"/>
<option name="apistability" value="${stability}"/>
<option name="releaseversion" value="${version}"/>
<option name="releasestability" value="${stability}"/>
<option name="license" value="MIT License"/>
<option name="phpdep" value="5.0.0"/>
<option name="pearinstallerdep" value="1.4.6"/>
<option name="packagetype" value="php"/>
<option name="notes" value="Latest info is available at runs Pirum."/>
<option name="outputdirectory" value="./${builddir}"/>
<option name="packagedirectory" value="./${releasedir}"/>
<mapping name="maintainers">
<element key="handle" value="technosophos"/>
<element key="name" value="M Butcher"/>
<element key="email" value=""/>
<element key="role" value="lead"/>
<mapping name="deps">
<element key="channel" value=""/>
<element key="name" value="Pirum"/>
<element key="version" value="0.9.0"/>
<element key="max" value="1.0.99"/>
<element key="recommended" value="1.0.0"/>
<move file="${builddir}/package2.xml" tofile="${builddir}/package.xml"/>
<!-- Create tgz and zip versions. -->
<tar destfile="${packagedir}/PhingPirum-${version}.tgz" compression="gzip">
<fileset dir="${builddir}">
<include name="Phing-Pirum-${version}/**/*"/>
<include name="package.xml"/>
<pirumadd targetdir="${pearchannel}" packagefile="${packagedir}/PhingPirum-${version}.tgz"/>
<!-- Check syntax -->
<target name="lint" description="Check syntax of source.">
<fileset refid="sourcecode" />
<!-- Run a full test and format an HTML report -->
<target name="test" depends="lint" description="Run full tests">
<!-- Get a base pirum.xml file. -->
<copy file="${testdir}/pirum.xml" tofile="${testdir}/fakepear/pirum.xml"/>
<!-- Test creating a channel. -->
<pirumbuild targetdir="${testdir}/fakepear" />
<!-- Test adding a known-good package -->
<pirumadd targetdir="${testdir}/fakepear" packagefile="${testdir}/LibRIS-1.0.0.tgz"/>
<!-- Clean up. -->
<fileset dir="${testdir}/fakepear">
<include name="**/**"/>
<target name="setPearStability" depends="setup">
<property name="stability">stable</property>
<contains string="${version}" substring="dev"/>
<property name="stability" override="true">snapshot</property>
<contains string="${version}" substring="alpha"/>
<property name="stability" override="true">alpha</property>
<contains string="${version}" substring="beta"/>
<property name="stability" override="true">beta</property>