-
Notifications
You must be signed in to change notification settings - Fork 115
/
build.xml
590 lines (504 loc) · 19.8 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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
<?xml version="1.0"?>
<project
name="QueryPath"
description="A simple, powerful, robust tool for working with XML, HTML, and HTTP"
default="ftest">
<!--
This is the Phing build file for QueryPath.
Phing is a build tool. Learn more about it at http://phing.info.
Copyright (c) 2009, Matt Butcher, some rights reserved.
License:
QueryPath is released under the GNU LGPL 2.1 or, at your preference,
an MIT license. See COPYING-LGPL.txt and COPYING-MIT.txt for details.
-->
<target name="info" description="Information on using the QueryPath Phing build.">
<echo>
To build QueryPath, run:
phing build
This will create a generic dev release of QueryPath and copy the releasable files to the dist/ directory. All documentation will be generated, and both a minimal and full version of the code will be generated. The non-compressed files will be available for inspection in bin/build/.
IMPORTANT: The full version of the package does not include build scripts (including this file). The only way to obtain the entire QueryPath development environment is to check it out from http://github.com/technosophos/querypath.
A numbered release can be built with:
phing build -Dversion=2.1-Alpha1
These are the basic tasks we anticipate performing with phing. However, the build script supports the running of several other tasks which may help you when debugging or developing QueryPath. Important ones are listed below. A complete list can be obtained by running 'phing -l' in this directory.
To generate docs, do:
phing doc
Documentation will be stored in docs/. You can start with docs/index.html.
To run unit tests, do:
phing test
The above will generate HTML test results which will be placed in test/reports/. If you wish to run the test and print the results directly the the command line, you should run 'phing ftest' instead.
To run coverage analysis, do:
phing coverage
This will create HTML pages describing code coverage. The coverage analysis will be available in test/coverage
To print this message, do:
phing info
</echo>
</target>
<!-- This is used for Pirum tasks. -->
<includepath classpath="../Phing-Pirum/src"/>
<taskdef classname="PhingPirum.Task.PirumBuildTask" name="pirumbuild"/>
<taskdef classname="PhingPirum.Task.PirumAddTask" name="pirumadd"/>
<!-- Doxygen -->
<includepath classpath="../PhingDoxygen/src"/>
<taskdef classname="PhingDoxygen.Task.DoxygenTask" name="doxygen"/>
<!-- Pyrus tasks. -->
<includepath classpath="/Users/mattbutcher/Code"/> <!-- Pyrus is here. -->
<includepath classpath="../PhingPyrus/src"/>
<taskdef classname="PhingPyrus.Task.PyrusMakeTask" name="pyrusmake"/>
<taskdef classname="PhingPyrus.Task.PyrusPackageTask" name="pyruspackage"/>
<taskdef classname="PhingPyrus.Task.PyrusHelpTask" name="pyrushelp"/>
<taskdef classname="PhingPyrus.Task.PyrusExecTask" name="pyrusexec"/>
<!--
<includepath classpath="../Phing-QueryPath/src"/>
<taskdef classname="PhingQueryPath.Task.QueryPathReplacementTask" name="qpreplace"/>
-->
<!-- Global properties -->
<property name="srcdir" value="./src"/>
<property name="testdir" value="./test"/>
<property name="builddir" value="./bin/build"/>
<property name="docsdir" value="./doc"/>
<property name="packagedir" value="./dist"/>
<property name="phardir" value="./phar"/>
<property name="pirum.channel.path" value="../pear.querypath.org/pear"/>
<!-- ported from PhingPyrus -->
<property name="pear.channel" value="pear.querypath.org"/>
<property name="projectname" value="QueryPath"/>
<!-- Too hard to link to, nav is very difficult. -->
<!-- property name="phpdoc.style" value="HTML:frames:phpedit"/ -->
<property name="phpdoc.style" value="HTML:frames:earthli"/>
<!-- Files that must be included in the release -->
<fileset id="licensefiles" dir=".">
<include name="README"/>
<include name="INSTALL"/>
<include name="LGPL-2.1.txt"/>
<include name="COPYING-LGPL.txt"/>
<include name="COPYING-MIT.txt"/>
<include name="RELEASE"/>
<include name="API"/>
<include name="CREDITS"/>
</fileset>
<!-- Files to be treated as source code -->
<fileset id="sourcecode" dir="${srcdir}">
<include name="**/*.php" />
</fileset>
<!-- Unit tests and auxilliary files -->
<fileset id="unittests" dir="${testdir}/Tests">
<include name="**/*Test.php" />
</fileset>
<!-- Examples -->
<fileset id="examplecode" dir="./examples">
<include name="**/*" />
</fileset>
<!-- DocBook Tutorials -->
<fileset id="tutorials" dir="./tutorials">
<include name="**/*" />
</fileset>
<!-- Documentation -->
<fileset id="docs" dir="${docsdir}">
<include name="**/*" />
</fileset>
<!-- BUILD: The primary build target. -->
<target name="build" depends="lint, setup, prebuild, docBuild, minimalBuild, fullBuild, pharBuild, pearPkg"
description="Generate docs, minimal, and full builds and then creates packages."
></target>
<!-- Target that should be run always. -->
<target name="setup" description="Run required configuration for any build.">
<tstamp/>
<!-- Default version -->
<property name="version" value="dev-${DSTAMP}"/>
</target>
<!-- tasks to do before any build. -->
<target name="prebuild">
<mkdir dir="./dist"/>
</target>
<!-- Build just the minimal package -->
<target name="minimalBuild" description="Minimal QueryPath build."
depends="setup,prebuild">
<property name="releasedir" value="${builddir}/QueryPath-${version}-minimal" override="true"/>
<echo>${releasedir}</echo>
<delete dir="${releasedir}" />
<mkdir dir="${releasedir}"/>
<copy todir="${releasedir}">
<filterchain>
<stripphpcomments/>
<!-- Removed per issue #20 -->
<!-- stripwhitespace/ -->
<replacetokens begintoken="-" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
</replacetokens>
</filterchain>
<fileset dir="${srcdir}/QueryPath">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${releasedir}">
<fileset refid="licensefiles"/>
</copy>
<tar destfile="${packagedir}/QueryPath-${version}-minimal.tgz"
compression="gzip">
<fileset dir="${builddir}">
<include name="QueryPath-${version}-minimal/**/*"/>
</fileset>
</tar>
<zip destfile="${packagedir}/QueryPath-${version}-minimal.zip" basedir="${releasedir}"/>
</target>
<!-- Build the full package -->
<target name="fullBuild" description="Full QueryPath build, including docs."
depends="setup,prebuild">
<property name="releasedir" value="${builddir}/QueryPath-${version}" override="true"/>
<delete dir="${releasedir}" />
<!-- Make all necessary directories. -->
<mkdir dir="${releasedir}"/>
<mkdir dir="${releasedir}/src"/>
<mkdir dir="${releasedir}/examples"/>
<mkdir dir="${releasedir}/tests"/>
<mkdir dir="${releasedir}/tutorials"/>
<mkdir dir="${releasedir}/doc"/>
<!-- Copy license files. -->
<copy todir="${releasedir}">
<fileset refid="licensefiles"/>
</copy>
<!-- Copy source code, doing token replacement on version. -->
<copy todir="${releasedir}/src">
<filterchain>
<replacetokens begintoken="-" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
</replacetokens>
</filterchain>
<fileset refid="sourcecode"/>
</copy>
<!-- Copy examples. -->
<copy todir="${releasedir}/examples">
<fileset refid="examplecode"/>
</copy>
<!-- Copy tests. -->
<copy todir="${releasedir}/tests">
<fileset refid="unittests"/>
</copy>
<!-- Copy tutorials -->
<copy todir="${releasedir}/tutorials">
<fileset refid="tutorials"/>
</copy>
<!-- Copy documentation -->
<copy todir="${releasedir}/doc">
<fileset refid="docs"/>
</copy>
<!-- Create tgz and zip versions. -->
<tar destfile="${packagedir}/QueryPath-${version}.tgz" compression="gzip">
<fileset dir="${builddir}">
<include name="QueryPath-${version}/**/*"/>
</fileset>
</tar>
<zip destfile="${packagedir}/QueryPath-${version}.zip" basedir="${releasedir}"/>
</target>
<!-- Check syntax -->
<target name="lint" description="Check syntax of source.">
<phplint>
<fileset refid="sourcecode" />
</phplint>
</target>
<!-- Build documentation -->
<!--
output="HTML:Smarty:QueryPath"
-->
<target name="doc" depends="lint,setup" description="Generate API docs.">
<delete dir="${docsdir}"/>
<doxygen config="./config.doxy"/>
<!-- Need to replace version information in generated documentation -->
<reflexive>
<fileset refid="docs"/>
<filterchain>
<replacetokens begintoken="-" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
</replacetokens>
</filterchain>
</reflexive>
</target>
<!-- tmtarget for textmate phing -->
<target name="tmtarget" depends="ftest" description="Target for textmate"/>
<!-- Run a fast test and print the results to the console -->
<target name="ftest" description="Run a quick unit test." depends="pretest">
<!-- Fast test. -->
<phpunit>
<formatter type="summary" usefile="no"/>
<batchtest>
<fileset refid="unittests"/>
</batchtest>
</phpunit>
<delete file="./test/db/qpTest.db" />
<delete file="./test/db/qpTest2.db" />
</target>
<target name="pretest" description="tasks done before any unit testing.">
<mkdir dir="test/reports"/>
<mkdir dir="test/reports/html"/>
<mkdir dir="test/db"/>
<!-- touch file="./test/no-writing.xml" / -->
<chmod mode="444" file="./test/no-writing.xml"/>
</target>
<!-- Run a fast test and print the results to the console -->
<target name="tmtest" description="Run test, optimized for TextMate output." depends="pretest">
<!-- Fast test. -->
<phpunit>
<formatter todir="test/reports" type="xml" usefile="yes"/>
<batchtest>
<fileset refid="unittests"/>
</batchtest>
</phpunit>
<phpunitreport
infile="test/reports/testsuites.xml"
format="noframes"
todir="test/reports/html"
/>
<delete file="./test/db/qpTest.db" />
<delete file="./test/db/qpTest2.db" />
</target>
<!-- Run a coverage report -->
<target name="coverage" depends="lint" description="Run a coverage analysis.">
<coverage-setup database="./test/db/coverage.db">
<fileset dir="src">
<include name="QueryPath/*.php"/>
</fileset>
</coverage-setup>
<phpunit codecoverage="true" haltonfailure="true">
<formatter type="plain" todir="test/reports" outfile="coverage.xml"/>
<batchtest>
<fileset dir="test/Tests">
<include name="**/*Test.php"/>
</fileset>
</batchtest>
</phpunit>
<coverage-report outfile="test/reports/coverage.xml">
<report todir="test/coverage"/>
</coverage-report>
</target>
<!-- Run a full test and format an HTML report -->
<target name="test" depends="lint,pretest" description="Run full tests">
<mkdir dir="test/reports/html"/>
<mkdir dir="test/db"/>
<phpunit>
<formatter todir="test/reports" type="xml"/>
<batchtest>
<fileset dir="test/Tests">
<include name="**/*Test.php"/>
</fileset>
</batchtest>
</phpunit>
<phpunitreport
infile="test/reports/testsuites.xml"
format="frames"
todir="test/reports/html"
/>
<delete file="./test/db/qpTest.db" />
<delete file="./test/db/qpTest2.db" />
</target>
<target name="docBuild" description="Build a package containing just docs."
depends="setup,prebuild,doc">
<property name="releasedir" value="${builddir}/QueryPath-${version}-docs"/>
<delete dir="${releasedir}" />
<!-- Make all necessary directories. -->
<mkdir dir="${releasedir}"/>
<!-- Copy license files. -->
<copy todir="${releasedir}">
<fileset refid="licensefiles"/>
</copy>
<!-- Copy documentation -->
<copy todir="${releasedir}/doc">
<fileset refid="docs"/>
</copy>
<!-- Create tgz and zip versions. -->
<tar destfile="${packagedir}/QueryPath-${version}-docs.tgz" compression="gzip">
<fileset dir="${builddir}">
<include name="QueryPath-${version}-docs/**/*"/>
</fileset>
</tar>
<zip destfile="${packagedir}/QueryPath-${version}-docs.zip" basedir="${releasedir}"/>
</target>
<target name="pharBuild" depends="setup,prebuild">
<property name="releasedir" value="${builddir}/QueryPath-${version}-phar" override="true"/>
<echo>${releasedir}</echo>
<delete dir="${releasedir}" />
<mkdir dir="${releasedir}"/>
<copy todir="${releasedir}">
<filterchain>
<stripphpcomments/>
<stripwhitespace/>
<replacetokens begintoken="-" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
<token key="PHAR_FILENAME" value="QueryPath.phar"/>
</replacetokens>
</filterchain>
<fileset dir="${srcdir}/QueryPath">
<include name="**/*"/>
</fileset>
<fileset dir="${phardir}">
<include name="**/*.php"/>
</fileset>
</copy>
<copy todir="${releasedir}">
<fileset refid="licensefiles"/>
</copy>
<pharpackage
destfile="${packagedir}/QueryPath-${version}.phar"
basedir="${releasedir}"
stub="${releasedir}/basic_loader.php"
alias="QueryPath.phar">
<fileset dir="${releasedir}">
<include name="**/**"/>
</fileset>
<metadata>
<element name="version" value="${version}" />
<element name="authors">
<element name="M Butcher">
<element name="e-mail" value="[email protected]" />
</element>
</element>
</metadata>
</pharpackage>
</target>
<!-- Use Pyrus to generate package.xml files. -->
<target name="pyrusMake" depends="setup,prebuild">
</target>
<!-- Use Pyrus to create a PEAR package. -->
<target name="pyrusPackage" depends="setup,prebuild">
</target>
<!-- Requires PEAR_PackageFileManager2 -->
<target name="pearBuild" depends="setup,prebuild,setPearStability">
<property name="stability" value="stable"/>
<!-- Follow the pear naming conventions for builds -->
<if>
<equals arg1="${version}" arg2="dev-${DSTAMP}"/>
<then>
<property name="stability" value="devel" override="true"/>
<property name="version" value="2.1dev${DSTAMP}" override="true"/>
<echo>Setting version string to ${version}.</echo>
</then>
</if>
<!-- Create PEAR release directory -->
<property name="peardir" value="${builddir}/pear"/>
<property name="releasedir" value="${peardir}/QueryPath-${version}" override="true"/>
<echo>${releasedir}</echo>
<delete dir="${releasedir}" />
<mkdir dir="${releasedir}"/>
<mkdir dir="${releasedir}/doc"/>
<copy todir="${releasedir}/src">
<filterchain>
<!-- stripphpcomments/ -->
<!-- stripwhitespace/ -->
<replacetokens begintoken="-" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
</replacetokens>
</filterchain>
<fileset dir="${srcdir}">
<include name="**/*"/>
<exclude name="**/documentation.php"/>
</fileset>
</copy>
<copy todir="${releasedir}">
<fileset refid="licensefiles"/>
<fileset dir=".">
<include name="package.xml"/>
<include name="package_compatible.xml"/>
</fileset>
</copy>
<!-- Pyrus seems incapable of dealing with docs in it's 2.0.0a1 state.
<copy todir="${releasedir}/doc">
<fileset dir="${docsdir}">
<include name="**/*"/>
</fileset>
</copy>
-->
<copy file="./pear-summary.txt" tofile="${releasedir}/README"/>
<move file="${releasedir}/RELEASE" tofile="${releasedir}/RELEASE-${version}"/>
<move file="${releasedir}/API" tofile="${releasedir}/API-${version}"/>
<!-- Generate PEAR package. -->
<pyrusmake dir="${releasedir}" packagename="${projectname}" channel="${pear.channel}"/>
<pyruspackage packagexml="${releasedir}/package.xml"/>
<move file="${projectname}-${version}.tgz" tofile="${packagedir}/${projectname}-${version}.tgz"/>
<!--
<pearpkg2 name="QueryPath" dir="./">
<fileset dir="${releasedir}">
<include name="**/**"/>
</fileset>
<option name="uri" value="http://querypath.org"/>
<option name="packagefile" value="package2.xml"/>
<option name="channel" value="pear.querypath.org"/>
<option name="baseinstalldir" value="QueryPath"/>
<option name="summary" value="The QueryPath XML/HTML library"/>
<option name="description" value="QueryPath is a simple, powerful, robust library for working with XML, HTML, and HTTP. It is like jQuery for PHP. http://querypath.org"/>
<option name="apiversion" value="${version}"/>
<option name="apistability" value="${stability}"/>
<option name="releaseversion" value="${version}"/>
<option name="releasestability" value="${stability}"/>
<option name="license" value="LGPL 2 or MIT"/>
<option name="phpdep" value="5.0.0"/>
<option name="pearinstallerdep" value="1.4.6"/>
<option name="packagetype" value="php"/>
<option name="notes" value="Latest info is available at http://github.com/technosophos/querypath"/>
<option name="outputdirectory" value="./${builddir}"/>
<option name="packagedirectory" value="./${releasedir}"/>
<mapping name="maintainers">
<element>
<element key="handle" value="technosophos"/>
<element key="name" value="M Butcher"/>
<element key="email" value="[email protected]"/>
<element key="role" value="lead"/>
</element>
<element>
<element key="handle" value="eabrand"/>
<element key="name" value="Emily Brand"/>
<element key="email" value="[email protected]"/>
<element key="role" value="developer"/>
</element>
</mapping>
</pearpkg2>
-->
<!-- Copy the package.xml -->
<!-- move file="${builddir}/package2.xml" tofile="${peardir}/package.xml"/ -->
<!--
<tar destfile="${packagedir}/QueryPath-${version}.tgz" compression="gzip">
<fileset dir="./${peardir}">
<include name="QueryPath-${version}/**/*"/>
<include name="package.xml"/>
</fileset>
</tar>
-->
</target>
<target name="pearPkg" depends="pearBuild">
<echo>${packagedir}/QueryPath-${version}.tgz</echo>
<!--property name="pirumdir" value="${testdir}/fakepear"/-->
<property name="pirumdir" value="${pirum.channel.path}"/>
<pirumbuild targetdir="${pirumdir}"/>
<pirumadd targetdir="${pirumdir}" packagefile="${packagedir}/QueryPath-${version}.tgz"/>
</target>
<!--
This is an attempt to use the Pyrus builder to create a full package.
Let's see if it works.
-->
<!--
<target name="pyrusBuild" depends="setup,prebuild">
<property name="pyrusPath" value="~/Code/pyrus.phar"/>
<exec command="php ${pyrusPath}"/>
</target>
-->
<target name="setPearStability" depends="setup">
<property name="stability">stable</property>
<if>
<contains string="${version}" substring="dev"/>
<then>
<property name="stability" override="true">snapshot</property>
</then>
<elseif>
<contains string="${version}" substring="alpha"/>
<then>
<property name="stability" override="true">alpha</property>
</then>
</elseif>
<elseif>
<contains string="${version}" substring="beta"/>
<then>
<property name="stability" override="true">beta</property>
</then>
</elseif>
</if>
<echo>${stability}</echo>
</target>
</project>