forked from ruflin/Elastica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
232 lines (208 loc) · 7.72 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
228
229
230
231
232
<?xml version="1.0" encoding="UTF-8"?>
<project name="Elastica" default="build" basedir=".">
<property name="source" value="${basedir}/lib"/>
<target name="parallelTasks">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
<antcall target="phpmd-ci"/>
<antcall target="phpcb"/>
</sequential>
<antcall target="phpcpd"/>
<antcall target="phpcs-ci"/>
<antcall target="phpdoc-ci"/>
</parallel>
</target>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/code-browser"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/pdepend"/>
<delete dir="${basedir}/build/docs"/>
<delete file="${basedir}/cache.properties"/>
</target>
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/code-browser"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/docs"/>
<mkdir dir="${basedir}/build/pdepend"/>
</target>
<target name="install" description="installs and starts elasticsearch">
<exec executable="bash">
<arg value="-c" />
<arg value="curl -sS https://getcomposer.org/installer | php" />
</exec>
<exec executable="php">
<arg value="composer.phar" />
<arg value="self-update" />
</exec>
<exec executable="php">
<arg value="composer.phar" />
<arg value="--dev" />
<arg value="install" />
</exec>
<exec executable="bash">
<env key="ES_VER" value="1.3.0"/>
<env key="ES_MAPPER_ATTACHMENTS_VER" value="1.6.0"/>
<env key="ES_TRANSPORT_THRIFT_VER" value="1.4.0"/>
<arg value="test/bin/run_elasticsearch.sh"/>
</exec>
</target>
<target name="composer" depends="prepare" description="Install dependencies">
<exec executable="composer">
<arg value="--dev"></arg>
<arg value="install"></arg>
</exec>
</target>
<target name="lint">
<apply executable="php" failonerror="true">
<arg value="-lf"/>
<fileset dir="${source}">
<include name="**/*.php"/>
<modified/>
</fileset>
<fileset dir="${basedir}/test">
<include name="**/*.php"/>
<modified/>
</fileset>
</apply>
</target>
<target name="phpunit" depends="composer">
<exec executable="phpunit" dir="${basedir}/test" failonerror="off" />
</target>
<!-- Generate jdepend.xml and software metrics charts -->
<target name="pdepend">
<exec executable="pdepend">
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
<arg path="${source}" />
</exec>
</target>
<target name="phpmd-ci">
<exec executable="phpmd">
<arg path="${source}" />
<arg value="xml" />
<arg value="codesize,unusedcode,naming,design" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
</exec>
</target>
<!-- Generate pmd-cpd.xml -->
<target name="phpcpd">
<exec executable="phpcpd">
<arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml ${source}" />
</exec>
</target>
<!-- Generate checkstyle.xml -->
<target name="phpcs-ci">
<exec executable="phpcs" output="/dev/null">
<arg line="--report=checkstyle --report-file=${basedir}/build/logs/checkstyle.xml --standard=PSR2 ${source}" />
</exec>
</target>
<target name="phploc" description="Generate phploc.csv">
<exec executable="phploc">
<arg value="--log-csv" />
<arg value="${basedir}/build/logs/phploc.csv" />
<arg path="${source}" />
</exec>
</target>
<!-- Generate API documentation -->
<target name="phpdoc">
<exec executable="phpdoc">
<arg line="run" />
<arg line="-d lib/" />
<arg line="-t build/docs" />
</exec>
</target>
<target name="phpdoc-ci">
<exec executable="phpdoc">
<arg line="run" />
<arg line="-d lib/" />
<arg line="-t build/docs" />
<arg line="-q" />
</exec>
</target>
<target name="phpcb">
<exec executable="phpcb">
<arg line="--log ${basedir}/build/logs
--source ${source}
--output ${basedir}/build/code-browser" />
</exec>
</target>
<target name="build" depends="prepare,composer,lint,parallelTasks,phpunit"/>
<!-- Checkstyle with human output -->
<target name="phpcs">
<exec executable="phpcs">
<arg line="--standard=PSR2 ${source}" />
</exec>
</target>
<target name="phpmd" description="Perform phpmd with human readable output">
<exec executable="phpmd">
<arg path="${source}"/>
<arg value="text"/>
<arg value="codesize,unusedcode,naming,design" />
<arg value="${basedir}/build/phpmd.xml"/>
</exec>
</target>
<!-- Setups test environment -->
<target name="setup" description="setups php libs for">
<exec executable="pear">
<arg line="channel-discover pear.pdepend.org" />
</exec>
<exec executable="pear">
<arg line="channel-discover pear.phpmd.org" />
</exec>
<exec executable="pear">
<arg line="channel-discover pear.phpunit.de" />
</exec>
<exec executable="pear">
<arg line="channel-discover components.ez.no" />
</exec>
<exec executable="pear">
<arg line="channel-discover pear.symfony-project.com" />
</exec>
<exec executable="pear">
<arg line="channel-discover pear.michelf.com" />
</exec>
<exec executable="pear">
<arg line="channel-discover pear.phpdoc.org" />
</exec>
<exec executable="pear">
<arg line="install pdepend/PHP_Depend" />
</exec>
<exec executable="pear">
<arg line="install phpmd/PHP_PMD" />
</exec>
<exec executable="pear">
<arg line="install phpunit/phpcpd" />
</exec>
<exec executable="pear">
<arg line="install phpunit/phploc" />
</exec>
<exec executable="pear">
<arg line="install phpdoc/phpDocumentor-alpha" />
</exec>
<exec executable="pear">
<arg line="install PHP_CodeSniffer" />
</exec>
<exec executable="pear">
<arg line="install --alldeps phpunit/PHP_CodeBrowser" />
</exec>
<exec executable="pear">
<arg line="install --alldeps phpunit/PHPUnit" />
</exec>
</target>
<target name="gource" description="Visualize repos with gource">
<exec executable="gource">
<arg line="--log-format git" />
<arg line="--seconds-per-day 0.1" />
<arg line="--title 'Elastica (https://github.com/ruflin/Elastica)'" />
<arg line="--user-scale 1" />
<arg line="--max-user-speed 50" />
</exec>
</target>
</project>