-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
227 lines (206 loc) · 7.55 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?xml version="1.0" ?>
<project name="florianajir/rabbitmq-sql-bundle" basedir="./" default="help">
<property name="builddir" value="build"/>
<target name="help">
<echo>help Shows this help</echo>
<echo>tests Run tests for development</echo>
<echo>ci Run tests for continous integration</echo>
<echo>lint Linter</echo>
<echo>phpunit Executes phpunit tests</echo>
<echo>coverage Show phpunit coverage</echo>
<echo>phpcs Detects standard violations on the code</echo>
<echo>phpmd Look for several potential problems</echo>
<echo>phpcpd Detects duplicate code portions</echo>
<echo>phpmetrics PhpMetrics provides various metrics about PHP projects</echo>
<echo>phploc Measure the size and analyze the structure</echo>
<echo>install-requirements Install requirements for build</echo>
</target>
<target name="tests" description="Run tests for development">
<phingcall target="lint"/>
<phingcall target="phpunit"/>
<phingcall target="phpcs"/>
<phingcall target="phpmd"/>
<phingcall target="phpcpd"/>
<phingcall target="phpmetrics"/>
<phingcall target="phploc"/>
</target>
<target name="ci"
depends="ci:cleanup,ci:composer"
description="Run tests for continous integration">
<phingcall target="ci:lint"/>
<phingcall target="ci:phpunit"/>
<phingcall target="ci:phpcs"/>
<phingcall target="ci:phpmd"/>
<phingcall target="ci:phpcpd"/>
<phingcall target="ci:pdepend"/>
<phingcall target="ci:phpmetrics"/>
<phingcall target="ci:phploc"/>
</target>
<target name="ci:cleanup" description="Clean ci build files">
<delete dir="${builddir}"/>
<mkdir dir="${builddir}"/>
<mkdir dir="${builddir}/reports"/>
<mkdir dir="${builddir}/reports/coverage"/>
</target>
<target name="ci:composer" description="Install composer dependencies">
<exec command="composer install" logoutput="true"/>
</target>
<target name="install-requirements" description="Install requirements for build">
<exec command="composer global require 'phpunit/phpunit=4.*'"/>
<exec command="composer global require 'squizlabs/php_codesniffer=1.*'"/>
<exec command="composer global require 'sebastian/phpcpd=2.*'"/>
<exec command="composer global require 'phpmd/phpmd=@stable'"/>
<exec command="composer global require 'pdepend/pdepend=2.*'"/>
<exec command="composer global require 'halleck45/phpmetrics=^1.3'"/>
<exec command="composer global require 'phploc/phploc=*'"/>
<echo message="Don't forget to add composer bin folder to your $PATH environement variable"/>
</target>
<target name="lint" description="Execute linter for development">
<phplint interpreter="php"
deprecatedAsError="true"
level="debug">
<fileset dir=".">
<include name="**/*.php"/>
<exclude name="vendor/"/>
<exclude name=".*/"/>
</fileset>
</phplint>
</target>
<target name="ci:lint" description="Execute linter for continous integration">
<phplint interpreter="php"
haltonfailure="true"
tofile="${builddir}/reports/phplint.txt"
deprecatedAsError="true"
level="debug">
<fileset dir=".">
<include name="**/*.php"/>
<exclude name="vendor/"/>
<exclude name=".*/"/>
</fileset>
</phplint>
</target>
<target name="phpunit" description="Execute unit tests for development">
<exec executable="phpunit" logoutput="true"/>
</target>
<target name="ci:phpunit" description="Execute unit tests for continous integration">
<exec executable="phpunit" logoutput="true">
<arg value="-c"/>
<arg path="phpunit.xml.dist"/>
<arg value="--log-junit"/>
<arg path="${builddir}/reports/phpunit.xml"/>
<arg value="--coverage-clover"/>
<arg path="${builddir}/reports/coverage.xml"/>
<arg value="--coverage-html"/>
<arg path="${builddir}/reports/coverage/"/>
</exec>
</target>
<target name="coverage" description="Show phpunit coverage">
<exec executable="bin/phpunit" logoutput="true">
<arg value="--coverage-text"/>
</exec>
</target>
<target name="phpcs" description="Detects standard violations on the code">
<phpcodesniffer standard="PSR2">
<fileset dir="./">
<include name="**/*.php"/>
<exclude name="vendor/"/>
<exclude name=".*/"/>
</fileset>
</phpcodesniffer>
</target>
<target name="ci:phpcs" description="Detects standard violations on the code and generate report">
<phpcodesniffer standard="PSR2">
<fileset dir="./">
<include name="**/*.php"/>
<exclude name="vendor/"/>
<exclude name=".*/"/>
</fileset>
<formatter type="checkstyle"
outfile="${builddir}/reports/checkstyle.xml"/>
</phpcodesniffer>
</target>
<target name="phpmd" description="Look for several potential problems">
<phpmd>
<fileset dir=".">
<exclude name="vendor/"/>
<exclude name=".*/"/>
</fileset>
</phpmd>
</target>
<target name="ci:phpmd" description="Look for several potential problems">
<phpmd>
<fileset dir=".">
<exclude name="vendor/"/>
<exclude name=".*/"/>
</fileset>
<formatter type="xml" outfile="${builddir}/reports/pmd.xml"/>
</phpmd>
</target>
<target name="phpcpd" description="Detects duplicated code">
<phpcpd>
<fileset dir=".">
<exclude name="vendor/"/>
<exclude name=".*/"/>
<include name="**/*.php"/>
</fileset>
</phpcpd>
</target>
<target name="ci:phpcpd" description="Detects duplicated code and generate report">
<phpcpd>
<fileset dir=".">
<exclude name="vendor/"/>
<exclude name=".*/"/>
<include name="**/*.php"/>
</fileset>
<formatter type="pmd" outfile="${builddir}/reports/cpd.xml"/>
</phpcpd>
</target>
<target name="ci:pdepend"
description="Shows the quality design in the terms of extensibility, reusability and maintainability">
<phpdepend>
<fileset dir="./">
<exclude name="vendor/"/>
<exclude name=".*/"/>
<include name="**/*.php"/>
</fileset>
<logger type="jdepend-xml" outfile="${builddir}/reports/pdepend.xml"/>
</phpdepend>
</target>
<target name="phpmetrics" description="Generate project global quality report with PHPMetrics">
<exec executable="phpmetrics" logoutput="true">
<arg value="--report-cli"/>
<arg value="./"/>
</exec>
</target>
<target name="ci:phpmetrics" description="Generate project global quality report with PHPMetrics">
<exec executable="phpmetrics" logoutput="true">
<arg value="--report-xml=${builddir}/reports/phpmetrics.xml"/>
<arg value="--report-html=${builddir}/reports/phpmetrics.html"/>
<arg value="./"/>
</exec>
</target>
<target name="phploc" description="Measure the size and analyze the structuret">
<phploc countTests="true">
<fileset dir=".">
<include name="**/*.php"/>
<include name="*.php"/>
<exclude name="vendor/"/>
<exclude name=".*/"/>
</fileset>
</phploc>
</target>
<target name="ci:phploc" description="Measure the size and analyze the structure with report">
<phploc
countTests="true"
reportType="csv"
reportDirectory="${builddir}/reports"
reportName="phploc">
<fileset dir=".">
<include name="**/*.php"/>
<include name="*.php"/>
<exclude name="vendor/"/>
<exclude name=".*/"/>
</fileset>
</phploc>
</target>
</project>