-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.xml
110 lines (92 loc) · 3.76 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?xml version="1.0" encoding="UTF-8"?>
<project name="Zuora REST PHP Client" default="build">
<property name="builddir" value="${basedir}/build"/>
<property name="composer" value="${builddir}/composer.phar"/>
<target name="build" depends="lint,composer,pdepend,phpmd-ci,phpcpd,phpunit"/>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${builddir}"/>
</target>
<target name="clean-src" description="Cleanup dependency source code">
<delete file="${basedir}/composer.lock"/>
<delete dir="${basedir}/vendor"/>
</target>
<target name="clean-all" depends="clean,clean-src" description="Cleanup build artifacts and dependency source code"/>
<target name="php-check">
<condition property="php" value="php">
<not>
<isset property="${php}"/>
</not>
</condition>
</target>
<target name="prepare">
<mkdir dir="${builddir}/coverage"/>
<mkdir dir="${builddir}/logs"/>
<mkdir dir="${builddir}/pdepend"/>
<mkdir dir="${builddir}/test"/>
</target>
<target name="lint" depends="php-check" description="Perform syntax check of source code files">
<apply executable="${php}" failonerror="true">
<arg value="-l" />
<fileset dir="${basedir}/src">
<include name="**/*.php" />
</fileset>
<fileset dir="${basedir}/test">
<include name="**/*.php" />
</fileset>
</apply>
</target>
<target name="composer-check" depends="prepare">
<available file="${composer}" property="composer.present"/>
</target>
<target name="composer-download" depends="composer-check" unless="composer.present">
<property name="composer.noselfupdate" value="true"/>
<get src="https://getcomposer.org/composer.phar" dest="${composer}"/>
</target>
<target name="composer-selfupdate" depends="php-check,composer-download" unless="composer.noselfupdate">
<exec executable="${php}">
<arg value="${composer}"/>
<arg value="self-update"/>
<arg value="--quiet"/>
</exec>
</target>
<target name="composer" depends="composer-selfupdate" unless="composer.noupdate" description="Run composer update">
<exec executable="${php}">
<arg value="${composer}"/>
<arg value="update"/>
</exec>
</target>
<target name="pdepend" depends="composer" description="Calculate software metrics using PHP_Depend">
<exec executable="${basedir}/vendor/bin/pdepend">
<arg value="--jdepend-xml=${builddir}/logs/jdepend.xml" />
<arg value="--jdepend-chart=${builddir}/pdepend/dependencies.svg" />
<arg value="--overview-pyramid=${builddir}/pdepend/overview-pyramid.svg" />
<arg path="${basedir}/src" />
</exec>
</target>
<target name="phpmd" description="Perform mess detection using PHPMD, print human readable output.">
<exec executable="${basedir}/vendor/bin/phpmd">
<arg path="${basedir}/src" />
<arg value="text" />
<arg value="${basedir}/phpmd.xml" />
</exec>
</target>
<target name="phpmd-ci" description="Perform mess detection using PHPMD, creating a log file for the CI server">
<exec executable="${basedir}/vendor/bin/phpmd">
<arg path="${basedir}/src" />
<arg value="xml" />
<arg value="${basedir}/phpmd.xml" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
</exec>
</target>
<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="${basedir}/vendor/bin/phpcpd">
<arg value="--log-pmd" />
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
<arg path="${basedir}/src" />
</exec>
</target>
<target name="phpunit" depends="composer" description="Run unit tests with PHPUnit">
<exec executable="${basedir}/vendor/bin/phpunit" failonerror="true"/>
</target>
</project>