File: build.xml

package info (click to toggle)
docbook-defguide 2.0.17%2Bsvn9912-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 93,432 kB
  • ctags: 299
  • sloc: xml: 396,482; perl: 4,471; python: 879; makefile: 150; sh: 80
file content (462 lines) | stat: -rw-r--r-- 18,087 bytes parent folder | download | duplicates (4)
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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Usage:
    Building 'The Definitive Guide' - html
        $ ant html

    Building 'The Definitive Guide' - pdf
        $ ant pdf

Dependency:
    *) jdk 1.6
    *) ant 1.7
    *) bsf 2.4
    *) beanshell 2.0b4
    *) saxon 6.5.5
    *) RELAX NG Support(jing)
    *) DocBook v5 XSL
    *) python 2.5
    *) python-libxml2 2.6.32 (Line number in the pot file is inaccurate if XML
            file larger than 65535 lines, See:
            http://bugzilla.gnome.org/show_bug.cgi?id=325533)
    *) gettext 0.17
    *) xep 4.1.4 or fop trunk 2008-12-19(r728025), pdf only
    *) chinese font files, pdf only
-->
<project name="defguide" default="html">

    <property file="build.properties"/>

    <path id="lib.classpath">
        <fileset dir="${ant.home}/lib">
            <include name="*.jar"/>
        </fileset>
        <fileset dir="${fop.home}">
            <include name="**/*.jar"/>
        </fileset>
        <fileset dir="${usr.share.java}">
            <include name="**/*.jar"/>
        </fileset>
        <pathelement location="${usr.share.java}"/>
    </path>

    <path id="xep.classpath">
        <fileset dir="${xep.home}/lib">
            <include name="*.jar"/>
        </fileset>
    </path>

    <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"/>

    <target name="usage">
        <echo message="Use the -projecthelp option instead"/>
    </target>

    <target name="clean" description="Clean the build directory">
        <delete dir="build"/>
    </target>

    <target name="init" description="Check runtime configuration">
        <echo message="java.version: ${java.version}"/>

        <!--Java SE 1.4 & 1.5: Unfixed java.lang.StackOverflowError !-->
        <!--
        <condition property="jdk_ok">
            <scriptcondition language="beanshell" value="true">
            <![CDATA[
                jvm = System.getProperty("java.specification.version");
                if(jvm.compareTo("1.6") < 0)
                    self.setValue(false);
            ]]>
            </scriptcondition>
        </condition>
        <fail unless="jdk_ok">
            Must use Java SE 6+ !
        </fail>
        -->

        <fail>
            <condition>
                <not><available file="build.properties"/></not>
            </condition>
            Please create your build.properties from build.properties.tmpl !
        </fail>

        <fail>
            <condition>
                <not><available classname="com.thaiopensource.relaxng.util.Driver"/></not>
            </condition>
            RELAX NG Support(jing) NOT Present !
        </fail>

        <fail>
            <condition>
                <not><available classname="com.icl.saxon.StyleSheet" classpathref="lib.classpath"/></not>
            </condition>
            Saxon 6.5 Support NOT Present !
        </fail>
    </target>

    <target name="validate" depends="init" description="Validate document">
        <jing rngfile="${docbook5.home}/rng/docbook.rng" file="source/defguide.xml"/>
        <!--Don't uncomment this unless xml2po support namespace !-->
        <!--jing rngfile="${docbook5.home}/rng/docbook.rng"
                file="build/defguide-zh.xml"/-->
    </target>

    <target name="all" description="Generate document - pdf,html">
        <antcall target="defguide"/>
        <antcall target="pdf"/>
        <antcall target="html"/>
    </target>

    <target name="po.init">
        <uptodate property="po.isUpToDate" targetfile="po/zh.po">
            <srcfiles dir="source" includes="defguide.xml"/>
        </uptodate>
    </target>

    <!-- Total time: 29 minutes 12 seconds -->
    <target name="updatepo" depends="po.init" unless="po.isUpToDate" description="Update PO file">
        <echo message="Making defguide.pot ..."/>
        <exec dir="${basedir}/po" executable="python" failonerror="true">
            <arg value="../xml2po/xml2po.py"/>
            <arg value="-o"/>
            <arg value="defguide.pot"/>
            <arg value="../source/defguide.xml"/>
        </exec>

        <echo message="Merging zh.po ..."/>
        <exec dir="${basedir}" executable="msgmerge">
            <arg value="--sort-by-file"/>
            <arg value="--width=80"/>
            <arg value="-o"/>
            <arg value="po/zh.po.new"/>
            <arg value="po/zh.po"/>
            <arg value="po/defguide.pot"/>
        </exec>
        <move file="po/zh.po.new" tofile="po/zh.po"/>
    </target>

    <target name="translate.init" depends="updatepo">
        <uptodate property="translate.isUpToDate" targetfile="build/defguide-zh.xml">
            <srcfiles dir="source" includes="defguide.xml"/>
            <srcfiles dir="po" includes="zh.po"/>
        </uptodate>
    </target>

    <!-- Total time: 29 minutes 14 seconds -->
    <target name="translate" depends="translate.init" unless="translate.isUpToDate"
            description="Translate document">
        <mkdir dir="build"/>
        <echo message="Translating defguide-zh.xml ..."/>
        <exec dir="${basedir}/xml2po" executable="python" failonerror="true">
            <arg value="xml2po.py"/>
            <arg value="-l"/>
            <arg value="zh-cn"/>
            <arg value="-p"/>
            <arg value="../po/zh.po"/>
            <arg value="-o"/>
            <arg value="../build/defguide-zh.xml"/>
            <arg value="../source/defguide.xml"/>
        </exec>
        <delete file="xml2po/.xml2po.mo"/>
    </target>

    <target name="html.init">
        <uptodate property="html.isUpToDate" targetfile="build/html/.done">
            <srcfiles dir="source" includes="defguide.xml"/>
            <srcfiles dir="po" includes="zh.po"/>
            <srcfiles dir="stylesheets" includes="html.xsl"/>
            <srcfiles dir="stylesheets/zh" includes="html.xsl"/>
        </uptodate>
    </target>

    <!-- Total time: 14 minutes 10 seconds -->
    <target name="html" depends="init,translate,html.init" unless="html.isUpToDate"
            description="Generate document - html">
        <copy todir="build/schema">
            <fileset dir="source/schema"/>
        </copy>
        <copy todir="build/html/images">
            <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
        </copy>
        <copy todir="build/html/figures">
            <fileset dir="source/figures"/>
        </copy>
        <copy todir="build/examples">
            <fileset dir="../en/examples"/>
        </copy>

        <echo message="Making html ..."/>
        <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
                failonerror="true" dir="${basedir}/build/html">
            <jvmarg value="-Xss512k"/>
            <classpath refid="lib.classpath"/>
            <arg value="-x"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-y"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-r"/>
            <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
            <arg value="../defguide-zh.xml"/>
            <arg value="../../stylesheets/zh/html.xsl"/>
        </java>
        <!--exec dir="${basedir}/build/html" executable="xsltproc" failonerror="true">
            <arg value="- -nonet"/>
            <arg value="../../stylesheets/zh/html.xsl"/>
            <arg value="../defguide-zh.xml"/>
        </exec-->
        <touch file="build/html/.done"/>
    </target>

    <target name="pdf.init">
        <uptodate property="pdf.isUpToDate" targetfile="build/defguide-zh.pdf">
            <srcfiles dir="source" includes="defguide.xml"/>
            <srcfiles dir="po" includes="zh.po"/>
            <srcfiles dir="stylesheets" includes="fo.xsl"/>
            <srcfiles dir="stylesheets/zh" includes="fo.xsl"/>
        </uptodate>
    </target>

    <!-- Total time: 10 minutes 44 seconds -->
    <target name="pdf" depends="init,translate,pdf.init" unless="pdf.isUpToDate"
            description="Generate document - pdf">
        <copy todir="build/schema">
            <fileset dir="source/schema"/>
        </copy>
        <copy todir="build/images">
            <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
        </copy>
        <copy todir="build/figures">
            <fileset dir="source/figures" />
        </copy>
        <copy todir="build/examples">
            <fileset dir="../en/examples"/>
        </copy>

        <echo message="Making fo ..."/>
        <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
                failonerror="true" dir="${basedir}/build">
            <jvmarg value="-Xss512k"/>
            <classpath refid="lib.classpath"/>
            <arg value="-x"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-y"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-r"/>
            <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
            <arg value="-o"/>
            <arg value="defguide-zh.fo"/>
            <arg value="defguide-zh.xml"/>
            <arg value="../stylesheets/zh/fo.xsl"/>
            <arg value="fop1.extensions=1"/>
            <arg value="title.font.family=${fop.title.font.family}"/>
            <arg value="body.font.family=${fop.body.font.family}"/>
            <arg value="sans.font.family=${fop.sans.font.family}"/>
            <arg value="ingbat.font.family=${fop.ingbat.font.family}"/>
            <arg value="monospace.font.family=${fop.monospace.font.family}"/>
        </java>

        <echo message="Making pdf ..."/>
        <java classname="${fop.class}" fork="true" maxmemory="1024m"
                failonerror="true" dir="${basedir}/build">
            <classpath refid="lib.classpath"/>
            <arg value="-c"/>
            <arg value="${fop.home}/conf/userconfig.xml"/>
            <arg value="defguide-zh.fo"/>
            <arg value="defguide-zh.pdf"/>
        </java>
    </target>

    <!-- Total time: 12 minutes 49 seconds -->
    <target name="pdf-xep" depends="init,translate,pdf.init" unless="pdf.isUpToDate"
            description="Generate document - pdf - xep">
        <copy todir="build/schema">
            <fileset dir="source/schema"/>
        </copy>
        <copy todir="build/images">
            <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
        </copy>
        <copy todir="build/figures">
            <fileset dir="source/figures" />
        </copy>
        <copy todir="build/examples">
            <fileset dir="../en/examples"/>
        </copy>

        <echo message="Making fo ..."/>
        <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
                failonerror="true" dir="${basedir}/build">
            <jvmarg value="-Xss1m"/>
            <classpath refid="lib.classpath"/>
            <arg value="-x"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-y"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-r"/>
            <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
            <arg value="-o"/>
            <arg value="defguide-zh.fo"/>
            <arg value="defguide-zh.xml"/>
            <arg value="../stylesheets/zh/fo.xsl"/>
            <arg value="xep.extensions=1"/>
        </java>

        <echo message="Making pdf ..."/>
        <java classname="com.renderx.xep.XSLDriver" fork="true" maxmemory="1536m"
                failonerror="true" dir="${basedir}/build">
            <jvmarg value="-Xss512k"/>
            <classpath refid="xep.classpath"/>
            <arg value="-DCONFIG=${xep.home}/xep.xml"/>
            <arg value="-quiet"/>
            <arg value="defguide-zh.fo"/>
            <arg value="defguide-zh.pdf"/>
        </java>
    </target>

    <target name="defguide.init">
        <uptodate property="defguide.isUpToDate" targetfile="build/defguide.pdf">
            <srcfiles dir="source" includes="defguide.xml"/>
        </uptodate>
    </target>

    <!-- Total time: 12 minutes 14 seconds -->
    <target name="defguide" depends="init,defguide.init" unless="defguide.isUpToDate"
            description="Generate document - defguide(en)">
        <copy todir="build/schema">
            <fileset dir="source/schema"/>
        </copy>
        <copy todir="build/images">
            <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
        </copy>
        <copy todir="build/figures">
            <fileset dir="source/figures" />
        </copy>
        <copy todir="build/examples">
            <fileset dir="../en/examples"/>
        </copy>
        <copy file="source/defguide.xml" todir="build"/>

        <echo message="Making fo ..."/>
        <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
                failonerror="true" dir="${basedir}/build">
            <jvmarg value="-Xss512k"/>
            <classpath refid="lib.classpath"/>
            <arg value="-x"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-y"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-r"/>
            <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
            <arg value="-o"/>
            <arg value="defguide.fo"/>
            <arg value="defguide.xml"/>
            <arg value="../stylesheets/fo.xsl"/>
            <arg value="fop1.extensions=1"/>
            <arg value="title.font.family=${fop.title.font.family}"/>
            <arg value="body.font.family=${fop.body.font.family}"/>
            <arg value="sans.font.family=${fop.sans.font.family}"/>
            <arg value="ingbat.font.family=${fop.ingbat.font.family}"/>
            <arg value="monospace.font.family=${fop.monospace.font.family}"/>
        </java>

        <echo message="Making pdf ..."/>
        <java classname="${fop.class}" fork="true" maxmemory="1024m"
                failonerror="true" dir="${basedir}/build">
            <classpath refid="lib.classpath"/>
            <arg value="-c"/>
            <arg value="${fop.home}/conf/userconfig.xml"/>
            <arg value="defguide.fo"/>
            <arg value="defguide.pdf"/>
        </java>
    </target>

    <!-- Total time: 14 minutes 57 seconds -->
    <target name="defguide-xep" depends="init,defguide.init" unless="defguide.isUpToDate"
            description="Generate document - defguide(en) - xep">
        <copy todir="build/schema">
            <fileset dir="source/schema"/>
        </copy>
        <copy todir="build/images">
            <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
        </copy>
        <copy todir="build/figures">
            <fileset dir="source/figures" />
        </copy>
        <copy todir="build/examples">
            <fileset dir="../en/examples"/>
        </copy>
        <copy file="source/defguide.xml" todir="build"/>

        <echo message="Making fo ..."/>
        <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
                failonerror="true" dir="${basedir}/build">
            <jvmarg value="-Xss1m"/>
            <classpath refid="lib.classpath"/>
            <arg value="-x"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-y"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-r"/>
            <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
            <arg value="-o"/>
            <arg value="defguide.fo"/>
            <arg value="defguide.xml"/>
            <arg value="../stylesheets/fo.xsl"/>
            <arg value="xep.extensions=1"/>
        </java>

        <echo message="Making pdf ..."/>
        <java classname="com.renderx.xep.XSLDriver" fork="true" maxmemory="1536m"
                failonerror="true" dir="${basedir}/build">
            <jvmarg value="-Xss512k"/>
            <classpath refid="xep.classpath"/>
            <arg value="-DCONFIG=${xep.home}/xep.xml"/>
            <arg value="-quiet"/>
            <arg value="defguide.fo"/>
            <arg value="defguide.pdf"/>
        </java>
    </target>

    <target name="defguide-html.init">
        <uptodate property="defguide-html.isUpToDate" targetfile="build/defguide/.done">
            <srcfiles dir="source" includes="defguide.xml"/>
            <srcfiles dir="stylesheets" includes="html.xsl"/>
        </uptodate>
    </target>

    <!-- Total time: 15 minutes 57 seconds -->
    <target name="defguide-html" depends="init,defguide-html.init" unless="defguide-html.isUpToDate"
            description="Generate document - defguide(en) - html">
        <copy todir="build/schema">
            <fileset dir="source/schema"/>
        </copy>
        <copy todir="build/defguide/images">
            <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
        </copy>
        <copy todir="build/defguide/figures">
            <fileset dir="source/figures" />
        </copy>
        <copy todir="build/examples">
            <fileset dir="../en/examples"/>
        </copy>
        <copy file="source/defguide.xml" todir="build"/>

        <echo message="Making html ..."/>
        <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
                failonerror="true" dir="${basedir}/build/defguide">
            <jvmarg value="-Xss512k"/>
            <classpath refid="lib.classpath"/>
            <arg value="-x"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-y"/>
            <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
            <arg value="-r"/>
            <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
            <arg value="../defguide.xml"/>
            <arg value="../../stylesheets/html.xsl"/>
        </java>
        <touch file="build/defguide/.done"/>
    </target>
</project>