|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | + |
| 3 | +<project name="codebird-php" default="build" basedir="."> |
| 4 | + <property name="source" value="."/> |
| 5 | + <property name="source_comma_sep" value="."/> |
| 6 | + <property environment="env"/> |
| 7 | + <property name="env.PHPUNIT_XML" value="phpunit.xml"/> |
| 8 | + <property name="env.PHPUNIT_XML_HHVM" value="phpunit.xml.hhvm"/> |
| 9 | + <property name="env.PHPUNIT_ARGS" value=""/> |
| 10 | + |
| 11 | + <target name="clean" description="Clean up and create artifact directories"> |
| 12 | + <delete dir="${basedir}/build/api"/> |
| 13 | + <delete dir="${basedir}/build/code-browser"/> |
| 14 | + <delete dir="${basedir}/build/coverage"/> |
| 15 | + <delete dir="${basedir}/build/logs"/> |
| 16 | + <delete dir="${basedir}/build/pdepend"/> |
| 17 | + |
| 18 | + <mkdir dir="${basedir}/build/api"/> |
| 19 | + <mkdir dir="${basedir}/build/code-browser"/> |
| 20 | + <mkdir dir="${basedir}/build/coverage"/> |
| 21 | + <mkdir dir="${basedir}/build/logs"/> |
| 22 | + <mkdir dir="${basedir}/build/pdepend"/> |
| 23 | + </target> |
| 24 | + |
| 25 | + <target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml"> |
| 26 | + <exec executable="${basedir}/vendor/bin/phpunit" failonerror="true"> |
| 27 | + <arg line="--configuration ${env.PHPUNIT_XML} ${env.PHPUNIT_ARGS}"/> |
| 28 | + </exec> |
| 29 | + </target> |
| 30 | + |
| 31 | + <target name="phpunit-hhvm" description="Run unit tests using PHPUnit with HHVM specific config"> |
| 32 | + <exec executable="${basedir}/vendor/bin/phpunit" failonerror="true"> |
| 33 | + <arg line="--configuration ${env.PHPUNIT_XML_HHVM} ${env.PHPUNIT_ARGS}"/> |
| 34 | + </exec> |
| 35 | + </target> |
| 36 | + |
| 37 | + <target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend"> |
| 38 | + <exec executable="pdepend"> |
| 39 | + <arg line="'--jdepend-xml=${basedir}/build/logs/jdepend.xml' |
| 40 | + '--jdepend-chart=${basedir}/build/pdepend/dependencies.svg' |
| 41 | + '--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg' |
| 42 | + ${source_comma_sep}" /> |
| 43 | + </exec> |
| 44 | + </target> |
| 45 | + |
| 46 | + <target name="phpmd" description="Generate pmd.xml using PHPMD"> |
| 47 | + <exec executable="phpmd"> |
| 48 | + <arg line="${source_comma_sep} |
| 49 | + xml |
| 50 | + codesize,design,naming,unusedcode |
| 51 | + --exclude test,build,vendor |
| 52 | + --reportfile '${basedir}/build/logs/pmd.xml'" /> |
| 53 | + </exec> |
| 54 | + </target> |
| 55 | + |
| 56 | + <target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD"> |
| 57 | + <exec executable="phpcpd"> |
| 58 | + <arg line="--log-pmd '${basedir}/build/logs/pmd-cpd.xml' |
| 59 | + --exclude test |
| 60 | + --exclude build |
| 61 | + --exclude vendor |
| 62 | + ${source}" /> |
| 63 | + </exec> |
| 64 | + </target> |
| 65 | + |
| 66 | + <target name="phploc" description="Generate phploc.csv"> |
| 67 | + <exec executable="phploc"> |
| 68 | + <arg line="--log-csv '${basedir}/build/logs/phploc.csv' |
| 69 | + --exclude test |
| 70 | + --exclude build |
| 71 | + --exclude vendor |
| 72 | + ${source}" /> |
| 73 | + </exec> |
| 74 | + </target> |
| 75 | + |
| 76 | + <target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer excluding third party libraries"> |
| 77 | + <exec executable="phpcs"> |
| 78 | + <arg line=" |
| 79 | + --ignore=*/vendor/*,*/build/* |
| 80 | + --report=checkstyle |
| 81 | + --extensions=php |
| 82 | + --report-file='${basedir}/build/logs/checkstyle.xml' |
| 83 | + --standard=PMAStandard |
| 84 | + ${source}" /> |
| 85 | + </exec> |
| 86 | + </target> |
| 87 | + |
| 88 | + <target name="phpdoc" description="Generate API documentation using PHPDocumentor"> |
| 89 | + <exec executable="phpdoc"> |
| 90 | + <arg line="-d ${source} -t '${basedir}/build/api'" /> |
| 91 | + </exec> |
| 92 | + </target> |
| 93 | + |
| 94 | + <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser"> |
| 95 | + <exec executable="phpcb"> |
| 96 | + <arg line="--log '${basedir}/build/logs' |
| 97 | + --source '${source}' |
| 98 | + --output '${basedir}/build/code-browser'" /> |
| 99 | + </exec> |
| 100 | + </target> |
| 101 | + |
| 102 | + <target name="lint" description="Perform syntax check of sourcecode files"> |
| 103 | + <apply executable="php" failonerror="true" output="${basedir}/build/logs/lint.log" logError="true"> |
| 104 | + <arg value="-l" /> |
| 105 | + |
| 106 | + <fileset dir="${basedir}"> |
| 107 | + <include name="src/**/*.php" /> |
| 108 | + <include name="test/**/*.php" /> |
| 109 | + <modified /> |
| 110 | + </fileset> |
| 111 | + </apply> |
| 112 | + </target> |
| 113 | + |
| 114 | + <target name="build" depends="clean,phpunit,pdepend,phpmd,phpcpd,phpcs,phpdoc,phploc,phpcb,lint"/> |
| 115 | +</project> |
0 commit comments