|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | + |
| 3 | +<project name="php_lib" default="build"> |
| 4 | + <target name="build" depends="clean,prepare,lint,phploc,code_sniff,phpcpd,pdepend,doxygen,phpcb,test" /> |
| 5 | + |
| 6 | + <target name="clean" description="Cleanup build artifacts"> |
| 7 | + <delete dir="${basedir}/build/test" /> |
| 8 | + <delete dir="${basedir}/build/logs" /> |
| 9 | + <delete dir="${basedir}/build/pdepend" /> |
| 10 | + <delete dir="${basedir}/build/api" /> |
| 11 | + <delete dir="${basedir}/build/code-browser" /> |
| 12 | + </target> |
| 13 | + |
| 14 | + <target name="prepare" description="Prepares workspace for artifacts" > |
| 15 | + <mkdir dir="${basedir}/build/test" /> |
| 16 | + <mkdir dir="${basedir}/build/logs" /> |
| 17 | + <mkdir dir="${basedir}/build/pdepend" /> |
| 18 | + <mkdir dir="${basedir}/build/api" /> |
| 19 | + <mkdir dir="${basedir}/build/code-browser" /> |
| 20 | + </target> |
| 21 | + |
| 22 | + <target name="lint" description="Perform syntax check of sourcecode files"> |
| 23 | + <apply executable="php" failonerror="true"> |
| 24 | + <arg value="-l" /> |
| 25 | + |
| 26 | + <fileset dir="${basedir}"> |
| 27 | + <include name="**/*.php" /> |
| 28 | + <include name="**/*.inc" /> |
| 29 | + <include name="**/*.module" /> |
| 30 | + <include name="**/*.install" /> |
| 31 | + <include name="**/*.test" /> |
| 32 | + <modified /> |
| 33 | + </fileset> |
| 34 | + </apply> |
| 35 | + </target> |
| 36 | + |
| 37 | + <target name="phploc" description="Measure project size using PHPLOC"> |
| 38 | + <exec executable="phploc"> |
| 39 | + <arg line="--log-csv ${basedir}/build/logs/phploc.csv --exclude build --exclude xml --names *.php,*.module,*.inc,*.test ${basedir}" /> |
| 40 | + </exec> |
| 41 | + </target> |
| 42 | + |
| 43 | + <target name="code_sniff" description="Checks the code for Drupal coding standard violations" > |
| 44 | + <exec executable="phpcs"> |
| 45 | + <arg line="--standard=Drupal --report=checkstyle --report-file=${basedir}/build/logs/checkstyle.xml --extensions=php,inc,test,module,install --ignore=build/,js/,xml/,tests/ ${basedir}" /> |
| 46 | + </exec> |
| 47 | + </target> |
| 48 | + |
| 49 | + <target name="phpcpd" description="Copy/Paste code detection"> |
| 50 | + <exec executable="phpcpd"> |
| 51 | + <arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml --exclude build --exclude xml --names *.php,*.module,*.inc,*.test ${basedir}" /> |
| 52 | + </exec> |
| 53 | + </target> |
| 54 | + |
| 55 | + <target name="pdepend" description="Calculate software metrics using PHP_Depend"> |
| 56 | + <exec executable="pdepend"> |
| 57 | + <arg line="--jdepend-xml=${basedir}/build/logs/jdepend.xml --jdepend-chart=${basedir}/build/pdepend/dependencies.svg --overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg ${basedir}"/> |
| 58 | + </exec> |
| 59 | + </target> |
| 60 | + |
| 61 | + <target name="doxygen" description="Generate API documentation with doxygen" depends="prepare"> |
| 62 | + <exec executable="sed"> |
| 63 | + <arg line='-i "s|PROJECT_NUMBER =|PROJECT_NUMBER = ""`git log -1 --pretty=format:%h`""|" build/Doxyfile'/> |
| 64 | + </exec> |
| 65 | + <exec executable="doxygen"> |
| 66 | + <arg line="${basedir}/build/Doxyfile" /> |
| 67 | + </exec> |
| 68 | + <exec executable="git"> |
| 69 | + <arg line="checkout ${basedir}/build/Doxyfile"/> |
| 70 | + </exec> |
| 71 | + </target> |
| 72 | + |
| 73 | + <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser"> |
| 74 | + <exec executable="phpcb"> |
| 75 | + <arg line="--log ${basedir}/build/logs --source ${basedir} --output ${basedir}/build/code-browser"/> |
| 76 | + </exec> |
| 77 | + </target> |
| 78 | + |
| 79 | + <target name="test"> |
| 80 | + <exec executable="drush"> |
| 81 | + <arg line="test-run --xml=${basedir}/build/test 'PHP Lib'" /> |
| 82 | + </exec> |
| 83 | + </target> |
| 84 | + |
| 85 | +</project> |
0 commit comments