This repository has been archived by the owner on Nov 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
304 lines (266 loc) · 14.2 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<?xml version="1.0" encoding="UTF-8"?>
<!--
Phing (http://phing.info/) build file
Docs: https://www.phing.info/docs/stable/hlhtml/index.html
@author Piotr Żuralski <piotr@zuralski.net>
@copyright 2015 Blue Media
@since 2015-08-08
@version 2.3.3
-->
<project name="Płatności Online BM" default="build:prod">
<property environment="env"/>
<property name="project.src_dir" value="${project.basedir}/src" override="true"/>
<property name="project.build_dir" value="${project.basedir}/builds" override="true"/>
<property name="project.bin_dir" value="${project.basedir}/bin" override="true"/>
<!--<target name="build" depends="verify, analyze"/>-->
<!--<target name="verify" depends="phplint,composer-validate,autoload-validation,author-validation"/>-->
<!--<target name="analyze" depends="phploc,pdepend,phpmd,phpcs,phpcpd,phpunit,branch-alias-validation,travis-configuration-check"/>-->
<!--<target name="docs" depends="phpdoc, phpcb, htaccess, copysvg, copybuild"/>-->
<target name="qc" description="Quality check" depends="qc:lint,qc:pdepend,qc:phpmetrics,qc:phpunit,qc:humbug,qc:sensio-security,qc:phpcb,qc:phpcpd,qc:phpcs,qc:phpcbf,qc:php-cs-fixer,qc:phpdcd,qc:phploc,qc:phpmd"/>
<target name="initialize" hidden="true">
<delete dir="${project.build_dir}"/>
<mkdir dir="${project.build_dir}/logs/"/>
</target>
<target name="composer:get" hidden="true" depends="initialize">
<available file="${project.bin_dir}/composer" property="composer:exists" value="true"/>
<if>
<not><equals arg1="${composer:exists}" arg2="true"/></not>
<then>
<httpget url="https://getcomposer.org/installer" dir="${project.build_dir}" filename="composer-installer.php"/>
<httpget url="https://composer.github.io/installer.sig" dir="${project.build_dir}" filename="composer-installer.php.sha384"/>
<!--<phpcpd>-->
<httpget url="https://phar.phpunit.de/phpcpd.phar" dir="${project.bin_dir}" filename="phpcpd" followRedirects="true"/>
<!--<phploc>-->
<httpget url="https://phar.phpunit.de/phploc.phar" dir="${project.bin_dir}" filename="phploc" followRedirects="true"/>
<!--<phpmd>-->
<httpget url="https://static.phpmd.org/php/latest/phpmd.phar" dir="${project.bin_dir}" filename="phpmd"/>
<!--<phpdepend>-->
<httpget url="https://static.pdepend.org/php/latest/pdepend.phar" dir="${project.bin_dir}" filename="pdepend"/>
<!--<phpdoc2>-->
<httpget url="https://phpdoc.org/phpDocumentor.phar" dir="${project.bin_dir}" filename="phpdoc"/>
<!--<phpunit>-->
<httpget url="https://phar.phpunit.de/phpunit.phar" dir="${project.bin_dir}" filename="phpunit" followRedirects="true"/>
<httpget url="https://codeception.github.io/codecept.phar" dir="${project.bin_dir}" filename="codecept" followRedirects="true"/>
<httpget url="https://phar.phpunit.de/phpdcd.phar" dir="${project.bin_dir}" filename="phpdcd" followRedirects="true"/>
<httpget url="https://github.com/phpmetrics/PhpMetrics/raw/master/build/phpmetrics.phar" dir="${project.bin_dir}" filename="phpmetrics" followRedirects="true"/>
<httpget url="https://github.com/phpmetrics/ComposerExtension/raw/master/composer-extension.phar" dir="${project.bin_dir}" filename="phpmetrics-composer-extension" followRedirects="true"/>
<httpget url="https://padraic.github.io/humbug/downloads/humbug.phar" dir="${project.bin_dir}" filename="humbug"/>
<httpget url="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.0.0/php-cs-fixer.phar" dir="${project.bin_dir}" filename="php-cs-fixer" followRedirects="true"/>
<filehash file="${project.build_dir}/composer-installer.php" algorithm="sha384" propertyname="composer:actual_signature"/>
<loadfile file="${project.build_dir}/composer-installer.php.sha384" property="composer:expected_signature"/>
<chmod file="${project.build_dir}/composer-installer.php" mode="0700"/>
<condition property="composer:veryfied" value="true">
<equals arg1="${composer:actual_signature}" arg2="${composer:expected_signature}" casesensitive="false" trim="true"/>
</condition>
<if>
<not><equals arg1="${composer:veryfied}" arg2="true"/></not>
<then>
<delete file="${project.build_dir}/composer-installer.php"/>
<delete file="${project.build_dir}/composer-installer.php.sha384"/>
<fail message="Composer: Invalid installer signature (${composer:actual_signature}, ${composer:expected_signature})"/>
</then>
<else>
<exec command="php ${project.build_dir}/composer-installer.php --install-dir=${project.bin_dir} --filename=composer" checkreturn="true" logoutput="true"/>
<delete file="${project.build_dir}/composer-installer.php"/>
<delete file="${project.build_dir}/composer-installer.php.sha384"/>
<chmod file="${project.bin_dir}/composer" mode="0700"/>
</else>
</if>
</then>
</if>
<composer composer="${project.bin_dir}/composer" command="self-update"/>
<composer composer="${project.bin_dir}/composer">
<arg line="--version"/>
</composer>
</target>
<target name="vendors:dev" hidden="true">
<composer composer="${project.bin_dir}/composer" command="install">
<arg value="--no-progress"/>
<arg value="--no-interaction"/>
<arg value="--no-suggest"/>
<arg value="--prefer-source"/>
<arg value="-vvv"/>
</composer>
<composer composer="${project.bin_dir}/composer" command="dump-autoload">
<arg value="--optimize"/>
</composer>
</target>
<target name="vendors:prod" hidden="true">
<composer composer="${project.bin_dir}/composer" command="install">
<arg value="--no-dev"/>
<arg value="--no-progress"/>
<arg value="--no-interaction"/>
<arg value="--no-suggest"/>
<arg value="--prefer-dist"/>
</composer>
<composer composer="${project.bin_dir}/composer" command="dump-autoload">
<arg value="--no-dev"/>
<arg value="--optimize"/>
</composer>
</target>
<target name="qc:lint" description="QC: Linting files">
<phplint cachefile="${project.build_dir}/cache.properties" deprecatedAsError="true" haltonfailure="true">
<fileset dir="${project.basedir}/examples">
<include name="**/*.php"/>
</fileset>
<fileset dir="${project.src_dir}">
<include name="**/*.php"/>
</fileset>
<fileset dir="${project.basedir}/tests">
<include name="**/*.php"/>
</fileset>
</phplint>
</target>
<target name="qc:pdepend" description="QC: pDepend">
<if>
<available file="${project.bin_dir}/pdepend" type="file" property="qc.pdepend.file"/>
<then>
<exec executable="${project.bin_dir}/pdepend" checkreturn="true" logoutput="true">
<arg value="--jdepend-xml=${project.build_dir}/logs/jdepend.xml"/>
<arg value="--dependency-xml=${project.build_dir}/logs/dependency.xml"/>
<arg value="--summary-xml=${project.build_dir}/logs/pdepend-summary.xml"/>
<arg value="${project.src_dir}/,${project.basedir}/tests/"/>
</exec>
</then>
<else>
<echo message="Skipping qc:pdepend" level="warning"/>
<fail status="0"/>
</else>
</if>
</target>
<target name="qc:phpcb" description="QC: Code browser">
<echo message="Skipping qc:phpcb" level="warning"/>
<!--<fail status="0"/>-->
<!--<exec executable="${project.bin_dir}/phpcb" checkreturn="true" logoutput="true">-->
<!--<arg value="--log"/>-->
<!--<arg path="${project.build_dir}/logs/"/>-->
<!--<arg value="--source"/>-->
<!--<arg path="${project.src_dir}"/>-->
<!--<arg value="--output"/>-->
<!--<arg path="${project.build_dir}/code-browser/"/>-->
<!--</exec>-->
</target>
<target name="qc:phpcpd" description="QC: PHP Copy/Paste Detector">
<exec executable="${project.bin_dir}/phpcpd" checkreturn="true" logoutput="true">
<arg value="--log-pmd"/>
<arg path="${project.build_dir}/logs/pmd-cpd.xml"/>
<arg path="${project.src_dir}"/>
</exec>
</target>
<target name="qc:phpcs" description="QC: Code Sniffer">
<!--<echo message="Skipping qc:phpcs" level="warning"/>-->
<exec executable="${project.bin_dir}/phpcs" checkreturn="true" logoutput="true">
<arg path="${project.src_dir}"/>
<arg path="${project.basedir}/tests/"/>
<arg value="--standard=PSR2"/>
<arg value="--extensions=php"/>
</exec>
</target>
<target name="qc:phpcbf">
<exec executable="${project.bin_dir}/phpcbf" checkreturn="true" logoutput="true">
<arg path="${project.src_dir}"/>
<arg value="--standard=PSR2"/>
<arg value="--extensions=php"/>
</exec>
</target>
<target name="qc:php-cs-fixer" description="QC: Coding File fixer (dry-run)">
<exec executable="${project.bin_dir}/php-cs-fixer" checkreturn="true" logoutput="true">
<arg value="fix"/>
<arg path="${project.src_dir}"/>
<arg value="--config"/>
<arg path=".php_cs"/>
<arg value="--dry-run"/>
<arg value="-vvv"/>
</exec>
</target>
<target name="qc:phpdcd" description="QC: Dead Code Detector">
<exec executable="${project.bin_dir}/phpdcd" checkreturn="true" logoutput="true">
<arg line="--no-interaction"/>
<arg path="${project.src_dir}/"/>
<arg path="${project.basedir}/tests/"/>
</exec>
</target>
<target name="qc:phploc" description="QC: measure the size and analyzing the structure of a project">
<exec executable="${project.bin_dir}/phploc" checkreturn="true" logoutput="true">
<arg value="--no-interaction"/>
<arg value="--count-tests"/>
<arg path="${project.basedir}/tests/"/>
<arg path="--log-csv"/>
<arg path="${project.build_dir}/logs/phploc.csv"/>
<arg path="--log-xml"/>
<arg path="${project.build_dir}/logs/phploc.xml"/>
</exec>
</target>
<target name="qc:phpmd" description="QC: PHP Mess Detector">
<!--<echo message="Skipping qc:phpmd" level="warning"/>-->
<exec executable="${project.bin_dir}/phpmd" checkreturn="true" logoutput="true">
<arg path="${project.src_dir}"/>
<arg value="text"/>
<arg value="codesize"/>
<arg path="${project.build_dir}/logs/phpmd.xml"/>
</exec>
</target>
<target name="qc:phpmetrics" description="QC: static analysis tool for PHP">
<if>
<available file="${project.basedir}/.phpmetrics.yml" type="file" property="qc.phpmetrics.file"/>
<then>
<exec executable="${project.bin_dir}/phpmetrics" checkreturn="true" logoutput="true">
<arg value="--no-interaction"/>
<arg value="--config"/>
<arg path="./.phpmetrics.yml"/>
</exec>
</then>
<else>
<echo message="Skipping qc:phpmetrics" level="warning"/>
<fail status="0"/>
</else>
</if>
</target>
<target name="qc:phpunit" description="QC: Runs unit tests in PHPUnit">
<if>
<available file="${project.basedir}/phpunit.xml" type="file" property="qc.phpunit.file"/>
<then>
<exec executable="${project.bin_dir}/phpunit" checkreturn="true" logoutput="true">
<arg value="-c"/>
<arg value="phpunit.xml"/>
</exec>
</then>
<else>
<echo message="Skipping qc:phpunit" level="warning"/>
<fail status="0"/>
</else>
</if>
</target>
<target name="qc:humbug" description="QC: Runs Humbug - a Mutation Testing framework">
<if>
<available file="${project.basedir}/humbug.json.dist" type="file" property="qc.humbug.file"/>
<then>
<exec executable="${project.bin_dir}/humbug" checkreturn="true" logoutput="true">
<arg value="--no-progress-bar"/>
<arg value="--no-interaction"/>
<arg value="-vvv"/>
</exec>
</then>
<else>
<echo message="Skipping qc:humbug" level="warning"/>
<fail status="0"/>
</else>
</if>
</target>
<target name="qc:sensio-security" description="QC: Checks security issues with project dependencies">
<exec executable="curl" checkreturn="true" logoutput="true">
<arg line='-H "Accept: text/plain" https://security.sensiolabs.org/check_lock -F lock=@composer.lock'/>
</exec>
</target>
<target name="build:prod" description="Builds application for "prod" (production) enviroment" depends="composer:get,vendors:prod"/>
<target name="build:dev" description="Builds application for "dev" (development) enviroment" depends="composer:get,vendors:dev,qc"/>
<target name="php-cs-fixer">
<exec executable="${project.bin_dir}/php-cs-fixer" checkreturn="true" logoutput="true">
<arg value="fix"/>
<arg path="${project.src_dir}"/>
<arg value="--config"/>
<arg path=".php_cs"/>
<arg value="-vvv"/>
</exec>
</target>
</project>