|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | + |
| 3 | +<project name="joomla-tracker" default="build" basedir="."> |
| 4 | + <property name="source" value="src" /> |
| 5 | + <property name="cli" value="cli" /> |
| 6 | + <property name="joomlasource" value="cli,src" /> |
| 7 | + <property name="testsource" value="" /> |
| 8 | + |
| 9 | + <condition property="script-suffix" value=".bat" else=""> |
| 10 | + <os family="windows" /> |
| 11 | + </condition> |
| 12 | + |
| 13 | + <condition property="script-null" value="NUL" else="/dev/null"> |
| 14 | + <os family="windows" /> |
| 15 | + </condition> |
| 16 | + |
| 17 | + <target name="clean" description="Clean up and create artifact directories"> |
| 18 | + <delete dir="${basedir}/build/api" /> |
| 19 | + <delete dir="${basedir}/build/coverage" /> |
| 20 | + <delete dir="${basedir}/build/logs" /> |
| 21 | + <delete dir="${basedir}/build/pdepend" /> |
| 22 | + <delete dir="${basedir}/htmlreports/API_Documentation" /> |
| 23 | + |
| 24 | + <mkdir dir="${basedir}/build/api" /> |
| 25 | + <mkdir dir="${basedir}/build/coverage" /> |
| 26 | + <mkdir dir="${basedir}/build/logs" /> |
| 27 | + <mkdir dir="${basedir}/build/pdepend" /> |
| 28 | + <mkdir dir="${basedir}/htmlreports/API_Documentation" /> |
| 29 | + </target> |
| 30 | + |
| 31 | + <target name="installdep" description="Install build dependencies using composer"> |
| 32 | + <exec executable="composer"> |
| 33 | + <arg value="update" /> |
| 34 | + <arg value="--dev" /> |
| 35 | + </exec> |
| 36 | + </target> |
| 37 | + |
| 38 | + <target name="parallelTasks" description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads."> |
| 39 | + <parallel threadCount="2"> |
| 40 | + <sequential> |
| 41 | + <antcall target="pdepend" /> |
| 42 | + <antcall target="phpmd" /> |
| 43 | + </sequential> |
| 44 | + <antcall target="phpcpd" /> |
| 45 | + <antcall target="phpcs" /> |
| 46 | + <antcall target="phploc" /> |
| 47 | + </parallel> |
| 48 | + </target> |
| 49 | + |
| 50 | + <target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend"> |
| 51 | + <exec executable="pdepend${script-suffix}"> |
| 52 | + <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" /> |
| 53 | + <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" /> |
| 54 | + <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" /> |
| 55 | + <arg path="${source}" /> |
| 56 | + </exec> |
| 57 | + </target> |
| 58 | + |
| 59 | + <target name="phpmd" description="Generate pmd.xml using PHPMD"> |
| 60 | + <exec executable="phpmd${script-suffix}"> |
| 61 | + <arg path="${joomlasource}" /> |
| 62 | + <arg value="xml" /> |
| 63 | + <arg value="${basedir}/build/phpmd.xml" /> |
| 64 | + <arg value="--reportfile" /> |
| 65 | + <arg value="${basedir}/build/logs/pmd.xml" /> |
| 66 | + </exec> |
| 67 | + </target> |
| 68 | + |
| 69 | + <target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer"> |
| 70 | + <exec executable="phpcs${script-suffix}"> |
| 71 | + <arg value="--report=checkstyle" /> |
| 72 | + <arg value="--extensions=php" /> |
| 73 | + <arg value="-p" /> |
| 74 | + <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" /> |
| 75 | + <arg value="--standard=${basedir}/build/phpcs/Joomla" /> |
| 76 | + <!-- |
| 77 | + <arg value="- -ignore=${basedir}/build,${basedir}/etc,${basedir}/language,${basedir}/platformApp,${basedir}/vendor,${basedir}/www,${basedir}/*tmpl/*" /> |
| 78 | + --> |
| 79 | + <arg value="--ignore=${basedir}/*tmpl/*" /> |
| 80 | + <arg path="${source}" /> |
| 81 | + <arg path="${cli}" /> |
| 82 | + </exec> |
| 83 | + </target> |
| 84 | + |
| 85 | + <target name="lint" description="Perform syntax check of sourcecode files"> |
| 86 | + <apply executable="php" failonerror="true"> |
| 87 | + <arg value="-l" /> |
| 88 | + |
| 89 | + <fileset dir="src"> |
| 90 | + <include name="**/*.php" /> |
| 91 | + <modified /> |
| 92 | + </fileset> |
| 93 | + <fileset dir="cli"> |
| 94 | + <include name="**/*.php" /> |
| 95 | + <modified /> |
| 96 | + </fileset> |
| 97 | + </apply> |
| 98 | + </target> |
| 99 | + |
| 100 | + <target name="composervalidate" description="Perform validation of composer.json files."> |
| 101 | + <exec executable="composer" failonerror="true"> |
| 102 | + <arg value="validate" /> |
| 103 | + </exec> |
| 104 | + |
| 105 | + <apply executable="composer" failonerror="true"> |
| 106 | + <arg value="validate" /> |
| 107 | + |
| 108 | + <fileset dir="${source}"> |
| 109 | + <include name="**/composer.json" /> |
| 110 | + <modified /> |
| 111 | + </fileset> |
| 112 | + </apply> |
| 113 | + </target> |
| 114 | + |
| 115 | + <target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml"> |
| 116 | + <exec executable="phpunit${script-suffix}"> |
| 117 | + <arg value="-c${basedir}/phpunit-jenkins.xml" /> |
| 118 | + </exec> |
| 119 | + </target> |
| 120 | + |
| 121 | + <target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD"> |
| 122 | + <exec executable="phpcpd${script-suffix}"> |
| 123 | + <arg value="--log-pmd" /> |
| 124 | + <arg value="${basedir}/build/logs/pmd-cpd.xml" /> |
| 125 | + <arg path="${source}" /> |
| 126 | + </exec> |
| 127 | + </target> |
| 128 | + |
| 129 | + <target name="phploc" description="Generate phploc.csv"> |
| 130 | + <exec executable="phploc${script-suffix}"> |
| 131 | + <arg value="--log-csv" /> |
| 132 | + <arg value="${basedir}/build/logs/phploc.csv" /> |
| 133 | + <arg path="${source}" /> |
| 134 | + </exec> |
| 135 | + </target> |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + <target name="build" depends="clean,phpunit,composervalidate,installdep,parallelTasks" /> |
| 140 | +</project> |
0 commit comments