|
1 | | -<project name="php-code-coverage" default="build" basedir="."> |
2 | | - <target name="clean"> |
3 | | - <!-- Clean up --> |
4 | | - <delete dir="build"/> |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
5 | 2 |
|
6 | | - <!-- Create build directories --> |
| 3 | +<project name="PHP_CodeCoverage" default="build"> |
| 4 | + <target name="build" |
| 5 | + depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpunit,phpcb"/> |
| 6 | + |
| 7 | + <target name="build-parallel" |
| 8 | + depends="prepare,lint,tools-parallel,phpunit,phpcb"/> |
| 9 | + |
| 10 | + <target name="tools-parallel" |
| 11 | + description="Run tools in parallel"> |
| 12 | + <parallel threadCount="2"> |
| 13 | + <sequential> |
| 14 | + <antcall target="pdepend"/> |
| 15 | + <antcall target="phpmd-ci"/> |
| 16 | + </sequential> |
| 17 | + <antcall target="phpcpd"/> |
| 18 | + <antcall target="phpcs-ci"/> |
| 19 | + <antcall target="phploc"/> |
| 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,phpab" |
| 32 | + description="Prepare for build"> |
7 | 33 | <mkdir dir="${basedir}/build/api"/> |
8 | 34 | <mkdir dir="${basedir}/build/code-browser"/> |
9 | 35 | <mkdir dir="${basedir}/build/coverage"/> |
10 | 36 | <mkdir dir="${basedir}/build/logs"/> |
11 | 37 | <mkdir dir="${basedir}/build/pdepend"/> |
12 | 38 | </target> |
13 | 39 |
|
14 | | - <target name="phpab"> |
| 40 | + <target name="phpab" description="Generate autoloader scripts"> |
15 | 41 | <exec executable="phpab"> |
16 | | - <arg line='-o PHP/CodeCoverage/Autoload.php -c -t PHP/CodeCoverage/Autoload.php.in --indent " " PHP' /> |
| 42 | + <arg value="--output" /> |
| 43 | + <arg path="PHP/CodeCoverage/Autoload.php" /> |
| 44 | + <arg value="--compat" /> |
| 45 | + <arg value="--template" /> |
| 46 | + <arg path="PHP/CodeCoverage/Autoload.php.in" /> |
| 47 | + <arg value="--indent" /> |
| 48 | + <arg value=" " /> |
| 49 | + <arg path="PHP" /> |
17 | 50 | </exec> |
18 | 51 | </target> |
19 | 52 |
|
20 | | - <!-- Run unit tests and generate junit.xml and clover.xml --> |
21 | | - <target name="phpunit"> |
22 | | - <exec executable="phpunit" failonerror="true"/> |
| 53 | + <target name="lint"> |
| 54 | + <apply executable="php" failonerror="true"> |
| 55 | + <arg value="-l" /> |
| 56 | + |
| 57 | + <fileset dir="${basedir}/PHP"> |
| 58 | + <include name="**/*.php" /> |
| 59 | + </fileset> |
| 60 | + |
| 61 | + <fileset dir="${basedir}/Tests"> |
| 62 | + <include name="**/*.php" /> |
| 63 | + </fileset> |
| 64 | + </apply> |
23 | 65 | </target> |
24 | 66 |
|
25 | | - <!-- Run pdepend, phpmd, phpcpd, and phpcs in parallel --> |
26 | | - <target name="parallelTasks"> |
27 | | - <parallel> |
28 | | - <antcall target="pdepend"/> |
29 | | - <antcall target="phpmd"/> |
30 | | - <antcall target="phpcpd"/> |
31 | | - <antcall target="phpcs"/> |
32 | | - <antcall target="phpdoc"/> |
33 | | - </parallel> |
| 67 | + <target name="phploc" description="Measure project size using PHPLOC"> |
| 68 | + <exec executable="phploc"> |
| 69 | + <arg value="--log-csv" /> |
| 70 | + <arg value="${basedir}/build/logs/phploc.csv" /> |
| 71 | + <arg path="${basedir}/PHP" /> |
| 72 | + </exec> |
34 | 73 | </target> |
35 | 74 |
|
36 | | - <!-- Generate jdepend.xml and software metrics charts --> |
37 | | - <target name="pdepend"> |
| 75 | + <target name="pdepend" |
| 76 | + description="Calculate software metrics using PHP_Depend"> |
38 | 77 | <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 | | - PHP" /> |
| 78 | + <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" /> |
| 79 | + <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" /> |
| 80 | + <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" /> |
| 81 | + <arg path="${basedir}/PHP" /> |
43 | 82 | </exec> |
44 | 83 | </target> |
45 | 84 |
|
46 | | - <!-- Generate pmd.xml --> |
47 | | - <target name="phpmd"> |
| 85 | + <target name="phpmd" |
| 86 | + description="Perform project mess detection using PHPMD"> |
48 | 87 | <exec executable="phpmd"> |
49 | | - <arg line="PHP xml codesize,design,naming,unusedcode --reportfile ${basedir}/build/logs/pmd.xml" /> |
| 88 | + <arg path="${basedir}/PHP" /> |
| 89 | + <arg value="text" /> |
| 90 | + <arg value="${basedir}/build/phpmd.xml" /> |
50 | 91 | </exec> |
51 | 92 | </target> |
52 | 93 |
|
53 | | - <!-- Generate pmd-cpd.xml --> |
54 | | - <target name="phpcpd"> |
55 | | - <exec executable="phpcpd"> |
56 | | - <arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml PHP" /> |
| 94 | + <target name="phpmd-ci" |
| 95 | + description="Perform project mess detection using PHPMD"> |
| 96 | + <exec executable="phpmd"> |
| 97 | + <arg path="${basedir}/PHP" /> |
| 98 | + <arg value="xml" /> |
| 99 | + <arg value="${basedir}/build/phpmd.xml" /> |
| 100 | + <arg value="--reportfile" /> |
| 101 | + <arg value="${basedir}/build/logs/pmd.xml" /> |
| 102 | + </exec> |
| 103 | + </target> |
| 104 | + |
| 105 | + <target name="phpcs" |
| 106 | + description="Find coding standard violations using PHP_CodeSniffer"> |
| 107 | + <exec executable="phpcs"> |
| 108 | + <arg value="--standard=${basedir}/build/phpcs.xml" /> |
| 109 | + <arg value="--extensions=php" /> |
| 110 | + <arg value="--ignore=Autoload.php" /> |
| 111 | + <arg path="${basedir}/PHP" /> |
57 | 112 | </exec> |
58 | 113 | </target> |
59 | 114 |
|
60 | | - <!-- Generate checkstyle.xml --> |
61 | | - <target name="phpcs"> |
| 115 | + <target name="phpcs-ci" |
| 116 | + description="Find coding standard violations using PHP_CodeSniffer"> |
62 | 117 | <exec executable="phpcs" output="/dev/null"> |
63 | | - <arg line="--report=checkstyle |
64 | | - --report-file=${basedir}/build/logs/checkstyle.xml |
65 | | - --standard=Sebastian |
66 | | - --extensions=php |
67 | | - PHP" /> |
| 118 | + <arg value="--report=checkstyle" /> |
| 119 | + <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" /> |
| 120 | + <arg value="--standard=${basedir}/build/phpcs.xml" /> |
| 121 | + <arg value="--extensions=php" /> |
| 122 | + <arg value="--ignore=Autoload.php" /> |
| 123 | + <arg path="${basedir}/PHP" /> |
68 | 124 | </exec> |
69 | 125 | </target> |
70 | 126 |
|
71 | | - <!-- Generate API documentation --> |
72 | | - <target name="phpdoc"> |
73 | | - <exec executable="phpdoc"> |
74 | | - <arg line="-d PHP -t build/api" /> |
| 127 | + <target name="phpcpd" description="Find duplicate code using PHPCPD"> |
| 128 | + <exec executable="phpcpd"> |
| 129 | + <arg value="--log-pmd" /> |
| 130 | + <arg value="${basedir}/build/logs/pmd-cpd.xml" /> |
| 131 | + <arg path="${basedir}/PHP" /> |
75 | 132 | </exec> |
76 | 133 | </target> |
77 | 134 |
|
78 | | - <target name="phpcb"> |
| 135 | + <target name="phpunit" description="Run unit tests with PHPUnit"> |
| 136 | + <exec executable="phpunit" failonerror="true"/> |
| 137 | + </target> |
| 138 | + |
| 139 | + <target name="phpcb" |
| 140 | + description="Aggregate tool output with PHP_CodeBrowser"> |
79 | 141 | <exec executable="phpcb"> |
80 | | - <arg line="--log ${basedir}/build/logs |
81 | | - --source ${basedir}/PHP |
82 | | - --output ${basedir}/build/code-browser" /> |
| 142 | + <arg value="--log" /> |
| 143 | + <arg path="${basedir}/build/logs" /> |
| 144 | + <arg value="--source" /> |
| 145 | + <arg path="${basedir}/PHP" /> |
| 146 | + <arg value="--output" /> |
| 147 | + <arg path="${basedir}/build/code-browser" /> |
83 | 148 | </exec> |
84 | 149 | </target> |
85 | | - |
86 | | - <target name="build" depends="clean,parallelTasks,phpunit,phpcb"/> |
87 | 150 | </project> |
0 commit comments