1<?xml version="1.0" encoding="UTF-8"?>
2<project name="OpenCart" default="build" basedir=".">
3    <property name="source" value="upload"/>
4
5    <target name="clean" description="Cleanup build artifacts">
6        <delete dir="${basedir}/tests/docs"/>
7        <delete dir="${basedir}/tests/logs"/>
8        <delete dir="${basedir}/tests/testresults"/>
9    </target>
10
11    <target name="prepare" depends="clean" description="Prepare for build">
12        <mkdir dir="${basedir}/tests/docs"/>
13        <mkdir dir="${basedir}/tests/logs"/>
14        <mkdir dir="${basedir}/tests/testresults"/>
15    </target>
16
17    <target name="lint" description="Perform syntax check of source code files">
18        <apply executable="php" failonerror="true">
19            <arg value="-l"/>
20            <fileset dir="${basedir}/upload">
21                <include name="**/*.php"/>
22                <modified/>
23            </fileset>
24        </apply>
25    </target>
26
27    <target name="csslint" description="Run the CSSLint tool on CSS files">
28        <fileset dir="${basedir}/upload" id="cssfiles.raw">
29            <include name="**/*.css" />
30        </fileset>
31        <pathconvert pathsep=" " property="cssfiles.clean" refid="cssfiles.raw" />
32        <exec executable="csslint" output="${basedir}/tests/csslint.xml">
33            <arg line="--warnings=box-model,floats --errors=ids,important --format=lint-xml ${cssfiles.clean}" />
34        </exec>
35    </target>
36
37    <target name="phploc" description="Measure project size using PHPLOC">
38        <exec executable="phploc">
39            <arg value="--log-csv"/>
40            <arg value="${basedir}/tests/logs/phploc.csv"/>
41            <arg path="${basedir}/upload"/>
42        </exec>
43    </target>
44
45    <target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer">
46        <exec executable="phpcs">
47            <arg line="--report=checkstyle --report-file=${basedir}/tests/checkstyle.xml --standard=tests/phpcs/OpenCart/ruleset.xml --extensions=php ${source}/"/>
48        </exec>
49    </target>
50
51    <target name="build" depends="prepare,phpcs,lint,phploc,csslint"/>
52</project>