-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
build.xml
397 lines (337 loc) · 19.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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<?xml version="1.0" encoding="UTF-8"?>
<project name="phpunit" default="setup">
<target name="setup" depends="clean-build-artifacts,install-dependencies"/>
<target name="clean" description="Cleanup build artifacts and vendor directory" depends="clean-build-artifacts,clean-vendor">
</target>
<target name="clean-build-artifacts" description="Cleanup build artifacts">
<delete dir="${basedir}/build/artifacts"/>
<delete dir="${basedir}/build/tmp"/>
</target>
<target name="clean-vendor" description="Cleanup vendor directory">
<delete dir="${basedir}/vendor"/>
</target>
<target name="install-dependencies" description="Install dependencies (and generate autoloader) with Composer">
<exec executable="${basedir}/tools/composer" taskname="composer">
<arg value="install"/>
<arg value="--no-interaction"/>
<arg value="--no-progress"/>
<arg value="--no-ansi"/>
</exec>
</target>
<target name="update-dependencies" description="Update (and bump) dependencies with Composer">
<exec executable="${basedir}/tools/composer" taskname="composer">
<arg value="update"/>
<arg value="--no-interaction"/>
<arg value="--no-progress"/>
<arg value="--no-ansi"/>
</exec>
<exec executable="${basedir}/tools/composer" taskname="composer">
<arg value="bump"/>
<arg value="--no-interaction"/>
<arg value="--no-ansi"/>
</exec>
</target>
<target name="update-tools">
<exec executable="${basedir}/tools/phive">
<arg value="--no-progress"/>
<arg value="self-update"/>
</exec>
<exec executable="${basedir}/tools/phive">
<arg value="--no-progress"/>
<arg value="update"/>
</exec>
</target>
<target name="generate-global-assert-wrappers" description="Generate global function wrappers for static methods in Assert and TestCase that are commonly used">
<exec executable="${basedir}/build/scripts/generate-global-assert-wrappers.php" taskname="generate-global-assert-wrappers" failonerror="true"/>
<exec executable="${basedir}/tools/php-cs-fixer" taskname="php-cs-fixer" failonerror="true">
<arg value="fix"/>
<arg value="--show-progress=none"/>
<arg path="${basedir}/src/Framework/Assert/Functions.php"/>
</exec>
</target>
<target name="package-extension-for-testing"
description="Package PHAR of test runner extension that is used for testing">
<delete dir="${basedir}/build/tmp"/>
<mkdir dir="${basedir}/build/tmp"/>
<copy tofile="${basedir}/build/tmp/manifest.xml" file="${basedir}/build/test-extension/manifest.xml" />
<copy todir="${basedir}/build/tmp/phpunit-test-extension">
<fileset dir="${basedir}/build/test-extension/src">
<include name="**/*" />
</fileset>
</copy>
<exec executable="${basedir}/tools/phpab" taskname="phpab">
<arg value="--all" />
<arg value="--static" />
<arg value="--once" />
<arg value="--phar" />
<arg value="--output" />
<arg path="${basedir}/tests/end-to-end/_files/phar-extension/tools/phpunit.d/phpunit-test-extension-1.0.0.phar" />
<arg path="${basedir}/build/tmp" />
</exec>
<delete dir="${basedir}/build/tmp"/>
</target>
<target name="signed-phar" depends="phar" description="Create signed PHAR archive of PHPUnit and all its dependencies">
<exec executable="gpg" failonerror="true">
<arg value="--local-user"/>
<arg value="[email protected]"/>
<arg value="--armor"/>
<arg value="--detach-sign"/>
<arg path="${basedir}/build/artifacts/phpunit-library-${version}.phar"/>
</exec>
<exec executable="gpg" failonerror="true">
<arg value="--local-user"/>
<arg value="[email protected]"/>
<arg value="--armor"/>
<arg value="--detach-sign"/>
<arg path="${basedir}/build/artifacts/phpunit-${version}.phar"/>
</exec>
</target>
<target name="phar" depends="-phar-prepare,-phar-determine-version" description="Create PHAR archive of PHPUnit and all its dependencies">
<antcall target="-phar-build">
<param name="type" value="release"/>
</antcall>
</target>
<target name="phar-snapshot" depends="-phar-prepare" description="Create PHAR archive of PHPUnit and all its dependencies (snapshot)">
<antcall target="-phar-build">
<param name="type" value="snapshot"/>
</antcall>
</target>
<target name="-phar-prepare" depends="clean,install-dependencies">
<mkdir dir="${basedir}/build/artifacts"/>
<mkdir dir="${basedir}/build/tmp/phar"/>
<mkdir dir="${basedir}/build/tmp/phar-scoped"/>
<copy file="${basedir}/phpunit.xsd" tofile="${basedir}/build/tmp/phar/phpunit.xsd"/>
<copy todir="${basedir}/build/tmp/phar/schema">
<fileset dir="${basedir}/schema">
<include name="**/*" />
</fileset>
</copy>
<copy file="${basedir}/composer.lock" tofile="${basedir}/build/tmp/phar/composer.lock"/>
<exec executable="${basedir}/build/scripts/phar-manifest.php" failonerror="true">
<arg path="${basedir}/build/tmp/phar/manifest.txt"/>
<arg path="${basedir}/build/tmp/phar/sbom.xml"/>
</exec>
<copy file="${basedir}/vendor/phpunit/php-code-coverage/LICENSE" tofile="${basedir}/build/tmp/phar/php-code-coverage/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/php-code-coverage">
<fileset dir="${basedir}/vendor/phpunit/php-code-coverage/src">
<include name="**/*" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phpunit/php-file-iterator/LICENSE" tofile="${basedir}/build/tmp/phar/php-file-iterator/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/php-file-iterator">
<fileset dir="${basedir}/vendor/phpunit/php-file-iterator/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy todir="${basedir}/build/tmp/phar/php-invoker">
<fileset dir="${basedir}/vendor/phpunit/php-invoker/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phpunit/php-text-template/LICENSE" tofile="${basedir}/build/tmp/phar/php-text-template/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/php-text-template">
<fileset dir="${basedir}/vendor/phpunit/php-text-template/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phpunit/php-timer/LICENSE" tofile="${basedir}/build/tmp/phar/php-timer/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/php-timer">
<fileset dir="${basedir}/vendor/phpunit/php-timer/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/cli-parser/LICENSE" tofile="${basedir}/build/tmp/phar/sebastian-cli-parser/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-cli-parser">
<fileset dir="${basedir}/vendor/sebastian/cli-parser/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/comparator/LICENSE" tofile="${basedir}/build/tmp/phar/sebastian-comparator/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-comparator">
<fileset dir="${basedir}/vendor/sebastian/comparator/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/complexity/LICENSE" tofile="${basedir}/build/tmp/phar/sebastian-complexity/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-complexity">
<fileset dir="${basedir}/vendor/sebastian/complexity/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/diff/LICENSE" tofile="${basedir}/build/tmp/phar/sebastian-diff/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-diff">
<fileset dir="${basedir}/vendor/sebastian/diff/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/environment/LICENSE" tofile="${basedir}/build/tmp/phar/sebastian-environment/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-environment">
<fileset dir="${basedir}/vendor/sebastian/environment/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/exporter/LICENSE" tofile="${basedir}/build/tmp/phar/sebastian-exporter/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-exporter">
<fileset dir="${basedir}/vendor/sebastian/exporter/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/global-state/LICENSE" tofile="${basedir}/build/tmp/phar/sebastian-global-state/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-global-state">
<fileset dir="${basedir}/vendor/sebastian/global-state/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/lines-of-code/LICENSE" tofile="${basedir}/build/tmp/phar/sebastian-lines-of-code/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-lines-of-code">
<fileset dir="${basedir}/vendor/sebastian/lines-of-code/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/object-enumerator/LICENSE" tofile="${basedir}/build/tmp/phar/object-enumerator/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-object-enumerator">
<fileset dir="${basedir}/vendor/sebastian/object-enumerator/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/object-reflector/LICENSE" tofile="${basedir}/build/tmp/phar/object-reflector/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-object-reflector">
<fileset dir="${basedir}/vendor/sebastian/object-reflector/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/recursion-context/LICENSE" tofile="${basedir}/build/tmp/phar/sebastian-recursion-context/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-recursion-context">
<fileset dir="${basedir}/vendor/sebastian/recursion-context/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/type/LICENSE" tofile="${basedir}/build/tmp/phar/sebastian-type/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-type">
<fileset dir="${basedir}/vendor/sebastian/type/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/version/LICENSE" tofile="${basedir}/build/tmp/phar/sebastian-version/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/sebastian-version">
<fileset dir="${basedir}/vendor/sebastian/version/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/staabm/side-effects-detector/LICENSE" tofile="${basedir}/build/tmp/phar/staabm-side-effects-detector/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/staabm-side-effects-detector">
<fileset dir="${basedir}/vendor/staabm/side-effects-detector/lib">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/myclabs/deep-copy/LICENSE" tofile="${basedir}/build/tmp/phar/myclabs-deep-copy/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/myclabs-deep-copy">
<fileset dir="${basedir}/vendor/myclabs/deep-copy/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/nikic/php-parser/LICENSE" tofile="${basedir}/build/tmp/phar/nikic-php-parser/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/nikic-php-parser">
<fileset dir="${basedir}/vendor/nikic/php-parser/lib">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phar-io/manifest/LICENSE" tofile="${basedir}/build/tmp/phar/phar-io-manifest/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/phar-io-manifest">
<fileset dir="${basedir}/vendor/phar-io/manifest/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phar-io/version/LICENSE" tofile="${basedir}/build/tmp/phar/phar-io-version/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/phar-io-version">
<fileset dir="${basedir}/vendor/phar-io/version/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/theseer/tokenizer/LICENSE" tofile="${basedir}/build/tmp/phar/theseer-tokenizer/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/theseer-tokenizer">
<fileset dir="${basedir}/vendor/theseer/tokenizer/src">
<include name="**/*.php" />
</fileset>
</copy>
</target>
<target name="-phar-build" depends="-phar-determine-version">
<copy todir="${basedir}/build/tmp/phar/phpunit">
<fileset dir="${basedir}/src">
<include name="**/*.php"/>
<include name="**/*.tpl*"/>
</fileset>
</copy>
<exec executable="${basedir}/build/scripts/phar-version.php" outputproperty="_version" failonerror="true">
<arg value="${version}"/>
<arg value="${type}"/>
</exec>
<exec executable="${basedir}/tools/php-scoper" taskname="php-scoper">
<arg value="add-prefix" />
<arg value="--no-ansi" />
<arg value="--force" />
<arg value="--config" />
<arg path="${basedir}/build/config/php-scoper.php" />
<arg value="--no-interaction" />
<arg value="--output-dir" />
<arg path="${basedir}/build/tmp/phar-scoped" />
<arg path="${basedir}/build/tmp/phar" />
</exec>
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Runner/PHPT/templates/phpt.tpl" token="SebastianBergmann\CodeCoverage\CodeCoverage" value="PHPUnitPHAR\SebastianBergmann\CodeCoverage\CodeCoverage"/>
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Runner/PHPT/templates/phpt.tpl" token="SebastianBergmann\CodeCoverage\Driver\Selector" value="PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver\Selector"/>
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Runner/PHPT/templates/phpt.tpl" token="SebastianBergmann\CodeCoverage\Filter" value="PHPUnitPHAR\SebastianBergmann\CodeCoverage\Filter"/>
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Framework/TestRunner/templates/class.tpl" token="SebastianBergmann\CodeCoverage\CodeCoverage" value="PHPUnitPHAR\SebastianBergmann\CodeCoverage\CodeCoverage"/>
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Framework/TestRunner/templates/class.tpl" token="SebastianBergmann\CodeCoverage\Driver\Selector" value="PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver\Selector"/>
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Framework/TestRunner/templates/method.tpl" token="SebastianBergmann\CodeCoverage\CodeCoverage" value="PHPUnitPHAR\SebastianBergmann\CodeCoverage\CodeCoverage"/>
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Framework/TestRunner/templates/method.tpl" token="SebastianBergmann\CodeCoverage\Driver\Selector" value="PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver\Selector"/>
<exec executable="${basedir}/tools/phpab" taskname="phpab" failonerror="true">
<arg value="--all" />
<arg value="--tolerant" />
<arg value="--phar" />
<arg value="--hash" />
<arg value="SHA-512" />
<arg value="--output" />
<arg path="${basedir}/build/artifacts/phpunit-library-${_version}.phar" />
<arg value="--template" />
<arg path="${basedir}/build/templates/library-phar-autoload.php.in" />
<arg path="${basedir}/build/tmp/phar-scoped" />
</exec>
<exec executable="${basedir}/build/scripts/phar-set-timestamps/run.php" taskname="phar-set-timestamps" failonerror="true">
<arg path="${basedir}/build/artifacts/phpunit-library-${_version}.phar" />
</exec>
<copy file="${basedir}/build/templates/binary-phar-autoload.php.in" tofile="${basedir}/build/tmp/binary-phar-autoload.php"/>
<replace file="${basedir}/build/tmp/binary-phar-autoload.php" token="X.Y.Z" value="${_version}"/>
<exec executable="${basedir}/tools/phpab" taskname="phpab" failonerror="true">
<arg value="--all" />
<arg value="--tolerant" />
<arg value="--nolower" />
<arg value="--phar" />
<arg value="--hash" />
<arg value="SHA-512" />
<arg value="--output" />
<arg path="${basedir}/build/artifacts/phpunit-${_version}.phar" />
<arg value="--template" />
<arg path="${basedir}/build/tmp/binary-phar-autoload.php" />
<arg path="${basedir}/build/tmp/phar-scoped" />
</exec>
<exec executable="${basedir}/build/scripts/phar-set-timestamps/run.php" taskname="phar-set-timestamps" failonerror="true">
<arg path="${basedir}/build/artifacts/phpunit-${_version}.phar" />
</exec>
<chmod file="${basedir}/build/artifacts/phpunit-${_version}.phar" perm="ugo+rx"/>
<delete dir="${basedir}/build/tmp"/>
</target>
<target name="-phar-determine-version">
<exec executable="${basedir}/build/scripts/version.php" outputproperty="version" failonerror="true" />
</target>
<target name="build-phar-and-run-phar-specific-tests" depends="clean,phar-snapshot" description="Build PHAR and run the PHAR-specific tests with it">
<delete dir="${basedir}/vendor"/>
<antcall target="run-phar-specific-tests"/>
</target>
<target name="run-phar-specific-tests" description="Run the PHAR-specific tests with it (expects build/artifacts/phpunit-snapshot.phar to exist)">
<exec executable="${basedir}/build/artifacts/phpunit-snapshot.phar" taskname="phpunit" failonerror="true">
<arg value="--configuration" />
<arg value="tests/end-to-end/phar/phpunit.xml" />
<arg value="--coverage-text" />
</exec>
</target>
</project>