source: trunk/lib/docbook/ant-build-docbook.xml @ 3174

Last change on this file since 3174 was 3174, checked in by Nicklas Nordborg, 15 years ago

Fixed problem with building docbook in windows.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 29.4 KB
Line 
1<?xml version="1.0" encoding="UTF-8" ?>
2
3<project name="Docbook styler module for ANT" default="help" basedir=".">
4  <property name="undefined"               value="__UNDEFINED__VALUE__" />
5
6  <!-- ## (DW 20040307) Added explicit property 'ant.docbook.styler.dir'. This
7       will be autoinitialized by default, but just in case somebody wants to
8       override the defaults...
9    -->
10  <property name="ant.docbook.styler.dir"  value="${basedir}" />
11
12  <!-- A directory where your docbook XMLs are -->
13  <property name="docbook.xml.dir"         value="${undefined}" />
14 
15  <!-- A directory where all the figures are -->
16  <property name="docbook.resources.dir"   value="${undefined}" />
17 
18  <!-- A directory for output files -->
19  <property name="distribution.dir"        location="${undefined}" />
20
21  <!-- A temp directory -->
22  <property name="build.dir"               location="${undefined}" />
23
24  <!-- Output file name for the rendered docbook file -->
25  <property name="manual.name"             value="index" />
26 
27  <!-- Start file for Docbook processing. -->
28  <property name="index.name"              value="${manual.name}" />
29 
30  <property name="docbook.style"           value="plain" />
31  <property name="website.style"           value="plain" />
32
33  <!-- website rendering -->
34  <property name="website.xml.dir"         value="${undefined}" />
35
36  <!-- ## override these properties, if needed -->
37  <property name="temp:docbook.ready.file" location="${build.dir}/docbook-ready-file.tmp"/>
38  <property name="temp:fo.ready.file"      location="${build.dir}/fo-ready-file.tmp" />
39  <!-- ## (MM 20040303) moved all styles (for docbook and for website into sub-folders
40       ## of the styles folder -->
41  <property name="docbook.styles"          location="${ant.docbook.styler.dir}/custom-styles/docbook" />
42  <!-- ## (MM 20040303) added parameter for finding the styles folder for website projects -->
43  <property name="website.styles"          location="${ant.docbook.styler.dir}/custom-styles/website" />
44
45  <path id="ant-extensions">
46    <fileset dir="${ant.docbook.styler.dir}/ant-extensions" includes="**/*.jar" />
47    <pathelement path="${ant.docbook.styler.dir}/ant-extensions" />
48  </path>
49
50  <!-- ##################################### -->
51  <!-- ### {{{ CHECK REQUIRED PROPS      ### -->
52  <!-- ##################################### -->
53 
54  <target name="check.required-properties">
55 
56    <condition property="tmp:ant.docbook.styler.dir" value="true">
57        <and>
58            <!-- ## (dw 20040307) check that we really point at the base directory
59                 of ant-docbook-styler -->
60            <available file="${ant.docbook.styler.dir}" type="dir" />
61            <available file="${ant.docbook.styler.dir}/custom-styles" type="dir" />
62            <available file="${ant.docbook.styler.dir}/docbook" type="dir" />
63        </and>
64    </condition>
65    <fail message="### 'ant.docbook.styler.dir' does not point at the styler's installation directory: ${ant.docbook.styler.dir}"
66        unless="tmp:ant.docbook.styler.dir"/>
67 
68    <condition property="tmp:docbook.xml.dir.ok" value="true">
69        <and>
70            <not>
71                <equals arg1="${docbook.xml.dir}" arg2="${undefined}" />
72            </not>
73            <available file="${docbook.xml.dir}" type="dir" />
74        </and>
75    </condition>
76    <fail message="### Define 'docbook.xml.dir' property pointing at Docbook XMLs folder."
77          unless="tmp:docbook.xml.dir.ok" />
78
79    <condition property="tmp:docbook.resources.dir.ok" value="true">
80        <and>
81            <not>
82                <equals arg1="${docbook.resources.dir}" arg2="${undefined}" />
83            </not>
84            <available file="${docbook.resources.dir}" type="dir" />
85        </and>
86    </condition>
87    <fail message="### Define 'docbook.resources.dir' property pointing at your resources folder."
88          unless="tmp:docbook.resources.dir.ok" />
89
90    <condition property="tmp:docbook.startfile.ok" value="true">
91        <and>
92            <available file="${docbook.xml.dir}/${index.name}.xml" type="file" />
93        </and>
94    </condition>
95    <fail message="### Cannot find root docbook file: ${docbook.xml.dir}/${index.name}.xml"
96          unless="tmp:docbook.startfile.ok" />
97
98    <condition property="tmp:docbook.build.dir.ok" value="true">
99        <and>
100            <not>
101                <equals arg1="${build.dir}" arg2="${undefined}" />
102            </not>
103            <available file="${build.dir}" type="dir" />
104        </and>
105    </condition>
106    <fail message="### Define 'build.dir' property pointing at a temporary folder (will be erased!)."
107          unless="tmp:docbook.build.dir.ok" />         
108
109    <condition property="tmp:docbook.distribution.dir.ok" value="true">
110        <and>
111            <not>
112                <equals arg1="${distribution.dir}" arg2="${undefined}" />
113            </not>
114            <available file="${distribution.dir}" type="dir" />
115        </and>
116    </condition>
117    <fail message="### Define 'distribution.dir' property pointing at your destination folder."
118          unless="tmp:docbook.distribution.dir.ok" />         
119  </target>
120
121  <target name="check.expand.zips">
122  <!--
123    <antcall target="check.expand.docbook-distribution.zip" />
124    <antcall target="check.expand.website-distribution.zip" />
125   -->
126  </target>
127 
128  <target name="check.expand.docbook-distribution.zip">
129    <condition property="tmp:docbook.available" value="true">
130        <and>
131        <available file="${ant.docbook.styler.dir}/docbook/dtd" type="dir" />
132        <available file="${ant.docbook.styler.dir}/docbook/xsl/fo" type="dir" />
133        <available file="${ant.docbook.styler.dir}/docbook/xsl/html" type="dir" />
134        <uptodate srcfile="${ant.docbook.styler.dir}/docbook/docbook.zip" 
135              targetfile="${ant.docbook.styler.dir}/docbook/docbook.zip.tstamp" />
136        </and>
137    </condition>
138    <antcall target="expand.docbook-distribution.zip" />
139  </target>
140 
141  <target name="expand.docbook-distribution.zip" unless="tmp:docbook.available">
142    <echo>
143    #####################################################
144        UNPACKING OR UPGRADING DOCBOOK DISTRIBUTION
145    #####################################################
146    </echo>
147    <delete failonerror="false" quiet="true">
148        <fileset dir="docbook">
149        <include name="dtd/**" />
150        <include name="xsl/**" />
151        </fileset>
152    </delete>
153    <unzip src="docbook/docbook.zip" dest="docbook" overwrite="true" />
154   
155    <taskdef name="LastModifiedMillis" classname="LastModifiedMillis">
156        <classpath refid="ant-extensions" />
157    </taskdef>
158
159    <LastModifiedMillis file="docbook/docbook.zip" property="millis" />
160    <touch file="docbook/docbook.zip.tstamp" millis="${millis}" />
161  </target>
162 
163  <target name="clean">
164    <delete failonerror="false" quiet="true" includeEmptyDirs="true">
165        <fileset dir="docbook">
166        <include name="dtd/**" />
167        <include name="xsl/**" />
168        </fileset>
169    </delete>
170  </target> 
171
172  <target name="check.expand.website-distribution.zip">
173    <condition property="tmp:website.available" value="true">
174        <and>
175        <available file="${ant.docbook.styler.dir}/website/schema" type="dir" />
176        <available file="${ant.docbook.styler.dir}/website/schema/dtd" type="dir" />
177        <available file="${ant.docbook.styler.dir}/website/xsl" type="dir" />
178        <uptodate srcfile="${ant.docbook.styler.dir}/website/website.zip"
179              targetfile="${ant.docbook.styler.dir}/website/website.zip.tstamp" />
180        </and>
181    </condition>
182    <antcall target="expand.website-distribution.zip" />
183  </target>
184 
185  <target name="expand.website-distribution.zip" unless="tmp:website.available">
186    <echo>
187    #####################################################
188        UNPACKING OR UPGRADING WEBSITE DISTRIBUTION
189    #####################################################
190    </echo>
191    <delete failonerror="false" quiet="true">
192        <fileset dir="website">
193        <include name="schema/**" />
194        <include name="xsl/**" />
195        </fileset>
196    </delete>
197    <unzip src="website/website.zip" dest="website" overwrite="true" />
198   
199    <taskdef name="LastModifiedMillis" classname="LastModifiedMillis">
200        <classpath refid="ant-extensions" />
201    </taskdef>
202
203    <LastModifiedMillis file="website/website.zip" property="millis" />
204    <touch file="website/website.zip.tstamp" millis="${millis}" />
205  </target>
206  <!-- }}} -->
207
208
209  <!-- ##################################### -->
210  <!-- ### {{{ PREPARE OUTPUT PATHS      ### -->
211  <!-- ##################################### -->
212
213  <target name="prepare" depends="modules.detection,check.expand.zips, check.required-properties, xsltprocessor">
214  </target>
215 
216  <target name="modules.detection">
217    <available file="${ant.docbook.styler.dir}/module-fop" type="dir"
218               property="module.fop.present" value="true" />
219               
220    <available file="${ant.docbook.styler.dir}/module-xep" type="dir"
221               property="module.xep.present" value="true" />
222    <property file="${ant.docbook.styler.dir}/module-xep/xep-config.properties" />
223
224  </target>
225
226  <!-- }}} --> 
227
228
229  <!-- ########################################################## -->
230  <!-- ### {{{ Prepare for building with docbook              ### -->
231  <!-- ########################################################## -->
232  <target name="copyResources-distribution" unless="resources.nocopy">
233    <copy todir="${distribution.dir}/css" includeemptydirs="false">
234        <fileset dir="${docbook.styles}/${docbook.style}/css"/>
235    </copy>
236    <copy todir="${distribution.dir}/gfx/admonitions" includeemptydirs="false">
237        <fileset dir="${docbook.styles}/${docbook.style}/admonitions" />
238    </copy>
239    <copy todir="${distribution.dir}/figures" includeemptydirs="false">
240        <fileset dir="${docbook.resources.dir}" includes="**/*" />
241    </copy>
242  </target>
243  <target name="copyResources-build">
244    <copy todir="${build.dir}/css" includeemptydirs="false">
245        <fileset dir="${docbook.styles}/${docbook.style}/css"/>
246    </copy>
247    <copy todir="${build.dir}/gfx/admonitions" includeemptydirs="false">
248        <fileset dir="${docbook.styles}/${docbook.style}/admonitions" />
249    </copy>
250    <copy todir="${build.dir}/figures" includeemptydirs="false">
251        <fileset dir="${docbook.resources.dir}" includes="**/*" />
252    </copy>
253  </target>
254
255  <target name="disable.resources.copy">
256    <property name="resources.nocopy" value="true" />
257  </target>
258   
259  <target name="docbook.consolidate"
260          depends="prepare, copyResources-build, copyResources-distribution, create.styler.uri">
261
262    <copy todir="${build.dir}" overwrite="true" filtering="false">
263        <fileset dir="${docbook.xml.dir}" />
264    </copy>
265
266    <property name="catalog.location" location="${ant.docbook.styler.dir}/preprocess/catalog.xml" />
267   
268    <!-- (MM 20040314) make the Java XSLT use the same catalog as the XSLTProc -->
269    <!-- works only with ant 1.6 and newer, but avoids problems when upgrading
270         from Java XSLT to XSLTProc later                                      -->
271    <xmlcatalog id="dtdcatalog">
272            <catalogpath>
273                <fileset file="${catalog.location}"/>
274            </catalogpath>
275    </xmlcatalog>
276
277    <style
278        in      = "${build.dir}/${index.name}.xml"
279        style   = "${ant.docbook.styler.dir}/preprocess/preprocess.xsl"
280        out     = "${temp:docbook.ready.file}"
281        processor = "${xslt.processor}"
282        >
283        <xmlcatalog refid="dtdcatalog"/>
284        <classpath refid="ant-extensions" />
285
286        <!-- <param name="xsltproc.option.debug"  expression="" /> -->
287        <param name="xsltproc.catalog" expression="${catalog.location}" />
288        <param name="xsltproc.option.--nonet"  expression="" />
289    </style>
290  </target>
291  <!-- }}} -->
292
293
294  <!-- ########################################################## -->
295  <!-- ### {{{ builds PDF documentation using FOP             ### -->
296  <!-- ########################################################## -->
297  <property name="module.fop.basedir" location="${ant.docbook.styler.dir}/module-fop" />
298  <target name="pdf.fop" depends="modules.detection,pdf.fop.internal">
299    <fail unless="module.fop.present">
300    ### ERROR: module for PDF FOP rendering not installed. Please download
301    it, and reinstall the styler using 'ant -f ant-build.docbook.xml install'.
302    </fail>
303  </target>
304
305  <target name="pdf.fop.internal" depends="disable.resources.copy,docbook.consolidate" if="module.fop.present">
306
307    <copy file="${docbook.styles}/${docbook.style}/xsl/customized.pdf-fop.xsl"
308          tofile="${build.dir}/customized.pdf-fop.xsl.tmp"
309          overwrite="true"
310    >
311        <filterset refid="filterset.fileuris" />
312    </copy>
313
314    <style
315        in      = "${temp:docbook.ready.file}"
316        style   = "${build.dir}/customized.pdf-fop.xsl.tmp"
317        out     = "${build.dir}/fop-ready.fo"
318        processor = "${xslt.processor}"
319        >
320        <classpath refid="ant-extensions" />
321    </style>
322
323    <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop">
324             <classpath>
325                <fileset dir="${module.fop.basedir}">
326                    <include name="**/*.jar" />
327                </fileset>
328             </classpath>
329    </taskdef>
330
331    <fop format     = "application/pdf" 
332         fofile     = "${build.dir}/fop-ready.fo"
333         outfile    = "${distribution.dir}/${manual.name}.pdf"
334         messagelevel = "info"
335         userconfig = "${module.fop.basedir}/conf/config.xml"
336        />
337
338  </target>
339  <!-- }}} -->
340 
341  <!-- ########################################################## -->
342  <!-- ### {{{ builds PDF documentation using FOP             ### -->
343  <!-- ########################################################## -->
344  <property name="module.xep.basedir" location="${ant.docbook.styler.dir}/module-xep" />
345
346  <target name="pdf.xep" depends="modules.detection, pdf.xep.internal">
347    <fail unless="module.xep.present">
348    ### ERROR: module for PDF XEP rendering not installed. Please download
349    it and look in the readme file for installation instructions.
350    </fail>
351  </target>
352
353  <target name="pdf.xep.internal" depends="disable.resources.copy,docbook.consolidate" if="module.xep.present">
354
355    <copy file="${docbook.styles}/${docbook.style}/xsl/customized.pdf-xep.xsl"
356          tofile="${build.dir}/customized.pdf-xep.xsl.tmp"
357          overwrite="true"
358    >
359        <filterset refid="filterset.fileuris" />
360    </copy>
361
362    <path id="xep.classpath">
363        <fileset dir="${xep.installation.dir}" includes="lib/*.jar" />
364    </path>
365    <available property="xep.task.available" value="true"
366        classname="com.renderx.ant.XEPTask" classpathref="xep.classpath" >
367    </available>
368    <fail unless="xep.task.available">
369** ERROR: XEP task is not available. Make sure you installed XEP module correctly and
370set up XEP's installation directory in the module's configuration property file.
371    </fail>
372    <taskdef name="xep" classname="com.renderx.ant.XEPTask">
373        <classpath refid="xep.classpath" />
374    </taskdef>
375
376    <style
377        in      = "${temp:docbook.ready.file}"
378        style   = "${build.dir}/customized.pdf-xep.xsl.tmp"
379        out     = "${build.dir}/xep-ready.fo"
380        processor = "${xslt.processor}"
381        >
382        <classpath refid="ant-extensions" />
383    </style>
384
385    <xep in="${build.dir}/xep-ready.fo" out="${distribution.dir}/${manual.name}.pdf" format="PDF">
386        <sysproperty key="com.renderx.xep.ROOT" value="${xep.installation.dir}"/>
387        <sysproperty key="com.renderx.xep.FONTLIST" value="${module.xep.basedir}/conf/fonts.xml" />
388        <sysproperty key="com.renderx.xep.METRICS" value="${module.xep.basedir}/conf" />
389    </xep>
390
391  </target>
392  <!-- }}} -->
393
394
395
396 
397  <!-- ########################################################## -->
398  <!-- ### {{{ builds HTML documentation (single and chunked) ### -->
399  <!-- ########################################################## -->
400
401  <target name="html.single" depends="docbook.consolidate"
402          description="Renders a docbook documentation to a single HTML file.">
403
404    <copy file="${docbook.styles}/${docbook.style}/xsl/customized.single.xsl"
405          tofile="${build.dir}/customized.single.xsl.tmp"
406          overwrite="true"
407    >
408        <filterset refid="filterset.fileuris" />
409    </copy>
410
411    <style
412        in      = "${temp:docbook.ready.file}"
413        style   = "${build.dir}/customized.single.xsl.tmp"
414        out     = "${distribution.dir}/${manual.name}.html"
415        processor = "${xslt.processor}"
416        >
417        <classpath refid="ant-extensions" />
418    </style>
419   
420    <delete file="${build.dir}/customized.single.xsl.tmp" />
421
422  </target>
423
424
425  <target name="html.chunked" depends="docbook.consolidate" 
426          description="Renders the manual to a set of HTML files (sectioned).">
427 
428    <pathconvert property="docbook:tmp:chunked.dir" pathSep="," dirSep="/">
429        <path>
430            <pathelement location="${distribution.dir}" />
431        </path>
432    </pathconvert>
433
434    <copy file="${docbook.styles}/${docbook.style}/xsl/customized.chunked.xsl"
435          tofile="${build.dir}/customized.chunked.xsl.tmp"
436          overwrite="true"
437    >
438        <filterset refid="filterset.fileuris" />
439        <filterset>
440            <!-- (MM20040315) base.dir and root.filename are tokens used in customized.chunked.xsl
441                 to set the xsl:params correctly there -->
442            <filter token="base.dir" value="${docbook:tmp:chunked.dir}" />
443            <filter token="root.filename" value="${manual.name}" />
444        </filterset>
445    </copy>
446
447    <style
448        in      = "${temp:docbook.ready.file}"
449        style   = "${build.dir}/customized.chunked.xsl.tmp"
450        out     = "${distribution.dir}/docbook-ref-file.tmp"
451        processor = "${xslt.processor}"
452        >
453
454        <classpath refid="ant-extensions" />
455        <!-- <param name="chunker.output.encoding" expression="'UTF-8'" /> -->
456    </style>
457   
458    <delete file="${build.dir}/customized.chunked.xsl.tmp" />
459
460  </target>
461
462  <!-- }}} -->
463
464  <!-- ########################################################################## -->
465  <!-- ### {{{ INSTALLATION                                                       -->
466  <!-- ########################################################################## -->
467  <target name="install.step1">
468    <property name="ant.docbook.styler.dir" location="${basedir}" />
469  </target>
470
471  <target name="install" depends="modules.detection,install.step1,create.styler.uri,check.expand.zips">
472
473    <available classname="org.apache.xml.resolver.Resolver" property="ok:resolver.available" />
474    <fail unless="ok:resolver.available">
475 ##
476 ## FAILED: you must download Jakarta Commons' Resolver
477 ## package and install it in ANT's lib directory.
478 ## Download it from: http://xml.apache.org/commons/
479 ##
480    </fail>
481   
482    <!-- Install modules, if present. -->
483    <antcall target="install.module.fop" />
484
485    <echo>
486 ##
487 ## ANT-DOCBOOK-STYLER INSTALLED.
488 ## ant.docbook.styler.dir is:
489 ## ${basedir}
490 ##
491    </echo>
492   
493  </target>
494 
495  <target name="install.module.fop" if="module.fop.present">
496    <echo>Installing FOP module</echo>
497
498    <copy file="${ant.docbook.styler.dir}/module-fop/conf/config.xml-preinstall"
499          tofile="${ant.docbook.styler.dir}/module-fop/conf/config.xml"
500          overwrite="true"
501    >
502        <filterset refid="filterset.fileuris" />
503    </copy>
504  </target>
505 
506  <!-- }}} --> 
507
508  <!-- ########################################################################## -->
509  <!-- ### {{{ Renders DocBook Website project into HTML                          -->
510  <!-- ########################################################################## -->
511 
512  <target name="website.check.required-properties">
513    <condition property="tmp:ant.docbook.styler.dir" value="true">
514        <and>
515            <!-- ## (dw 20040307) check that we really point at the base directory
516                 of ant-docbook-styler -->
517            <available file="${ant.docbook.styler.dir}" type="dir" />
518            <available file="${ant.docbook.styler.dir}/custom-styles" type="dir" />
519            <available file="${ant.docbook.styler.dir}/docbook" type="dir" />
520        </and>
521    </condition>
522    <fail message="### 'ant.docbook.styler.dir' does not point at the styler's installation directory: ${ant.docbook.styler.dir}"
523        unless="tmp:ant.docbook.styler.dir"/>
524
525    <condition property="tmp:website.xml.dir.ok" value="true">
526        <and>
527            <not>
528                <equals arg1="${website.xml.dir}" arg2="${undefined}" />
529            </not>
530            <available file="${website.xml.dir}" type="dir" />
531        </and>
532    </condition>
533    <fail message="### Define 'website.xml.dir' property pointing at Website XMLs folder."
534          unless="tmp:website.xml.dir.ok" />
535
536    <condition property="tmp:website.startfile.ok" value="true">
537        <and>
538            <available file="${website.xml.dir}/layout.xml" type="file" />
539        </and>
540    </condition>
541    <fail message="### Cannot find root Website file: ${website.xml.dir}/layout.xml"
542          unless="tmp:website.startfile.ok" />
543
544    <condition property="tmp:website.build.dir.ok" value="true">
545        <and>
546            <not>
547                <equals arg1="${build.dir}" arg2="${undefined}" />
548            </not>
549            <available file="${build.dir}" type="dir" />
550        </and>
551    </condition>
552    <fail message="### Define 'build.dir' property pointing at a temporary folder (will be erased!)."
553          unless="tmp:website.build.dir.ok" />         
554
555    <condition property="tmp:website.distribution.dir.ok" value="true">
556        <and>
557            <not>
558                <equals arg1="${distribution.dir}" arg2="${undefined}" />
559            </not>
560            <available file="${distribution.dir}" type="dir" />
561        </and>
562    </condition>
563    <fail message="### Define 'distribution.dir' property pointing at your destination folder."
564          unless="tmp:website.distribution.dir.ok" />         
565  </target>
566 
567
568  <target name="website" depends="check.expand.zips, website.check.required-properties, xsltprocessor, create.styler.uri"
569          description="Renders a docbook Website project into HTML.">
570
571    <property name="website.catalog.location" location="${ant.docbook.styler.dir}/website/catalog.xml" />
572
573    <!-- (MM 20040314) make the Java XSLT use the same catalog as the XSLTProc -->
574    <!-- works only with ant 1.6 and newer, but avoids problems when upgrading
575         from Java XSLT to XSLTProc later                                      -->
576    <xmlcatalog id="websitedtdcatalog">
577            <catalogpath>
578                <fileset file="${website.catalog.location}"/>
579            </catalogpath>
580    </xmlcatalog>
581   
582    <copy todir="${build.dir}" includeemptydirs="false">
583        <fileset dir="${website.styles}/${website.style}" excludes="**/*.xsl" />
584    </copy>
585    <copy todir="${build.dir}" includeemptydirs="false">
586        <fileset dir="${website.xml.dir}" includes="**/*" />
587    </copy>
588    <delete file="${build.dir}/autolayout.xml" />
589
590    <style
591        in      = "${build.dir}/layout.xml"
592        style   = "website/xsl/autolayout.xsl"
593        out     = "${build.dir}/autolayout.xml"
594        processor = "${xslt.processor}"
595        >
596        <xmlcatalog refid="websitedtdcatalog"/>
597        <classpath refid="ant-extensions" />
598        <param name="xsltproc.catalog" expression="${website.catalog.location}" />       
599        <param name="xsltproc.option.--nonet"  expression="" />
600    </style>
601
602    <!-- (MM 20040315) Make sure that XSLT was successful
603              It doesn't fail, if the DTDs cannot be found, though ... -->
604    <condition property="tmp:website.autolayout.xml.ok" value="true">
605            <available file="${build.dir}/autolayout.xml" type="file" />
606    </condition>
607    <fail message="### First step (creation of autolayout.xml) failed while building website."
608          unless="tmp:website.autolayout.xml.ok" />         
609
610    <delete file="${build.dir}/tmp.ref" />
611    <property name="abs.build.dir" location="${build.dir}" />
612
613    <copy file="${website.styles}/${website.style}/style-driver.xsl"
614          tofile="${build.dir}/style-driver.xsl.tmp"
615          overwrite="true"
616    >
617        <filterset refid="filterset.fileuris" />
618    </copy>
619
620    <!-- (MM 20040303) <style...> uses now the temporary style-driver.xsl having the real path
621         for the import file -->
622    <style
623        in      = "${build.dir}/autolayout.xml"
624        style   = "${build.dir}/style-driver.xsl.tmp"
625        out     = "${build.dir}/tmp.ref"
626        processor = "${xslt.processor}"
627        >
628        <xmlcatalog refid="websitedtdcatalog"/>
629        <classpath refid="ant-extensions" />
630        <param name="xsltproc.catalog" expression="${website.catalog.location}" />
631        <param name="xsltproc.option.--nonet"  expression="" />
632        <param name="output-root" expression="${abs.build.dir}" />       
633    </style>
634    <!-- (MM 20040315) Make sure that XSLT was successful
635          It doesn't fail, if the DTDs cannot be found, though ... -->
636    <condition property="tmp:website.tmp.ref.ok" value="true">
637            <available file="${build.dir}/tmp.ref" type="file" />
638    </condition>
639    <fail message="### Second step (creation of HTML files) failed while building website."
640          unless="tmp:website.tmp.ref.ok" />         
641   
642    <!-- (MM 20040303) deleting temporary style-driver.xsl -->
643    <delete file="${build.dir}/style-driver.xsl.tmp" />
644
645    <delete file="${build.dir}/tmp.ref" />
646    <copy todir="${distribution.dir}" includeemptydirs="false">
647        <fileset dir="${build.dir}" excludes="**/*.xml" />
648    </copy>
649  </target>
650  <!-- }}} --> 
651
652  <!-- ########################################################################## -->
653  <!-- ### {{{ XSLT processor recognition. If xsltproc[.exe] is found in path,    -->
654  <!-- ### it will be used for stylesheet processing (much faster than Xalan)     -->
655  <!-- ########################################################################## -->
656  <target name="xsltprocessor">
657    <property environment="env"/>
658
659    <condition  property="executable.file.extension"
660                value=".exe">
661            <os family="windows"/>
662    </condition>
663    <condition  property="executable.file.extension"
664                value="">
665            <os family="unix"/>
666    </condition>
667   
668    <condition  property="tmp:xsltproc.available"
669                value="xsltproc${executable.file.extension}">
670        <or>
671            <and>
672                <os family="windows"/>
673                <available file="xsltproc${executable.file.extension}" filepath="${env.Path}" />
674            </and>
675            <and>
676                <os family="unix"/>
677                <available file="xsltproc${executable.file.extension}" filepath="${env.PATH}" />
678            </and>
679        </or>
680    </condition>
681   
682    <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.XsltProcLiaison">
683        <and>
684            <isset property="tmp:xsltproc.available" />
685            <not>
686                <isset property="disable.xsltproc" />
687            </not>
688        </and>
689    </condition>
690   
691    <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.SaxonLiaison">
692        <not>
693            <isset property="disable.saxon" />
694        </not>
695    </condition>
696
697    <condition property="xslt.processor" value="trax">
698        <not>
699        <and>
700                <isset property="tmp:xsltproc.available" />
701                <not>
702                    <isset property="disable.xsltproc" />
703                </not>
704        </and>
705        </not>
706    </condition>
707
708    <antcall target="displayXsltProcessorInfo" />
709  </target>
710
711  <target name="displayXsltProcessorInfo"
712          if="tmp:xsltproc.available"
713          unless="disable.xsltproc">
714    <echo>
715   
716#####################################################
717XSLTProc has been found in your path and will be used
718for processing XSLT transformations. If you experience
719any problems, you can switch to Java's default XSLT
720processor by defining 'disable.xsltproc' property.
721#####################################################
722
723    </echo>
724  </target>
725 
726 
727  <target name="create.styler.uri">
728    <pathconvert dirsep="/" property="tmp:ant.docbook.styler.abs">
729        <path>
730        <pathelement location="${ant.docbook.styler.dir}" />
731        </path>
732    </pathconvert>
733    <condition  property="tmp:file.uri.prefix"
734                value="file:///">
735            <os family="windows"/>
736    </condition>
737    <condition  property="tmp:file.uri.prefix"
738                value="file://">
739            <os family="unix"/>
740    </condition>
741    <property name="tmp:ant.docbook.styler.uri"
742        value="${tmp:file.uri.prefix}${tmp:ant.docbook.styler.abs}" />
743
744    <pathconvert dirsep="/" property="tmp:style.abs">
745        <path>
746        <pathelement location="${docbook.styles}/${docbook.style}" />
747        </path>
748    </pathconvert>
749    <property name="tmp:style.uri"
750        value="${tmp:file.uri.prefix}${tmp:style.abs}" />
751     
752    <filterset id="filterset.fileuris">
753        <filter token="ant.docbook.styler.fileuri" value="${tmp:ant.docbook.styler.uri}" />
754        <filter token="docbook.style.fileuri" value="${tmp:style.uri}" />
755    </filterset>
756
757  </target>
758  <!-- }}} -->
759 
760 
761
762
763  <!-- ##################################### -->
764  <!-- ### {{{ HELP ON THIS FILE             ### -->
765  <!-- ##################################### -->
766  <target name="help" description="Displays help about the project.">
767    <echo>
768    Project name: ${ant.project.name}
769    (c) Dawid Weiss, Poznań University of Technology.
770
771    Current JDK: ${ant.java.version}
772    Basedir    : ${basedir}
773    -----------------------------------
774   
775    Use ant -projecthelp for description of available tasks.
776    See the test folder for an example of use.
777
778    </echo>
779  </target>
780  <!-- }}} -->
781
782</project>
Note: See TracBrowser for help on using the repository browser.