|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | + |
| 3 | +<project name="Colourbox SSP cassrver module" default="build"> |
| 4 | + <target name="build" |
| 5 | + depends="prepare,lint,phploc-ci,pdepend,phpmd-ci,phpcs-ci,phpcpd-ci,phpunit,phpcb,securitycheck,phpdox"/> |
| 6 | + |
| 7 | + <target name="build-parallel" |
| 8 | + depends="prepare,lint,tools-parallel,phpunit,phpcb,phpdox"/> |
| 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-ci"/> |
| 17 | + <antcall target="phpcs-ci"/> |
| 18 | + <antcall target="phploc-ci"/> |
| 19 | + <antcall target="securitycheck"/> |
| 20 | + </parallel> |
| 21 | + </target> |
| 22 | + |
| 23 | + <target name="clean" |
| 24 | + unless="clean.done" |
| 25 | + description="Cleanup build artifacts"> |
| 26 | + <delete dir="${basedir}/build/api"/> |
| 27 | + <delete dir="${basedir}/build/code-browser"/> |
| 28 | + <delete dir="${basedir}/build/coverage"/> |
| 29 | + <delete dir="${basedir}/build/logs"/> |
| 30 | + <delete dir="${basedir}/build/pdepend"/> |
| 31 | + <delete dir="${basedir}/build/phpdox"/> |
| 32 | + <delete dir="${basedir}/build/docs"/> |
| 33 | + <property name="clean.done" value="true"/> |
| 34 | + </target> |
| 35 | + |
| 36 | + <target name="prepare" |
| 37 | + unless="prepare.done" |
| 38 | + depends="clean" |
| 39 | + description="Prepare for build"> |
| 40 | + <mkdir dir="${basedir}/build/api"/> |
| 41 | + <mkdir dir="${basedir}/build/code-browser"/> |
| 42 | + <mkdir dir="${basedir}/build/coverage"/> |
| 43 | + <mkdir dir="${basedir}/build/logs"/> |
| 44 | + <mkdir dir="${basedir}/build/pdepend"/> |
| 45 | + <mkdir dir="${basedir}/vendor"/> |
| 46 | + <antcall target="init"/> |
| 47 | + <property name="prepare.done" value="true"/> |
| 48 | + </target> |
| 49 | + |
| 50 | + <target name="init" description="Do needed stuff before build"> |
| 51 | + <antcall target="composerselfupdate" /> |
| 52 | + <antcall target="composerinstall" /> |
| 53 | + </target> |
| 54 | + |
| 55 | + <target name="composerinstall" description="Run composer install"> |
| 56 | + <exec executable="${basedir}/bin/composer.phar" failonerror="true"> |
| 57 | + <arg value="install" /> |
| 58 | + </exec> |
| 59 | + </target> |
| 60 | + |
| 61 | + <target name="composerselfupdate" description="Run composer self-update"> |
| 62 | + <exec executable="${basedir}/bin/composer.phar" failonerror="true"> |
| 63 | + <arg value="self-update" /> |
| 64 | + </exec> |
| 65 | + </target> |
| 66 | + |
| 67 | + <target name="lint" description="Perform syntax check of sourcecode files"> |
| 68 | + <apply executable="php" failonerror="true"> |
| 69 | + <arg value="-l" /> |
| 70 | + |
| 71 | + <fileset dir="${basedir}/lib"> |
| 72 | + <include name="**/*.php" /> |
| 73 | + <modified /> |
| 74 | + </fileset> |
| 75 | + |
| 76 | + <fileset dir="${basedir}/test"> |
| 77 | + <include name="**/*.php" /> |
| 78 | + <modified /> |
| 79 | + </fileset> |
| 80 | + </apply> |
| 81 | + </target> |
| 82 | + |
| 83 | + <target name="phploc" |
| 84 | + description="Measure project size using PHPLOC and print human readable output. Intended for usage on the command line."> |
| 85 | + <exec executable="${basedir}/vendor/bin/phploc"> |
| 86 | + <arg value="--count-tests" /> |
| 87 | + <arg path="${basedir}/lib" /> |
| 88 | + <arg path="${basedir}/test" /> |
| 89 | + </exec> |
| 90 | + </target> |
| 91 | + |
| 92 | + <target name="phploc-ci" |
| 93 | + depends="prepare" |
| 94 | + description="Measure project size using PHPLOC and log result in CSV and XML format. Intended for usage within a continuous integration environment."> |
| 95 | + <exec executable="${basedir}/vendor/bin/phploc"> |
| 96 | + <arg value="--count-tests" /> |
| 97 | + <arg value="--log-csv" /> |
| 98 | + <arg path="${basedir}/build/logs/phploc.csv" /> |
| 99 | + <arg value="--log-xml" /> |
| 100 | + <arg path="${basedir}/build/logs/phploc.xml" /> |
| 101 | + <arg path="${basedir}/lib" /> |
| 102 | + <arg path="${basedir}/test" /> |
| 103 | + </exec> |
| 104 | + </target> |
| 105 | + |
| 106 | + <target name="pdepend" |
| 107 | + depends="prepare" |
| 108 | + description="Calculate software metrics using PHP_Depend and log result in XML format. Intended for usage within a continuous integration environment."> |
| 109 | + <exec executable="${basedir}/vendor/bin/pdepend"> |
| 110 | + <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" /> |
| 111 | + <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" /> |
| 112 | + <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" /> |
| 113 | + <arg path="${basedir}/lib" /> |
| 114 | + </exec> |
| 115 | + </target> |
| 116 | + |
| 117 | + <target name="phpmd" |
| 118 | + description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing."> |
| 119 | + <exec executable="${basedir}/vendor/bin/phpmd"> |
| 120 | + <arg path="${basedir}/lib" /> |
| 121 | + <arg value="text" /> |
| 122 | + <arg path="${basedir}/build/phpmd.xml" /> |
| 123 | + </exec> |
| 124 | + </target> |
| 125 | + |
| 126 | + <target name="phpmd-ci" |
| 127 | + depends="prepare" |
| 128 | + description="Perform project mess detection using PHPMD and log result in XML format. Intended for usage within a continuous integration environment."> |
| 129 | + <exec executable="${basedir}/vendor/bin/phpmd"> |
| 130 | + <arg path="${basedir}/lib" /> |
| 131 | + <arg value="xml" /> |
| 132 | + <arg path="${basedir}/build/phpmd.xml" /> |
| 133 | + <arg value="--reportfile" /> |
| 134 | + <arg path="${basedir}/build/logs/pmd.xml" /> |
| 135 | + </exec> |
| 136 | + </target> |
| 137 | + |
| 138 | + <target name="phpcs" |
| 139 | + description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing."> |
| 140 | + <exec executable="${basedir}/vendor/bin/phpcs" failonerror="true"> |
| 141 | + <arg value="--standard=${basedir}/build/phpcs.xml" /> |
| 142 | + <arg value="--extensions=php" /> |
| 143 | + <arg value="-s" /> |
| 144 | + <arg value="--ignore=autoload.php" /> |
| 145 | + <arg path="${basedir}/lib" /> |
| 146 | + </exec> |
| 147 | + </target> |
| 148 | + |
| 149 | + <target name="phpcs-ci" |
| 150 | + depends="prepare" |
| 151 | + description="Find coding standard violations using PHP_CodeSniffer and log result in XML format. Intended for usage within a continuous integration environment."> |
| 152 | + <exec executable="${basedir}/vendor/bin/phpcs" failonerror="true" output="/dev/null"> |
| 153 | + <arg value="--report=checkstyle" /> |
| 154 | + <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" /> |
| 155 | + <arg value="--standard=${basedir}/build/phpcs.xml" /> |
| 156 | + <arg value="--extensions=php" /> |
| 157 | + <arg value="--ignore=autoload.php" /> |
| 158 | + <arg path="${basedir}/lib" /> |
| 159 | + </exec> |
| 160 | + </target> |
| 161 | + |
| 162 | + <target name="phpcpd" |
| 163 | + description="Find duplicate code using PHPCPD and print human readable output. Intended for usage on the command line before committing."> |
| 164 | + <exec executable="${basedir}/vendor/bin/phpcpd"> |
| 165 | + <arg path="${basedir}/lib" /> |
| 166 | + </exec> |
| 167 | + </target> |
| 168 | + |
| 169 | + <target name="phpcpd-ci" |
| 170 | + depends="prepare" |
| 171 | + description="Find duplicate code using PHPCPD and log result in XML format. Intended for usage within a continuous integration environment."> |
| 172 | + <exec executable="${basedir}/vendor/bin/phpcpd"> |
| 173 | + <arg value="--log-pmd" /> |
| 174 | + <arg path="${basedir}/build/logs/pmd-cpd.xml" /> |
| 175 | + <arg path="${basedir}/lib" /> |
| 176 | + </exec> |
| 177 | + </target> |
| 178 | + |
| 179 | + <target name="phpunit" |
| 180 | + depends="prepare" |
| 181 | + description="Run unit tests with PHPUnit"> |
| 182 | + <exec executable="${basedir}/vendor/bin/phpunit" failonerror="true" /> |
| 183 | + </target> |
| 184 | + |
| 185 | + <target name="phpcb" |
| 186 | + depends="prepare" |
| 187 | + description="Aggregate tool output with PHP_CodeBrowser"> |
| 188 | + <exec executable="${basedir}/vendor/bin/phpcb"> |
| 189 | + <arg value="--log" /> |
| 190 | + <arg path="${basedir}/build/logs" /> |
| 191 | + <arg value="--source" /> |
| 192 | + <arg path="${basedir}/lib" /> |
| 193 | + <arg value="--output" /> |
| 194 | + <arg path="${basedir}/build/code-browser" /> |
| 195 | + </exec> |
| 196 | + </target> |
| 197 | + |
| 198 | + <target name="securitycheck" |
| 199 | + depends="prepare" |
| 200 | + description="SensioLabs Security Checker"> |
| 201 | + <exec executable="${basedir}/vendor/bin/security-checker" failonerror="true"> |
| 202 | + <arg value="security:check" /> |
| 203 | + <arg path="${basedir}/composer.lock" /> |
| 204 | + </exec> |
| 205 | + </target> |
| 206 | + |
| 207 | + <target name="phpdox" |
| 208 | + depends="phpunit,phploc-ci,phpcs-ci,phpmd-ci" |
| 209 | + description="Generate project documentation using phpDox"> |
| 210 | + <exec executable="${basedir}/vendor/bin/phpdox"/> |
| 211 | + </target> |
| 212 | +</project> |
0 commit comments