-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
217 lines (206 loc) · 6.54 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
<?xml version="1.0" encoding="UTF-8"?>
<!-- vi:se fenc=utf-8 ff=unix tw=80 ai si sw=2 et ts=2 sts=2: -->
<project name="Tox" default="test">
<property name="bin.phpcs.0" location="bin/phpcs"/>
<property name="bin.phpmd.0" location="bin/phpmd"/>
<property name="bin.phpunit.0" location="bin/phpunit"/>
<property file="build.properties"/>
<target name="-greeting">
<echo>THANK YOU for your CONTRIBUTION to ${ant.project.name}</echo>
</target>
<!-- suites operations {{{1 -->
<target name="clean"
depends="-rm-build"
description="[main] Cleans fixures of building progress up."
/>
<target name="test"
depends="lint,unit,cs,md"
description="[main] Verifies widely. ( lint + unit + cs + md )"
/>
<target name="travis" depends="-travis-setup,test,-travis-teardown"/>
<!-- }}}1 -->
<target name="phpmd" depends="md"/>
<target name="md"
depends="-greeting,-composer-install"
description=" Detects mess codes of PHP source."
>
<condition property="bin.phpmd" value="${bin.phpmd.0}" else="phpmd">
<isset property="bin.phpmd.0"/>
</condition>
<echo>'${bin.phpmd}' used</echo>
</target>
<target name="phpdoc" depends="doc"/>
<target name="doc"
depends="-greeting,-mkdir-build-sdk"
description=" Generates SDK documentation."
>
<condition property="bin.phpdoc" value="${bin.phpdoc.0}" else="phpdoc">
<isset property="bin.phpdoc.0"/>
</condition>
<echo>'${bin.phpdoc}' used</echo>
<condition property="phpdoc.xml"
value="phpdoc.xml"
else="etc/phpdoc.xml"
>
<available property="phpdoc.xml" file="phpdoc.xml"/>
</condition>
<exec executable="${bin.phpdoc}"
failonerror="true"
failifexecutionfails="true"
>
<arg value="-c"/>
<arg file="${phpdoc.xml}"/>
</exec>
</target>
<target name="phpunit" depends="unit"/>
<target name="unit"
depends="-greeting,-mkdir-build-code-coverage,-composer-install"
description=" Runs unit-tests."
>
<condition property="bin.phpunit" value="${bin.phpunit.0}" else="phpunit">
<isset property="bin.phpunit.0"/>
</condition>
<echo>'${bin.phpunit}' used</echo>
<condition property="phpunit.xml"
value="phpunit.xml"
else="etc/phpunit.xml"
>
<available property="phpunit.xml" file="phpunit.xml"/>
</condition>
<exec executable="${bin.phpunit}"
failonerror="true"
failifexecutionfails="true"
>
<arg value="-c"/>
<arg file="${phpunit.xml}"/>
</exec>
<concat>
<path path="build/code-coverage/brief.log"/>
</concat>
</target>
<target name="phpcs" depends="cs"/>
<target name="cs"
depends="-greeting,-composer-install,-mkdir-build"
description=" Validates with code standard `PSR-2'."
>
<condition property="bin.phpcs" value="${bin.phpcs.0}" else="phpcs">
<isset property="bin.phpcs.0"/>
</condition>
<echo>'${bin.phpcs}' used</echo>
<exec executable="${bin.phpcs}"
failonerror="true"
failifexecutionfails="true"
>
<arg value="--standard=etc/phpcs/src.xml"/>
<arg value="--encoding=UTF-8"/>
<arg value="--extensions=php"/>
<arg path="src"/>
</exec>
<exec executable="${bin.phpcs}"
failonerror="true"
failifexecutionfails="true"
>
<arg value="--standard=etc/phpcs/share-test.xml"/>
<arg value="--encoding=UTF-8"/>
<arg value="--extensions=php"/>
<arg path="share/test"/>
</exec>
</target>
<target name="phplint" depends="lint"/>
<target name="lint"
depends="-greeting,-mkdir-build"
description=" Checks PHP source codes syntax."
>
<condition property="bin.php" value="${bin.php.0}" else="php">
<isset property="bin.php.0"/>
</condition>
<echo>'${bin.php}' used</echo>
<apply executable="${bin.php}" failonerror="true">
<arg value="-l" />
<fileset dir="share/test">
<include name="**/*-test.php" />
<modified delayupdate="false"/>
</fileset>
<fileset dir="src">
<include name="**/*.php" />
<modified delayupdate="false"/>
</fileset>
</apply>
</target>
<!-- composer preparations {{{1 -->
<target name="-composer-install"
depends="-composer-check-up-to-date"
if="composer.out-of-date"
>
<condition property="bin.composer"
value="${bin.composer.0}"
else="composer"
>
<isset property="bin.composer.0"/>
</condition>
<echo>'${bin.composer}' used</echo>
<condition property="composer.command" value="update" else="install">
<available property="composer.command" file="composer.lock"/>
</condition>
<exec executable="${bin.composer}"
failonerror="true"
failifexecutionfails="true"
>
<arg value="${composer.command}"/>
<arg value="--dev"/>
</exec>
<touch file="composer.lock"/>
</target>
<target name="-composer-check-up-to-date">
<tstamp>
<format property="composer.update-time"
offset="-7"
unit="day"
pattern="MM/dd/yyyy hh:mm:ss aa"
/>
</tstamp>
<condition property="composer.out-of-date">
<or>
<islastmodified datetime="${composer.update-time}" mode="before">
<file file="composer.lock"/>
</islastmodified>
<uptodate property=""
srcfile="composer.lock"
targetfile="composer.json"
/>
</or>
</condition>
</target>
<!-- }}}1 -->
<!-- file-system operations {{{1 -->
<target name="-mkdir-build">
<mkdir dir="build" />
</target>
<target name="-mkdir-build-code-coverage" depends="-mkdir-build">
<mkdir dir="build/code-coverage" />
</target>
<target name="-mkdir-build-sdk" depends="-mkdir-build">
<mkdir dir="build/sdk" />
</target>
<target name="-rm-build">
<delete dir="build" includeemptydirs="false" />
</target>
<!-- }}}1 -->
<!-- travis-ci operations {{{1 -->
<target name="-travis-setup">
<copy file="etc/travis/composer.json"
tofile="composer.json"
overwrite="true"
failonerror="true"
/>
<property name="bin.phpunit" value="phpunit"/>
</target>
<target name="-travis-teardown">
<exec executable="git" failonerror="true" failifexecutionfails="true">
<arg value="checkout"/>
<arg value="--"/>
<arg value="composer.json"/>
</exec>
</target>
<!-- }}}1 -->
</project>