Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
283 lines (250 sloc) 13.4 KB
<?xml version="1.0" encoding="UTF-8"?>
<!-- build file for phing -->
<project default="help" basedir=".">
<!-- Human-readable info about our component -->
<property file="" />
<property name="project.version" value="${project.majorVersion}.${project.minorVersion}.${project.patchLevel}" />
<property name="project.apiversion" value="${project.majorVersion}.${project.minorVersion}" />
<!-- Paths to the directories that we work with -->
<property name="project.srcdir" value="${project.basedir}/src" override="true" />
<property name="project.src.phpdir" value="${project.srcdir}/php" override="true" />
<property name="project.src.bindir" value="${project.srcdir}/bin" override="true" />
<property name="project.src.datadir" value="${project.srcdir}/data" override="true" />
<property name="project.src.docdir" value="${project.srcdir}/docs" override="true" />
<property name="project.src.testdir" value="${project.srcdir}/tests" override="true" />
<property name="project.src.wwwdir" value="${project.srcdir}/www" override="true" />
<property name="project.src.testunitdir" value="${project.src.testdir}/unit-tests" override="true" />
<property name="project.src.testintdir" value="${project.src.testdir}/integration-tests" override="true" />
<property name="project.src.testfuncdir" value="${project.src.testdir}/functional-tests" override="true" />
<property name="project.reviewdir" value="${project.basedir}/review" override="true" />
<property name="" value="${project.basedir}/review/logs" override="true" />
<property name="" value="${project.reviewdir}/docs" override="true" />
<property name="" value="${project.reviewdir}/code-browser" override="true" />
<property name="" value="${project.reviewdir}/code-coverage" override="true" />
<property name="project.builddir" value="${project.basedir}/.build" override="true" />
<property name="project.pkgdir" value="${project.builddir}/${}-${project.version}" override="true" />
<property name="project.tmpdir" value="${project.basedir}/.tmp" override="true" />
<property name="project.vendordir" value="${project.basedir}/vendor" override="true" />
<property name="project.vendor.bindir" value="${project.vendordir}/bin" override="true" />
<property name="project.vendor.datadir" value="${project.vendordir}/data" override="true" />
<property name="project.vendor.phpdir" value="${project.vendordir}/php" override="true" />
<property name="project.vendor.testdir" value="${project.vendordir}/tests" override="true" />
<property name="project.vendor.docdir" value="${project.vendordir}/docs" override="true" />
<property name="project.vendor.wwwdir" value="${project.vendordir}/www" override="true" />
<property name="project.distdir" value="${project.basedir}/dist" />
<property name="project.tarfilename" value="${}-${project.version}.tgz" />
<property name="project.tarfile" value="${project.distdir}/${project.tarfilename}" />
<!-- a user to use to publish on the pear server -->
<property name="remote.user" value="" override="true" />
<!-- override this if you want to run additional PEAR commands -->
<property name="pear.cmd" value="" override="true" />
<!-- lists of the files that make up our package -->
<fileset dir="${project.src.bindir}" id="binfiles">
<include name="**/**"/>
<exclude name="**/.DS_Store"/>
<exclude name="**/.empty"/>
<exclude name="**/.svn"/>
<fileset dir="${project.src.datadir}" id="datafiles">
<include name="**/**"/>
<exclude name="**/.DS_Store"/>
<exclude name="**/.empty"/>
<exclude name="**/.svn"/>
<fileset dir="${project.src.phpdir}" id="phpfiles">
<include name="**/**"/>
<exclude name="**/.DS_Store"/>
<exclude name="**/.empty"/>
<exclude name="**/.svn"/>
<fileset dir="${project.src.testunitdir}/php" id="testfiles">
<include name="**/**"/>
<exclude name="**/.DS_Store"/>
<exclude name="**/.empty"/>
<exclude name="**/.svn"/>
<fileset dir="${project.src.wwwdir}" id="wwwfiles">
<include name="**/**" />
<exclude name="**/.DS_Store"/>
<exclude name="**/.empty"/>
<exclude name="**/.svn"/>
<fileset dir="${project.src.docdir}" id="docfiles">
<include name="**/**" />
<exclude name="**/.DS_Store"/>
<exclude name="**/.empty"/>
<exclude name="**/.svn"/>
<fileset dir="${project.basedir}" id="topleveldocfiles">
<include name="*.txt" />
<include name="*.md" />
<import file="build.local.xml"/>
<!-- Tell the user what this build file supports -->
<target name="help">
<echo message="${} ${project.version}: build.xml targets:" />
<echo message="" />
<echo message="lint" />
<echo message=" Check the PHP files for syntax errors" />
<echo message="test" />
<echo message=" Run the component's PHPUnit tests" />
<echo message="code-review" />
<echo message=" Run all of the code quality targets:" />
<echo message="" />
<echo message=" code-browser" />
<echo message=" Run code quality tests for PHP_CodeBrowser" />
<echo message=" phpcpd" />
<echo message=" Check for cut and paste problems" />
<echo message=" phpdoc" />
<echo message=" Create the PHP docs from source code" />
<echo message="" />
<echo message="build-vendor" />
<echo message=" Populate vendor/ with this package's dependencies" />
<echo message="pear-package" />
<echo message=" Create a PEAR-compatible package" />
<echo message="install-vendor" />
<echo message=" Install this component from source into vendor/" />
<echo message="vendor-pear" />
<echo message=" Run additional PEAR commands inside the vendor folder" />
<echo message="install-system" />
<echo message=" Install this component from source for all local users" />
<echo message=" You must be root to run this target on Linux!!" />
<echo message="publish-local" />
<echo message=" Publish your PEAR-compatible package into a local copy" />
<echo message=" of your PEAR channel" />
<echo message="clean" />
<echo message=" Remove all temporary folders created by this build file" />
<echo message="" />
<phingcall target="local-help" />
<!-- Run PHP lint on all of the source code -->
<target name="lint">
<fileset dir="${project.src.phpdir}">
<include name="**/*.php" />
<!-- Run the unit tests for this module -->
<target name="run-unittests" depends="lint">
<delete dir="${}" />
<mkdir dir="${}" />
<mkdir dir="${}" />
<exec command="phpunit --bootstrap=${project.src.testunitdir}/bootstrap.php --coverage-html ${} --coverage-clover ${}/phpunit.xml ${project.src.testunitdir}" checkreturn="true" logoutput="true"/>
<echo>The code coverage report is in ${}</echo>
<!-- Run all the tests for this module -->
<target name="test" depends="run-unittests" />
<!-- Run the code review quality tests -->
<target name="code-review" depends="run-unittests, code-browser, phpcpd, pdepend" />
<!-- Run all of the targets for setting up the code browser -->
<target name="code-browser" depends="phpmd, phpcs, phpcb" />
<target name="pdepend">
<mkdir dir="${}" />
<exec command="pdepend --phpunit-xml=${}/pdepend.xml --jdepend-xml=${}/jdepend.xml --jdepend-chart=${}/dependencies.svg --overview-pyramid=${}/overview-pyramid.svg ${project.src.phpdir}" logoutput="true"/>
<!-- Generate package docs -->
<target name="phpdoc">
<mkdir dir="${}" />
<exec command="phpdoc -d ${project.src.phpdir} -t ${}" logoutput="true"/>
<echo message="You will find the PHPDoc for your project at: ${}/index.html"/>
<!-- Check code for code smells -->
<target name="phpmd">
<mkdir dir="${}" />
<exec command="phpmd ${project.src.phpdir} xml codesize,design,naming,unusedcode --reportfile ${}/phpmd.xml" logoutput="true" />
<target name="phpcpd">
<mkdir dir="${}"/>
<exec command="phpcpd --log-pmd ${}/pmd-cpd.xml ${project.src.phpdir}" logoutput="true" />
<!-- Check the code for style violations -->
<target name="phpcs">
<mkdir dir="${}" />
<exec command="phpcs --report=xml --report-file=${}/checkstyle.xml --standard=${checkstyle.standard} --extensions=php ${project.src.phpdir}" logoutput="true"/>
<!-- Build the code-browser files -->
<target name="phpcb" depends="phpmd">
<delete dir="${}" />
<mkdir dir="${}" />
<exec command="phpcb --log ${} --source ${project.src.phpdir} --output ${}" logoutput="true" />
<!-- Populate vendor with the dependencies for this component -->
<target name="build-vendor" depends="pear-package,setup-vendor">
<echo>Populating vendor/ with dependencies</echo>
<exec command="phix pear:register-channels" checkreturn="true" logoutput="true" />
<exec command="pear -c ${project.tmpdir}/pear-config install --alldeps ${project.tarfile}" logoutput="true" checkreturn="true"/>
<!-- Setup the vendor folder -->
<target name="setup-vendor">
<echo>Creating vendor/ as a sandboxed PEAR install folder</echo>
<delete dir="${project.vendordir}" />
<mkdir dir="${project.vendordir}" />
<delete dir="${project.tmpdir}" />
<mkdir dir="${project.tmpdir}" />
<exec command="pear config-create ${project.tmpdir} ${project.tmpdir}/pear-config" checkreturn="true" logoutput="true" />
<exec command="pear -c ${project.tmpdir}/pear-config config-set preferred_state alpha" checkreturn="true" logoutput="true" />
<exec command="pear -c ${project.tmpdir}/pear-config config-set php_dir ${project.vendor.phpdir}" checkreturn="true" logoutput="true" />
<exec command="pear -c ${project.tmpdir}/pear-config config-set bin_dir ${project.vendor.bindir}" checkreturn="true" logoutput="true" />
<exec command="pear -c ${project.tmpdir}/pear-config config-set data_dir ${project.vendor.datadir}" checkreturn="true" logoutput="true" />
<exec command="pear -c ${project.tmpdir}/pear-config config-set doc_dir ${project.vendor.docdir}" checkreturn="true" logoutput="true" />
<exec command="pear -c ${project.tmpdir}/pear-config config-set test_dir ${project.vendor.testdir}" checkreturn="true" logoutput="true" />
<exec command="pear -c ${project.tmpdir}/pear-config config-set www_dir ${project.vendor.wwwdir}" checkreturn="true" logoutput="true" />
<!-- Create the PEAR package, ready for release -->
<target name="pear-package">
<echo>Building release directory</echo>
<delete dir="${project.builddir}" />
<mkdir dir="${project.pkgdir}" />
<copy todir="${project.pkgdir}">
<fileset refid="binfiles"/>
<fileset refid="datafiles"/>
<fileset refid="phpfiles"/>
<fileset refid="testfiles"/>
<fileset refid="wwwfiles"/>
<fileset refid="docfiles"/>
<fileset refid="topleveldocfiles"/>
<copy todir="${project.builddir}">
<fileset dir=".">
<include name="package.xml" />
<exec command="phix pear:expand-package-xml" checkreturn="yes" logoutput="yes"/>
<echo>Creating ${project.tarfile} PEAR package</echo>
<mkdir dir="${project.distdir}" />
<delete file="${project.tarfile}" />
<tar destfile="${project.tarfile}" compression="gzip">
<fileset dir="${project.builddir}">
<include name="**/**" />
<echo>Your PEAR package is in ${project.tarfile}</echo>
<!-- Install the code -->
<target name="install-vendor">
<exec command="pear -c ${project.tmpdir}/pear-config install --alldeps -f ${project.tarfile}" logoutput="true" checkreturn="true"/>
<target name="install-system">
<exec command="pear install -f -a ${project.tarfile}" checkreturn="true" logoutput="true" />
<!-- Publish to local copy of PEAR channel -->
<target name="publish-local" depends="pear-package">
<exec command="pirum add ${pear.local} ${project.tarfile}" checkreturn="true" logoutput="true" />
<!-- Run additional PEAR commands in the vendor folder -->
<target name="vendor-pear">
<exec command="pear -c ${project.tmpdir}/pear-config ${pear.cmd}" logoutput="true" checkreturn="true" />
<!-- Clean up the mess -->
<target name="clean">
<delete dir="${project.builddir}" />
<delete dir="${project.distdir}" />
<delete dir="${project.reviewdir}" />
<delete dir="${project.pkgdir}" />
<delete dir="${project.distdir}" />
<delete dir="${project.tmpdir}" />
<!-- vim: set tabstop=2 shiftwidth=2 expandtab: -->