Update 'Total time' for 'defguide/zh/build.xml'.
[docbook-zh.git] / defguide / zh / build.xml
blobaa7c2af86a3ea6b5b6f0c543c4507f6bc96ff3bb
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 Usage:
4     Building 'The Definitive Guide' - html
5         $ ant html
7     Building 'The Definitive Guide' - pdf
8         $ ant pdf
10 Dependency:
11     *) jdk 1.6
12     *) ant 1.7
13     *) bsf 2.4
14     *) beanshell 2.0b4
15     *) saxon 6.5.5
16     *) RELAX NG Support(jing)
17     *) DocBook v5 XSL
18     *) python 2.5
19     *) python-libxml2 2.6.32 (Line number in the pot file is inaccurate if XML
20             file larger than 65535 lines, See:
21             http://bugzilla.gnome.org/show_bug.cgi?id=325533)
22     *) gettext 0.17
23     *) xep 4.1.4 or fop trunk 2008-12-19(r728025), pdf only
24     *) chinese font files, pdf only
25 -->
26 <project name="defguide" default="html">
28     <property file="build.properties"/>
30     <path id="lib.classpath">
31         <fileset dir="${ant.home}/lib">
32             <include name="*.jar"/>
33         </fileset>
34         <fileset dir="${fop.home}">
35             <include name="**/*.jar"/>
36         </fileset>
37         <fileset dir="${usr.share.java}">
38             <include name="**/*.jar"/>
39         </fileset>
40         <pathelement location="${usr.share.java}"/>
41     </path>
43     <path id="xep.classpath">
44         <fileset dir="${xep.home}/lib">
45             <include name="*.jar"/>
46         </fileset>
47     </path>
49     <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"/>
51     <target name="usage">
52         <echo message="Use the -projecthelp option instead"/>
53     </target>
55     <target name="clean" description="Clean the build directory">
56         <delete dir="build"/>
57     </target>
59     <target name="init" description="Check runtime configuration">
60         <echo message="java.version: ${java.version}"/>
62         <!--Java SE 1.4 & 1.5: Unfixed java.lang.StackOverflowError !-->
63         <!--
64         <condition property="jdk_ok">
65             <scriptcondition language="beanshell" value="true">
66             <![CDATA[
67                 jvm = System.getProperty("java.specification.version");
68                 if(jvm.compareTo("1.6") < 0)
69                     self.setValue(false);
70             ]]>
71             </scriptcondition>
72         </condition>
73         <fail unless="jdk_ok">
74             Must use Java SE 6+ !
75         </fail>
76         -->
78         <fail>
79             <condition>
80                 <not><available file="build.properties"/></not>
81             </condition>
82             Please create your build.properties from build.properties.tmpl !
83         </fail>
85         <fail>
86             <condition>
87                 <not><available classname="com.thaiopensource.relaxng.util.Driver"/></not>
88             </condition>
89             RELAX NG Support(jing) NOT Present !
90         </fail>
92         <fail>
93             <condition>
94                 <not><available classname="com.icl.saxon.StyleSheet" classpathref="lib.classpath"/></not>
95             </condition>
96             Saxon 6.5 Support NOT Present !
97         </fail>
98     </target>
100     <target name="validate" depends="init" description="Validate document">
101         <jing rngfile="${docbook5.home}/rng/docbook.rng" file="source/defguide.xml"/>
102         <!--Don't uncomment this unless xml2po support namespace !-->
103         <!--jing rngfile="${docbook5.home}/rng/docbook.rng"
104                 file="build/defguide-zh.xml"/-->
105     </target>
107     <target name="all" description="Generate document - pdf,html">
108         <antcall target="defguide"/>
109         <antcall target="pdf"/>
110         <antcall target="html"/>
111     </target>
113     <target name="po.init">
114         <uptodate property="po.isUpToDate" targetfile="po/zh.po">
115             <srcfiles dir="source" includes="defguide.xml"/>
116         </uptodate>
117     </target>
119     <!-- Total time: 29 minutes 12 seconds -->
120     <target name="updatepo" depends="po.init" unless="po.isUpToDate" description="Update PO file">
121         <echo message="Making defguide.pot ..."/>
122         <exec dir="${basedir}/po" executable="python" failonerror="true">
123             <arg value="../xml2po/xml2po.py"/>
124             <arg value="-o"/>
125             <arg value="defguide.pot"/>
126             <arg value="../source/defguide.xml"/>
127         </exec>
129         <echo message="Merging zh.po ..."/>
130         <exec dir="${basedir}" executable="msgmerge">
131             <arg value="--sort-by-file"/>
132             <arg value="--width=80"/>
133             <arg value="-o"/>
134             <arg value="po/zh.po.new"/>
135             <arg value="po/zh.po"/>
136             <arg value="po/defguide.pot"/>
137         </exec>
138         <move file="po/zh.po.new" tofile="po/zh.po"/>
139     </target>
141     <target name="translate.init" depends="updatepo">
142         <uptodate property="translate.isUpToDate" targetfile="build/defguide-zh.xml">
143             <srcfiles dir="source" includes="defguide.xml"/>
144             <srcfiles dir="po" includes="zh.po"/>
145         </uptodate>
146     </target>
148     <!-- Total time: 29 minutes 14 seconds -->
149     <target name="translate" depends="translate.init" unless="translate.isUpToDate"
150             description="Translate document">
151         <mkdir dir="build"/>
152         <echo message="Translating defguide-zh.xml ..."/>
153         <exec dir="${basedir}/xml2po" executable="python" failonerror="true">
154             <arg value="xml2po.py"/>
155             <arg value="-l"/>
156             <arg value="zh-cn"/>
157             <arg value="-p"/>
158             <arg value="../po/zh.po"/>
159             <arg value="-o"/>
160             <arg value="../build/defguide-zh.xml"/>
161             <arg value="../source/defguide.xml"/>
162         </exec>
163         <delete file="xml2po/.xml2po.mo"/>
164     </target>
166     <target name="html.init">
167         <uptodate property="html.isUpToDate" targetfile="build/html/.done">
168             <srcfiles dir="source" includes="defguide.xml"/>
169             <srcfiles dir="po" includes="zh.po"/>
170             <srcfiles dir="stylesheets" includes="html.xsl"/>
171             <srcfiles dir="stylesheets/zh" includes="html.xsl"/>
172         </uptodate>
173     </target>
175     <!-- Total time: 14 minutes 10 seconds -->
176     <target name="html" depends="init,translate,html.init" unless="html.isUpToDate"
177             description="Generate document - html">
178         <copy todir="build/schema">
179             <fileset dir="source/schema"/>
180         </copy>
181         <copy todir="build/html/images">
182             <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
183         </copy>
184         <copy todir="build/html/figures">
185             <fileset dir="source/figures"/>
186         </copy>
187         <copy todir="build/examples">
188             <fileset dir="../en/examples"/>
189         </copy>
191         <echo message="Making html ..."/>
192         <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
193                 failonerror="true" dir="${basedir}/build/html">
194             <jvmarg value="-Xss512k"/>
195             <classpath refid="lib.classpath"/>
196             <arg value="-x"/>
197             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
198             <arg value="-y"/>
199             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
200             <arg value="-r"/>
201             <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
202             <arg value="../defguide-zh.xml"/>
203             <arg value="../../stylesheets/zh/html.xsl"/>
204         </java>
205         <!--exec dir="${basedir}/build/html" executable="xsltproc" failonerror="true">
206             <arg value="- -nonet"/>
207             <arg value="../../stylesheets/zh/html.xsl"/>
208             <arg value="../defguide-zh.xml"/>
209         </exec-->
210         <touch file="build/html/.done"/>
211     </target>
213     <target name="pdf.init">
214         <uptodate property="pdf.isUpToDate" targetfile="build/defguide-zh.pdf">
215             <srcfiles dir="source" includes="defguide.xml"/>
216             <srcfiles dir="po" includes="zh.po"/>
217             <srcfiles dir="stylesheets" includes="fo.xsl"/>
218             <srcfiles dir="stylesheets/zh" includes="fo.xsl"/>
219         </uptodate>
220     </target>
222     <!-- Total time: 10 minutes 44 seconds -->
223     <target name="pdf" depends="init,translate,pdf.init" unless="pdf.isUpToDate"
224             description="Generate document - pdf">
225         <copy todir="build/schema">
226             <fileset dir="source/schema"/>
227         </copy>
228         <copy todir="build/images">
229             <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
230         </copy>
231         <copy todir="build/figures">
232             <fileset dir="source/figures" />
233         </copy>
234         <copy todir="build/examples">
235             <fileset dir="../en/examples"/>
236         </copy>
238         <echo message="Making fo ..."/>
239         <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
240                 failonerror="true" dir="${basedir}/build">
241             <jvmarg value="-Xss512k"/>
242             <classpath refid="lib.classpath"/>
243             <arg value="-x"/>
244             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
245             <arg value="-y"/>
246             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
247             <arg value="-r"/>
248             <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
249             <arg value="-o"/>
250             <arg value="defguide-zh.fo"/>
251             <arg value="defguide-zh.xml"/>
252             <arg value="../stylesheets/zh/fo.xsl"/>
253             <arg value="fop1.extensions=1"/>
254             <arg value="title.font.family=${fop.title.font.family}"/>
255             <arg value="body.font.family=${fop.body.font.family}"/>
256             <arg value="sans.font.family=${fop.sans.font.family}"/>
257             <arg value="ingbat.font.family=${fop.ingbat.font.family}"/>
258             <arg value="monospace.font.family=${fop.monospace.font.family}"/>
259         </java>
261         <echo message="Making pdf ..."/>
262         <java classname="${fop.class}" fork="true" maxmemory="1024m"
263                 failonerror="true" dir="${basedir}/build">
264             <classpath refid="lib.classpath"/>
265             <arg value="-c"/>
266             <arg value="${fop.home}/conf/userconfig.xml"/>
267             <arg value="defguide-zh.fo"/>
268             <arg value="defguide-zh.pdf"/>
269         </java>
270     </target>
272     <!-- Total time: 12 minutes 49 seconds -->
273     <target name="pdf-xep" depends="init,translate,pdf.init" unless="pdf.isUpToDate"
274             description="Generate document - pdf - xep">
275         <copy todir="build/schema">
276             <fileset dir="source/schema"/>
277         </copy>
278         <copy todir="build/images">
279             <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
280         </copy>
281         <copy todir="build/figures">
282             <fileset dir="source/figures" />
283         </copy>
284         <copy todir="build/examples">
285             <fileset dir="../en/examples"/>
286         </copy>
288         <echo message="Making fo ..."/>
289         <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
290                 failonerror="true" dir="${basedir}/build">
291             <jvmarg value="-Xss1m"/>
292             <classpath refid="lib.classpath"/>
293             <arg value="-x"/>
294             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
295             <arg value="-y"/>
296             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
297             <arg value="-r"/>
298             <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
299             <arg value="-o"/>
300             <arg value="defguide-zh.fo"/>
301             <arg value="defguide-zh.xml"/>
302             <arg value="../stylesheets/zh/fo.xsl"/>
303             <arg value="xep.extensions=1"/>
304         </java>
306         <echo message="Making pdf ..."/>
307         <java classname="com.renderx.xep.XSLDriver" fork="true" maxmemory="1536m"
308                 failonerror="true" dir="${basedir}/build">
309             <jvmarg value="-Xss512k"/>
310             <classpath refid="xep.classpath"/>
311             <arg value="-DCONFIG=${xep.home}/xep.xml"/>
312             <arg value="-quiet"/>
313             <arg value="defguide-zh.fo"/>
314             <arg value="defguide-zh.pdf"/>
315         </java>
316     </target>
318     <target name="defguide.init">
319         <uptodate property="defguide.isUpToDate" targetfile="build/defguide.pdf">
320             <srcfiles dir="source" includes="defguide.xml"/>
321         </uptodate>
322     </target>
324     <!-- Total time: 12 minutes 14 seconds -->
325     <target name="defguide" depends="init,defguide.init" unless="defguide.isUpToDate"
326             description="Generate document - defguide(en)">
327         <copy todir="build/schema">
328             <fileset dir="source/schema"/>
329         </copy>
330         <copy todir="build/images">
331             <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
332         </copy>
333         <copy todir="build/figures">
334             <fileset dir="source/figures" />
335         </copy>
336         <copy todir="build/examples">
337             <fileset dir="../en/examples"/>
338         </copy>
339         <copy file="source/defguide.xml" todir="build"/>
341         <echo message="Making fo ..."/>
342         <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
343                 failonerror="true" dir="${basedir}/build">
344             <jvmarg value="-Xss512k"/>
345             <classpath refid="lib.classpath"/>
346             <arg value="-x"/>
347             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
348             <arg value="-y"/>
349             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
350             <arg value="-r"/>
351             <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
352             <arg value="-o"/>
353             <arg value="defguide.fo"/>
354             <arg value="defguide.xml"/>
355             <arg value="../stylesheets/fo.xsl"/>
356             <arg value="fop1.extensions=1"/>
357             <arg value="title.font.family=${fop.title.font.family}"/>
358             <arg value="body.font.family=${fop.body.font.family}"/>
359             <arg value="sans.font.family=${fop.sans.font.family}"/>
360             <arg value="ingbat.font.family=${fop.ingbat.font.family}"/>
361             <arg value="monospace.font.family=${fop.monospace.font.family}"/>
362         </java>
364         <echo message="Making pdf ..."/>
365         <java classname="${fop.class}" fork="true" maxmemory="1024m"
366                 failonerror="true" dir="${basedir}/build">
367             <classpath refid="lib.classpath"/>
368             <arg value="-c"/>
369             <arg value="${fop.home}/conf/userconfig.xml"/>
370             <arg value="defguide.fo"/>
371             <arg value="defguide.pdf"/>
372         </java>
373     </target>
375     <!-- Total time: 14 minutes 57 seconds -->
376     <target name="defguide-xep" depends="init,defguide.init" unless="defguide.isUpToDate"
377             description="Generate document - defguide(en) - xep">
378         <copy todir="build/schema">
379             <fileset dir="source/schema"/>
380         </copy>
381         <copy todir="build/images">
382             <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
383         </copy>
384         <copy todir="build/figures">
385             <fileset dir="source/figures" />
386         </copy>
387         <copy todir="build/examples">
388             <fileset dir="../en/examples"/>
389         </copy>
390         <copy file="source/defguide.xml" todir="build"/>
392         <echo message="Making fo ..."/>
393         <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
394                 failonerror="true" dir="${basedir}/build">
395             <jvmarg value="-Xss1m"/>
396             <classpath refid="lib.classpath"/>
397             <arg value="-x"/>
398             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
399             <arg value="-y"/>
400             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
401             <arg value="-r"/>
402             <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
403             <arg value="-o"/>
404             <arg value="defguide.fo"/>
405             <arg value="defguide.xml"/>
406             <arg value="../stylesheets/fo.xsl"/>
407             <arg value="xep.extensions=1"/>
408         </java>
410         <echo message="Making pdf ..."/>
411         <java classname="com.renderx.xep.XSLDriver" fork="true" maxmemory="1536m"
412                 failonerror="true" dir="${basedir}/build">
413             <jvmarg value="-Xss512k"/>
414             <classpath refid="xep.classpath"/>
415             <arg value="-DCONFIG=${xep.home}/xep.xml"/>
416             <arg value="-quiet"/>
417             <arg value="defguide.fo"/>
418             <arg value="defguide.pdf"/>
419         </java>
420     </target>
422     <target name="defguide-html.init">
423         <uptodate property="defguide-html.isUpToDate" targetfile="build/defguide/.done">
424             <srcfiles dir="source" includes="defguide.xml"/>
425             <srcfiles dir="stylesheets" includes="html.xsl"/>
426         </uptodate>
427     </target>
429     <!-- Total time: ?? minutes ?? seconds -->
430     <target name="defguide-html" depends="init,defguide-html.init" unless="defguide-html.isUpToDate"
431             description="Generate document - defguide(en) - html">
432         <copy todir="build/schema">
433             <fileset dir="source/schema"/>
434         </copy>
435         <copy todir="build/defguide/images">
436             <fileset dir="${docbook.xsl}/images" includes="**/*.png"/>
437         </copy>
438         <copy todir="build/defguide/figures">
439             <fileset dir="source/figures" />
440         </copy>
441         <copy todir="build/examples">
442             <fileset dir="../en/examples"/>
443         </copy>
444         <copy file="source/defguide.xml" todir="build"/>
446         <echo message="Making html ..."/>
447         <java classname="com.icl.saxon.StyleSheet" fork="true" maxmemory="1024m"
448                 failonerror="true" dir="${basedir}/build/defguide">
449             <jvmarg value="-Xss512k"/>
450             <classpath refid="lib.classpath"/>
451             <arg value="-x"/>
452             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
453             <arg value="-y"/>
454             <arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
455             <arg value="-r"/>
456             <arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
457             <arg value="../../source/defguide.xml"/>
458             <arg value="../../stylesheets/html.xsl"/>
459         </java>
460         <touch file="build/defguide/.done"/>
461     </target>
462 </project>