-
Notifications
You must be signed in to change notification settings - Fork 69
/
build.xml
485 lines (447 loc) · 17.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
<project name="jing-trang" default="ant-jar">
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="doc.dir" value="${basedir}/doc"/>
<property name="moddir" value="mod"/>
<property name="modfile" value="mod.xml"/>
<target name="check-modules">
<uptodate property="modules-ok" targetfile="modules.xml">
<srcresources>
<dirset dir="mod" includes=".,*"/>
</srcresources>
</uptodate>
</target>
<target name="modules" depends="check-modules" unless="modules-ok">
<pathconvert property="modfrag" pathsep="</module>
<module>">
<fileset dir="${moddir}">
<include name="*/${modfile}"/>
</fileset>
<globmapper from="${basedir}/${moddir}/*/${modfile}"
to="*"
handledirsep="true"/>
</pathconvert>
<echo file="modules.xml" encoding="UTF-8"><modules>
<module>${modfrag}</module>
</modules></echo>
</target>
<target name="check-modbuild">
<uptodate property="modbuild-ok" targetfile="modbuild.xml">
<srcfiles dir="${moddir}" includes="*/${modfile}"/>
<srcfiles file="build.xsl"/>
<srcfiles file="modules.xml"/>
</uptodate>
</target>
<target name="modbuild" depends="modules,check-modbuild" unless="modbuild-ok">
<xslt style="build.xsl" in="modules.xml" out="modbuild.xml" force="true">
<classpath>
<fileset dir="lib">
<filename name="saxon9.jar"/>
</fileset>
</classpath>
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
</target>
<target name="ant-test" depends="modbuild">
<ant antfile="modbuild.xml" target="ant-test"/>
</target>
<target name="srczip" depends="modbuild">
<ant antfile="modbuild.xml" target="srczip"/>
</target>
<target name="ant-jar" depends="modbuild">
<ant antfile="modbuild.xml" target="ant-jar"/>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath>
<pathelement location="${build.dir}/jing.jar"/>
</classpath>
</taskdef>
</target>
<target name="compile" depends="modbuild">
<ant antfile="modbuild.xml" target="compile"/>
</target>
<target name="gen" depends="modbuild,iml">
<ant antfile="modbuild.xml" target="gen"/>
</target>
<target name="iml">
<xslt style="iml.xsl"
includes="${moddir}/*/${modfile}"
filedirparameter="name"
destdir=".">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<classpath>
<fileset dir="lib">
<filename name="saxon9.jar"/>
</fileset>
</classpath>
<regexpmapper from="mod/([-a-zA-Z0-9_]*)/mod.xml"
to="mod/\1/\1.iml"
handledirsep="true"/>
</xslt>
</target>
<target name="ant-init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/dist"/>
</target>
<target name="version">
<xmlproperty file="version.xml"/>
</target>
<target name="validate" depends="ant-jar" description="Validate all XML files" >
<jing rngfile="test/regextest.rnc" compactsyntax="true">
<fileset dir="test" includes="regextest.xml"/>
</jing>
<jing rngfile="xhtml/xhtml.rng">
<fileset dir="doc" includes="*.html,jing-bin/*.html,regex/*.html"/>
<fileset dir="datatype-sample" includes="index.html"/>
<fileset dir="test" includes="index.html"/>
<fileset dir="doc/compact" includes="*.html"/>
<fileset dir="." includes="copying.html"/>
<fileset dir="trang/doc" includes="*.html"/>
</jing>
<jing rngfile="eg/relaxng.rng">
<fileset dir="eg" includes="*.rng"/>
<fileset dir="xhtml" includes="**/*.rng"/>
</jing>
<jing rngfile="doc/compact/relaxng.rnc" compactsyntax="true">
<fileset dir="eg" includes="relaxng.rng"/>
</jing>
<jing rngfile="eg/xslt.rng">
<fileset dir="convert" includes="*.xsl"/>
</jing>
<jing rngfile="doc/design.rng">
<fileset dir="doc" includes="design.xml"/>
</jing>
<jing rngfile="doc/nrl.rng">
<fileset dir="doc" includes="nrl.xml"/>
</jing>
</target>
<path id="javadoc.sourcepath">
<pathelement location="mod/util/src/main"/>
<pathelement location="mod/datatype/src/main"/>
<pathelement location="mod/resolver/src/main"/>
<pathelement location="mod/rng-parse/src/main"/>
<pathelement location="mod/pattern/src/main"/>
<pathelement location="mod/validate/src/main"/>
<pathelement location="mod/rng-validate/src/main"/>
<pathelement location="mod/nvdl/src/main"/>
<pathelement location="mod/schematron/src/main"/>
<pathelement location="mod/xerces/src/main"/>
</path>
<property name="javadoc.packagenames"
value="com.thaiopensource.validate,
com.thaiopensource.validate.rng,
com.thaiopensource.validate.xerces,
com.thaiopensource.validate.schematron,
com.thaiopensource.validate.nrl,
com.thaiopensource.validate.auto,
com.thaiopensource.xml.sax,
com.thaiopensource.util"/>
<target name="ant-javadoc" depends="ant-init">
<mkdir dir="${build.dir}/api"/>
<mkdir dir="${build.dir}/api/datatype"/>
<mkdir dir="${build.dir}/api/jing"/>
<mkdir dir="${build.dir}/api/regex"/>
<javadoc sourcepath="mod/datatype/src/main" destdir="${build.dir}/api/datatype"
additionalparam="-html5 -Xdoclint:none"
doctitle="RELAX NG Datatype API" windowtitle="RELAX NG Datatype API"
packagenames="org.relaxng.datatype,org.relaxng.datatype.helpers">
<link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/"
packagelistLoc="extapidoc/jdk/1.5"/>
<classpath>
<fileset dir="lib/">
<include name="**/*.jar" />
</fileset>
<fileset dir="build/">
<include name="*.jar"/>
</fileset>
</classpath>
</javadoc>
<javadoc sourcepath="mod/util/src/main:mod/regex/src/main" destdir="${build.dir}/api/regex"
additionalparam="-html5 -Xdoclint:none"
packagenames="com.thaiopensource.datatype.xsd.regex,
com.thaiopensource.datatype.xsd.regex.java,
com.thaiopensource.datatype.xsd.regex.xerces2">
<link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/"
packagelistLoc="extapidoc/jdk/1.5"/>
<classpath>
<fileset dir="lib/">
<include name="**/*.jar" />
</fileset>
<fileset dir="build/">
<include name="*.jar"/>
</fileset>
</classpath>
</javadoc>
<javadoc sourcepathref="javadoc.sourcepath" destdir="${build.dir}/api/jing"
additionalparam="-html5 -Xdoclint:none"
doctitle="Jing API" windowtitle="Jing API"
packagenames="${javadoc.packagenames}">
<link offline="true" href="../datatype" packagelistLoc="${build.dir}/api/datatype"/>
<link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/"
packagelistLoc="extapidoc/jdk/1.5"/>
<classpath>
<fileset dir="lib/">
<include name="**/*.jar" />
</fileset>
<fileset dir="build/">
<include name="*.jar"/>
</fileset>
</classpath>
</javadoc>
</target>
<target name="doccheck" depends="ant-init">
<mkdir dir="${build.dir}/doccheck"/>
<javadoc sourcepathref="javadoc.sourcepath"
additionalparam="-html5 -Xdoclint:none"
destdir="${build.dir}/doccheck"
packagenames="${javadoc.packagenames}"
doclet="com.sun.tools.doclets.doccheck.DocCheck"
docletpath="${lib.dir}/doccheck.jar">
<classpath>
<fileset dir="lib/">
<include name="**/*.jar" />
</fileset>
<fileset dir="build/">
<include name="*.jar"/>
</fileset>
</classpath>
</javadoc>
</target>
<target name="datatype-sample" depends="ant-jar">
<ant dir="datatype-sample">
<property name="build.dir" value="${build.dir}/datatype-sample"/>
<property name="jing.jar" value="${build.dir}/jing.jar"/>
</ant>
</target>
<target name="jing-doc" depends="version">
<xslt basedir="doc" destdir="${build.dir}" includes="derivative.xml"
style="doc/derivative.xsl">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<classpath>
<fileset dir="lib">
<filename name="saxon9.jar"/>
</fileset>
</classpath>
</xslt>
<xslt basedir="doc" destdir="${build.dir}" includes="design.xml"
style="doc/design.xsl">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<classpath>
<fileset dir="lib">
<filename name="saxon9.jar"/>
</fileset>
</classpath>
</xslt>
<xslt basedir="doc" destdir="${build.dir}" includes="nrl.xml"
style="doc/nrl.xsl">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<classpath>
<fileset dir="lib">
<filename name="saxon9.jar"/>
</fileset>
</classpath>
</xslt>
<copy todir="${build.dir}">
<fileset dir="doc" includes="*.html"/>
</copy>
<replace file="${build.dir}/jing.html" token="@VERSION@" value="${version}"/>
</target>
<target name="jing-dist" depends="ant-init,ant-jar,ant-javadoc,jing-doc,datatype-sample,srczip,version">
<mkdir dir="${build.dir}/jing-bin"/>
<copy todir="${build.dir}/jing-bin">
<fileset dir="doc/jing-bin" includes="readme.html"/>
</copy>
<replace file="${build.dir}/jing-bin/readme.html" token="@VERSION@" value="${version}"/>
<zip zipfile="${build.dir}/dist/jing-${version}.zip">
<zipfileset dir="${build.dir}" includes="jing.jar" prefix="jing-${version}/bin"/>
<zipfileset dir="lib" includes="saxon9.jar,isorelax.jar,xercesImpl.jar,xml-apis.jar"
prefix="jing-${version}/bin"/>
<zipfileset dir="${build.dir}/mod/jing"
includes="src.zip"
prefix="jing-${version}"/>
<zipfileset dir="${build.dir}" includes="api/**" prefix="jing-${version}/doc"/>
<zipfileset dir="eg" includes="relaxng.rng,xslt.rng,relaxCore.rng,relaxCoreDatatypes.rng"
prefix="jing-${version}/lib"/>
<zipfileset dir="doc/compact" includes="relaxng.rnc" prefix="jing-${version}/lib"/>
<zipfileset dir="mod/schematron/src/main/com/thaiopensource/validate/schematron/resources"
includes="schematron.rnc"
prefix="jing-${version}/lib"/>
<zipfileset dir="mod/nvdl/src/main/com/thaiopensource/validate/mns/resources"
includes="mns.rng"
prefix="jing-${version}/lib"/>
<zipfileset dir="mod/nvdl/src/main/com/thaiopensource/validate/nrl/resources"
includes="nrl.rng"
prefix="jing-${version}/lib"/>
<zipfileset dir="." includes="xhtml/**/*.rng,xhtml/index.html" prefix="jing-${version}/lib"/>
<zipfileset dir="doc"
includes="jing-ant.html,jing-datatypes.html,jing-other.html,pluggable-datatypes.html"
prefix="jing-${version}/doc"/>
<zipfileset dir="${build.dir}"
includes="jing.html,nrl.html"
prefix="jing-${version}/doc"/>
<zipfileset dir="doc/jing-bin"
includes="copying.html"
prefix="jing-${version}/doc"/>
<zipfileset dir="lib"
includes="xerces.copying.txt,isorelax.copying.txt"
prefix="jing-${version}/doc"/>
<zipfileset dir="${build.dir}/jing-bin"
includes="readme.html"
prefix="jing-${version}"/>
<zipfileset dir="datatype-sample" prefix="jing-${version}/sample/datatype"/>
<zipfileset dir="${build.dir}/datatype-sample"
includes="datatype-sample.jar"
prefix="jing-${version}/sample/datatype"/>
</zip>
<checksum file="${build.dir}/dist/jing-${version}.zip" algorithm="sha1"/>
</target>
<target name="trang-doc" depends="version">
<copy todir="${build.dir}">
<fileset dir="trang" includes="copying.txt"/>
<fileset dir="trang/doc" includes="trang.html,trang-manual.html,convert-to-xsd-talk.html"/>
</copy>
<replace dir="${build.dir}"
includes="trang.html,trang-manual.html" token="@VERSION@" value="${version}"/>
</target>
<target name="trang-dist" depends="ant-init,ant-jar,trang-doc,srczip,version">
<zip zipfile="${build.dir}/dist/trang-${version}.zip">
<zipfileset dir="trang" includes="copying.txt" prefix="trang-${version}"/>
<zipfileset dir="${build.dir}"
includes="trang-manual.html"
prefix="trang-${version}"/>
<zipfileset dir="${build.dir}"
includes="trang.jar"
prefix="trang-${version}"/>
<zipfileset dir="${build.dir}/mod/trang"
includes="src.zip"
prefix="trang-${version}"/>
</zip>
<checksum file="${build.dir}/dist/trang-${version}.zip" algorithm="sha1"/>
</target>
<target name="dtdinst-doc" depends="version">
<mkdir dir="${build.dir}/dtdinst"/>
<mkdir dir="${build.dir}/dtdinst/example"/>
<copy todir="${build.dir}/dtdinst/example">
<fileset dir="dtdinst/example" includes="*.dtd"/>
<mapper type="glob" from="*.dtd" to="*.dtd.txt"/>
</copy>
<copy todir="${build.dir}/dtdinst/example">
<fileset dir="dtdinst/example" includes="*.ent,*.xml"/>
</copy>
<copy todir="${build.dir}/dtdinst">
<fileset dir="." includes="index.html,copying.txt,dtdinst2rng.xsl"/>
</copy>
<java classname="com.thaiopensource.relaxng.translate.Driver"
fork="true"
failonerror="yes"
classpath="${build.dir}/trang.jar">
<arg value="dtdinst/dtdinst.rnc"/>
<arg value="${build.dir}/dtdinst/dtdinst.rng"/>
</java>
<copy todir="${build.dir}/dtdinst">
<fileset dir="dtdinst" includes="index.html,copying.txt,dtdinst2rng.xsl"/>
</copy>
<copy file="dtdinst/dtdinst.rnc" tofile="${build.dir}/dtdinst/dtdinst.rnc.txt"/>
<copy file="dtdinst/teixml.dtd" tofile="${build.dir}/dtdinst/teixml.dtd.txt"/>
<replace file="${build.dir}/dtdinst/index.html"
token="@VERSION@"
value="${version}"/>
</target>
<target name="dtdinst-dist" depends="ant-init,ant-jar,dtdinst-doc,srczip,version">
<zip zipfile="${build.dir}/dist/dtdinst-${version}.zip">
<zipfileset dir="${build.dir}/dtdinst" prefix="dtdinst-${version}"/>
<zipfileset dir="${build.dir}"
includes="dtdinst.jar"
prefix="dtdinst-${version}"/>
<zipfileset dir="${build.dir}/mod/dtdinst"
includes="src.zip"
prefix="dtdinst-${version}"/>
</zip>
<checksum file="${build.dir}/dist/dtdinst-${version}.zip" algorithm="sha1"/>
</target>
<target name="website" depends="validate,ant-javadoc,datatype-sample,jing-doc,trang-doc,dtdinst-doc"
description="Build a .tar.gz containing the complete relaxng website" >
<copy todir="${build.dir}">
<fileset dir="." includes="xhtml/**/*.rng,xhtml/index.html"/>
<fileset dir="." includes="copying.html"/>
<fileset dir="convert" includes="from-relax.xsl,simplify.xsl"/>
<fileset dir="eg" includes="relaxng.rng,xslt.rng,relaxCore.rng,relaxCoreDatatypes.rng"/>
</copy>
<mkdir dir="${build.dir}/compact"/>
<copy todir="${build.dir}/compact">
<fileset dir="doc/compact" includes="*.html"/>
</copy>
<copy file="doc/compact/relaxng.rnc"
tofile="${build.dir}/compact/relaxng.rnc.txt"/>
<zip zipfile="${build.dir}/testSuite.zip">
<fileset dir="test" includes="index.html,split.xsl,saxon.xsl,prep.xml"/>
<fileset dir="mod/rng-validate/test" includes="spectest.xml"/>
<fileset dir="eg" includes="testSuite.rng"/>
</zip>
<tar tarfile="${build.dir}/relaxng.tar" basedir="${build.dir}"
includes="testSuite.zip,copying.txt,*.html,*.xsl,*.rng,xhtml/**,api/**,compact/**,dtdinst/**"/>
<gzip zipfile="${build.dir}/dist/relaxng.tar.gz" src="${build.dir}/relaxng.tar"/>
</target>
<target name="dist" depends="ant-test,validate,jing-dist,trang-dist,dtdinst-dist,website"
description="Make a distribution, leaving artifacts in ${build.dir}/dist"/>
<target name="googlecode.properties.available">
<available file="${user.home}/googlecode.properties"
property="googlecode.properties.available"/>
</target>
<target name="googlecode.properties"
depends="googlecode.properties.available"
if="googlecode.properties.available">
<property file="${user.home}/googlecode.properties"
prefix="googlecode"/>
</target>
<target name="googlecode.upload"
depends="version,googlecode.properties"
description="Upload files to Google Code. Run dist before this.">
<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask"
classpath="${lib.dir}/ant-googlecode.jar" name="gcupload"/>
<gcupload username="${googlecode.username}"
password="${googlecode.password}"
projectname="jing-trang"
targetfilename="jing-${version}.zip"
filename="${build.dir}/dist/jing-${version}.zip"
summary="Jing version ${version} packaged for use with JRE (includes binary, source and documentation)"
labels="Featured, Type-Archive, OpSys-All, Version-${version}"/>
<gcupload username="${googlecode.username}"
password="${googlecode.password}"
projectname="jing-trang"
targetfilename="trang-${version}.zip"
filename="${build.dir}/dist/trang-${version}.zip"
summary="Trang version ${version} packaged for use with JRE (includes binary, source and documentation)"
labels="Featured, Type-Archive, OpSys-All, Version-${version}"/>
<gcupload username="${googlecode.username}"
password="${googlecode.password}"
projectname="jing-trang"
targetfilename="dtdinst-${version}.zip"
filename="${build.dir}/dist/dtdinst-${version}.zip"
summary="DTDinst version ${version} packaged for use with JRE (includes binary, source and documentation)"
labels="Type-Archive, OpSys-All, Version-${version}"/>
</target>
<target name="ant-clean"
description="Remove almost all files created during the build process">
<delete dir="${build.dir}"/>
<exec executable="git">
<arg value="clean"/>
<arg value="-d"/>
<arg value="--force"/>
<arg value="${doc.dir}"/>
</exec>
</target>
<target name="realclean" depends="ant-clean"
description="Remove all files created during the build process">
<delete>
<fileset dir="mod" includes="*/*.iml"/>
<fileset file="modbuild.xml"/>
<fileset file="modules.xml"/>
</delete>
</target>
<target name="services" depends="modbuild"
description="Generate META-INF/services file in build directory">
<ant antfile="modbuild.xml" target="services"/>
</target>
<target name="echoproperties">
<echoproperties />
</target>
</project>