forked from dittertp/Puzzle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
82 lines (71 loc) · 3.56 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?xml version="1.0"?>
<project name="Puzzle" default="deploy" basedir=".">
<property file="${basedir}/build.properties"/>
<property file="${basedir}/build.default.properties"/>
<property environment="env" />
<property name="php-src.dir" value="${basedir}/src" />
<property name="php-test.dir" value="${basedir}/tests" />
<property name="php-target.dir" value="${basedir}/target"/>
<property name="codepool" value="vendor"/>
<property name="vendor.dir" value="${basedir}/${codepool}" />
<property name="phpmd.file" value="${basedir}/phpmd.xml" />
<target name="clean" description="Cleans almost everything, so use carefully.">
<delete dir="${php-target.dir}" includeemptydirs="true" quiet="false" verbose="true" failonerror="true"/>
</target>
<target name="prepare" description="Prepares the directory to temporarily store generated artefacts.">
<!-- clean the build environment -->
<antcall target="clean" />
<!-- create the default build environment folders -->
<mkdir dir="${php-target.dir}" />
<mkdir dir="${php-target.dir}/reports" />
</target>
<target name="composer-update" description="Updates composer dependencies defined in composer.json">
<exec dir="${basedir}" executable="composer">
<arg line="--no-interaction update"/>
</exec>
</target>
<target name="phpcs" description="Runs the code sniffer and generates a report.">
<exec executable="${vendor.dir}/bin/phpcs" dir="${basedir}" failonerror="true">
<!-- call phpcs without report-file to get error message on build console -->
<arg line="-n --extensions=php --standard=phpcs.xml ./"/>
</exec>
</target>
<target name="phpcpd" description="Runs the copy and paste detection.">
<exec executable="${vendor.dir}/bin/phpcpd" dir="${basedir}" failonerror="true">
<arg line="--log-pmd ${php-target.dir}/reports/pmd-cpd.xml --exclude vendor ${php-src.dir}"/>
</exec>
</target>
<target name="phploc" description="Generate phploc.csv">
<exec executable="${vendor.dir}/bin/phploc" dir="${basedir}" failonerror="true">
<arg line="--log-xml ${php-target.dir}/reports/phploc.xml ${php-src.dir}"/>
</exec>
</target>
<target name="phplint" description="Runs a PHP lint syntax check on the PHP source files.">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${php-src.dir}">
<include name="**/*.php" />
<exclude name="vendor/**" />
</fileset>
</apply>
</target>
<target name="phpmd" description="Runs the PHP Mess detector tool.">
<exec executable="${vendor.dir}/bin/phpmd" dir="${basedir}" failonerror="false">
<arg line="${php-src.dir} xml ${phpmd.file} --reportfile ${php-target.dir}/reports/pmd.xml" />
</exec>
</target>
<target name="run-tests" description="Runs the PHPUnit tests on Travis-CI and generates a report.">
<exec executable="${vendor.dir}/bin/phpunit" dir="${basedir}" failonerror="true">
<arg line="--bootstrap bootstrap.php --configuration phpunit.xml" />
</exec>
</target>
<target name="run-all-tests" description="runs all tests">
<antcall target="prepare" />
<antcall target="phpcs" />
<antcall target="run-tests" />
<antcall target="phpcpd" />
<antcall target="phplint" />
<antcall target="phpmd" />
<antcall target="phploc" />
</target>
</project>