|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | + |
| 3 | +<project name="name-of-project" default="build"> |
| 4 | + <target name="build" |
| 5 | + depends="prepare,lint,atoum,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpdox,phpcb"/> |
| 6 | + |
| 7 | + <target name="build-parallel" |
| 8 | + depends="prepare,lint,tools-parallel,phpcb"/> |
| 9 | + |
| 10 | + <target name="tools-parallel" description="Run tools in parallel"> |
| 11 | + <parallel threadCount="2"> |
| 12 | + <sequential> |
| 13 | + <antcall target="pdepend"/> |
| 14 | + <antcall target="phpmd-ci"/> |
| 15 | + </sequential> |
| 16 | + <antcall target="phpcpd"/> |
| 17 | + <antcall target="phpcs-ci"/> |
| 18 | + <antcall target="phploc"/> |
| 19 | + <antcall target="phpdox"/> |
| 20 | + </parallel> |
| 21 | + </target> |
| 22 | + |
| 23 | + <target name="clean" description="Cleanup build artifacts"> |
| 24 | + <delete dir="${basedir}/build/api"/> |
| 25 | + <delete dir="${basedir}/build/code-browser"/> |
| 26 | + <delete dir="${basedir}/build/coverage"/> |
| 27 | + <delete dir="${basedir}/build/logs"/> |
| 28 | + <delete dir="${basedir}/build/pdepend"/> |
| 29 | + </target> |
| 30 | + |
| 31 | + <target name="prepare" depends="clean" description="Prepare for build"> |
| 32 | + <mkdir dir="${basedir}/build/api"/> |
| 33 | + <mkdir dir="${basedir}/build/code-browser"/> |
| 34 | + <mkdir dir="${basedir}/build/coverage"/> |
| 35 | + <mkdir dir="${basedir}/build/logs"/> |
| 36 | + <mkdir dir="${basedir}/build/pdepend"/> |
| 37 | + <mkdir dir="${basedir}/build/phpdox"/> |
| 38 | + </target> |
| 39 | + |
| 40 | + <target name="lint" description="Perform syntax check of sourcecode files"> |
| 41 | + <apply executable="php" failonerror="true"> |
| 42 | + <arg value="-l" /> |
| 43 | + |
| 44 | + <fileset dir="${basedir}/Source"> |
| 45 | + <include name="**/*.php" /> |
| 46 | + <modified /> |
| 47 | + </fileset> |
| 48 | + |
| 49 | + <fileset dir="${basedir}/Test"> |
| 50 | + <include name="**/*.php" /> |
| 51 | + <modified /> |
| 52 | + </fileset> |
| 53 | + </apply> |
| 54 | + </target> |
| 55 | + |
| 56 | + <target name="phploc" description="Measure project size using PHPLOC"> |
| 57 | + <exec executable="phploc"> |
| 58 | + <arg value="--log-csv" /> |
| 59 | + <arg value="${basedir}/build/logs/phploc.csv" /> |
| 60 | + <arg path="${basedir}/Source" /> |
| 61 | + </exec> |
| 62 | + </target> |
| 63 | + |
| 64 | + <target name="atoum" description="Test unitaire"> |
| 65 | + <exec executable="atoum"> |
| 66 | + <arg line="-c ${basedir}/Test/.atoum.php" /> |
| 67 | + <arg line="-d ${basedir}/Test/" /> |
| 68 | + </exec> |
| 69 | + </target> |
| 70 | + |
| 71 | + <target name="pdepend" description="Calculate software metrics using PHP_Depend"> |
| 72 | + <exec executable="pdepend"> |
| 73 | + <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" /> |
| 74 | + <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" /> |
| 75 | + <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" /> |
| 76 | + <arg path="${basedir}/Source" /> |
| 77 | + </exec> |
| 78 | + </target> |
| 79 | + |
| 80 | + <target name="phpmd" |
| 81 | + description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing."> |
| 82 | + <exec executable="phpmd"> |
| 83 | + <arg path="${basedir}/Source" /> |
| 84 | + <arg value="text" /> |
| 85 | + <arg value="${basedir}/build/phpmd.xml" /> |
| 86 | + </exec> |
| 87 | + </target> |
| 88 | + |
| 89 | + <target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server"> |
| 90 | + <exec executable="phpmd"> |
| 91 | + <arg path="${basedir}/Source" /> |
| 92 | + <arg value="xml" /> |
| 93 | + <arg value="${basedir}/build/phpmd.xml" /> |
| 94 | + <arg value="--reportfile" /> |
| 95 | + <arg value="${basedir}/build/logs/pmd.xml" /> |
| 96 | + </exec> |
| 97 | + </target> |
| 98 | + |
| 99 | + <target name="phpcs" |
| 100 | + description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing."> |
| 101 | + <exec executable="phpcs"> |
| 102 | + <arg value="--standard=${basedir}/build/phpcs.xml" /> |
| 103 | + <arg path="${basedir}/Source" /> |
| 104 | + </exec> |
| 105 | + </target> |
| 106 | + |
| 107 | + <target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server"> |
| 108 | + <exec executable="phpcs" output="/dev/null"> |
| 109 | + <arg value="--report=checkstyle" /> |
| 110 | + <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" /> |
| 111 | + <arg value="--standard=${basedir}/build/phpcs.xml" /> |
| 112 | + <arg path="${basedir}/Source" /> |
| 113 | + </exec> |
| 114 | + </target> |
| 115 | + |
| 116 | + <target name="phpcpd" description="Find duplicate code using PHPCPD"> |
| 117 | + <exec executable="phpcpd"> |
| 118 | + <arg value="--log-pmd" /> |
| 119 | + <arg value="${basedir}/build/logs/pmd-cpd.xml" /> |
| 120 | + <arg path="${basedir}/Source" /> |
| 121 | + </exec> |
| 122 | + </target> |
| 123 | + |
| 124 | + <target name="phpdox" description="Generate API documentation using phpDox"> |
| 125 | + <exec executable="phpdox"/> |
| 126 | + </target> |
| 127 | + |
| 128 | + <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser"> |
| 129 | + <exec executable="phpcb"> |
| 130 | + <arg value="--log" /> |
| 131 | + <arg path="${basedir}/build/logs" /> |
| 132 | + <arg value="--source" /> |
| 133 | + <arg path="${basedir}/Source" /> |
| 134 | + <arg value="--output" /> |
| 135 | + <arg path="${basedir}/build/code-browser" /> |
| 136 | + </exec> |
| 137 | + </target> |
| 138 | +</project> |
0 commit comments