|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<project name="Templado" default="build" basedir="."> |
| 3 | + <property name="source" value="src"/> |
| 4 | + |
| 5 | + <target name="clean" description="Clean up and create artifact directories"> |
| 6 | + <delete dir="${basedir}/build/docs"/> |
| 7 | + <delete dir="${basedir}/build/coverage"/> |
| 8 | + <delete dir="${basedir}/build/logs"/> |
| 9 | + <delete dir="${basedir}/build/pdepend"/> |
| 10 | + <delete dir="${basedir}/build/phpab"/> |
| 11 | + |
| 12 | + <mkdir dir="${basedir}/build/docs"/> |
| 13 | + <mkdir dir="${basedir}/build/coverage"/> |
| 14 | + <mkdir dir="${basedir}/build/logs"/> |
| 15 | + <mkdir dir="${basedir}/build/pdepend"/> |
| 16 | + <mkdir dir="${basedir}/build/phpab"/> |
| 17 | + </target> |
| 18 | + |
| 19 | + <target name="lint"> |
| 20 | + <apply executable="php" failonerror="true"> |
| 21 | + <arg value="-l" /> |
| 22 | + |
| 23 | + <fileset dir="${basedir}/src"> |
| 24 | + <include name="**/*.php" /> |
| 25 | + <modified /> |
| 26 | + </fileset> |
| 27 | + |
| 28 | + </apply> |
| 29 | + </target> |
| 30 | + |
| 31 | + <target name="phpab" description="Build autoloader"> |
| 32 | + <exec executable="phpab"> |
| 33 | + <arg line="--cache ${basedir}/build/phpab/autoload.cache -1 -o src/autoload.php" /> |
| 34 | + <arg path="src" /> |
| 35 | + </exec> |
| 36 | + </target> |
| 37 | + |
| 38 | + <target name="phpunit" description="Run unit tests using PHPUnit"> |
| 39 | + <exec executable="phpunit" failonerror="true"/> |
| 40 | + </target> |
| 41 | + |
| 42 | + <target name="parallelTasks" |
| 43 | + description="Run the pdepend, phpmd, phpcpd, phpcs and phploc tasks in parallel using a maximum of 2 threads."> |
| 44 | + <parallel threadCount="2"> |
| 45 | + <sequential> |
| 46 | + <antcall target="pdepend"/> |
| 47 | + <antcall target="phpmd"/> |
| 48 | + </sequential> |
| 49 | + <antcall target="phpcpd"/> |
| 50 | + <antcall target="phpcs"/> |
| 51 | + <antcall target="phploc"/> |
| 52 | + </parallel> |
| 53 | + </target> |
| 54 | + |
| 55 | + <target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend"> |
| 56 | + <exec executable="pdepend"> |
| 57 | + <arg line="--jdepend-xml=${basedir}/build/logs/jdepend.xml |
| 58 | + --jdepend-chart=${basedir}/build/pdepend/dependencies.svg |
| 59 | + --overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg |
| 60 | + ${source}"/> |
| 61 | + </exec> |
| 62 | + </target> |
| 63 | + |
| 64 | + <target name="phpmd" description="Generate pmd.xml using PHPMD"> |
| 65 | + <exec executable="phpmd"> |
| 66 | + <arg line="${source} |
| 67 | + xml |
| 68 | + codesize,design,naming,unusedcode |
| 69 | + --reportfile ${basedir}/build/logs/pmd.xml"/> |
| 70 | + </exec> |
| 71 | + </target> |
| 72 | + |
| 73 | + <target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD"> |
| 74 | + <exec executable="phpcpd"> |
| 75 | + <arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml ${source}"/> |
| 76 | + </exec> |
| 77 | + </target> |
| 78 | + |
| 79 | + <target name="phploc" description="Generate phploc.xml"> |
| 80 | + <exec executable="phploc"> |
| 81 | + <arg line="--count-tests --log-xml ${basedir}/build/logs/phploc.xml ${source} tests"/> |
| 82 | + </exec> |
| 83 | + </target> |
| 84 | + |
| 85 | + <target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer"> |
| 86 | + <exec executable="phpcs" output="/dev/null"> |
| 87 | + <arg line="--report=checkstyle |
| 88 | + --report-file=${basedir}/build/logs/checkstyle.xml |
| 89 | + --standard=phpcs.xml |
| 90 | + ${source}"/> |
| 91 | + </exec> |
| 92 | + </target> |
| 93 | + |
| 94 | + <target name="docs"> |
| 95 | + <delete dir="${basedir}/build/docs" /> |
| 96 | + <exec executable="${basedir}/phpdox" /> |
| 97 | + </target> |
| 98 | + |
| 99 | + <target name="build" depends="clean,lint,parallelTasks,phpunit"/> |
| 100 | + <target name="test" depends="clean,lint,phpunit"/> |
| 101 | +</project> |
0 commit comments