blob: 6c2ea8ce57372284e4f4961b8b628d4ef431dcf3 [file] [log] [blame]
<!-- $Id$ -->
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
This XML snippet is included into an ant build file.
It includes a rule, docbook-setup, that ensures that the necessary
DocBook distributions are unpacked and ready to process the XML.
Very important to keep this synchronized with .cvsignore to prevent
problems using Team support inside the Eclipse IDE.
-->
<property name="root.dir" value="../../.."/>
<property file="${root.dir}/config/build.properties"/>
<property name="html.install.dir" value="${root.dir}/web/doc/${root.filename}"/>
<!-- The base name for the DTD distribution (the directory and tar file
will match). -->
<property name="docbook.dtd.base" value="docbkx412"/>
<!-- Base name for the XSL distribution. -->
<!-- this value is duplicated in ./Readme.html and /ext-dist/README.html -->
<property name="docbook.xsl.base" value="docbook-xsl-1.64.1"/>
<property name="docbook.dtd.dir" value="../common/${docbook.dtd.base}"/>
<property name="docbook.xsl.dir" value="../common/${docbook.xsl.base}"/>
<property name="docbook.chunked.xsl"
value="../common/Tapestry-${docbook.xsl.base}-Chunked.xsl"/>
<property name="docbook.fop.xsl"
value="../common/Tapestry-${docbook.xsl.base}-Fop.xsl"/>
<xmlcatalog id="docbook.catalog">
<dtd publicId="-//OASIS//DTD DocBook XML V4.1.2//EN" location="${docbook.dtd.dir}/docbookx.dtd"/>
<dtd publicId="-//OASIS//DTD DocBook CALS Table Model V4.1.2//EN" location="${docbook.dtd.dir}/calstblx.dtd"/>
<dtd publicId="-//OASIS//DTD XML Exchange Table Model 19990315//EN" location="${docbook.dtd.dir}/soextblx.dtd"/>
<dtd publicId="-//OASIS//ELEMENTS DocBook Information Pool V4.1.2//EN" location="${docbook.dtd.dir}/dbpoolx.mod"/>
<dtd publicId="-//OASIS//ELEMENTS DocBook Document Hierarchy V4.1.2//EN" location="${docbook.dtd.dir}/dbhierx.mod"/>
<dtd publicId="-//OASIS//ENTITIES DocBook Additional General Entities V4.1.2//EN" location="${docbook.dtd.dir}/dbgenent.mod"/>
<dtd publicId="-//OASIS//ENTITIES DocBook Notations V4.1.2//EN" location="${docbook.dtd.dir}/dbnotnx.mod"/>
<dtd publicId="-//OASIS//ENTITIES DocBook Character Entities V4.1.2//EN" location="${docbook.dtd.dir}/dbcentx.mod"/>
<dtd publicId="ISO 8879:1986//ENTITIES Diacritical Marks//EN//XML" location="${docbook.dtd.dir}/ent/iso-dia.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN//XML" location="${docbook.dtd.dir}/ent/iso-num.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Publishing//EN//XML" location="${docbook.dtd.dir}/ent/iso-pub.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES General Technical//EN//XML" location="${docbook.dtd.dir}/ent/iso-tech.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Added Latin 1//EN//XML" location="${docbook.dtd.dir}/ent/iso-lat1.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Added Latin 2//EN//XML" location="${docbook.dtd.dir}/ent/iso-lat2.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Greek Letters//EN//XML" location="${docbook.dtd.dir}/ent/iso-grk1.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Monotoniko Greek//EN//XML" location="${docbook.dtd.dir}/ent/iso-grk2.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Greek Symbols//EN//XML" location="${docbook.dtd.dir}/ent/iso-grk3.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN//XML" location="${docbook.dtd.dir}/ent/iso-grk4.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN//XML" location="${docbook.dtd.dir}/ent/iso-amsa.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN//XML" location="${docbook.dtd.dir}/ent/iso-amsb.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN//XML" location="${docbook.dtd.dir}/ent/iso-amsc.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN//XML" location="${docbook.dtd.dir}/ent/iso-amsn.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN//XML" location="${docbook.dtd.dir}/ent/iso-amso.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN//XML" location="${docbook.dtd.dir}/ent/iso-amsr.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Box and Line Drawing//EN//XML" location="${docbook.dtd.dir}/ent/iso-box.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Russian Cyrillic//EN//XML" location="${docbook.dtd.dir}/ent/iso-cyr1.ent"/>
<dtd publicId="ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN//XML" location="${docbook.dtd.dir}/ent/iso-cyr2.ent"/>
</xmlcatalog>
<target name="docbook-setup"
description="Make sure the latest distributions of DocBook DTDs and stylesheets are ready.">
<available property="docbook.dtd.available" file="${docbook.dtd.dir}" type="dir"/>
<available property="docbook.xsl.available" file="${docbook.xsl.dir}" type="dir"/>
<antcall target="docbook-setup-inner"/>
<copy
file="../common/Tapestry.xsl.template"
tofile="${docbook.chunked.xsl}">
<filterset>
<filter token="docbook.xsl.base" value="${docbook.xsl.base}"/>
<filter token="format" value="chunk"/>
</filterset>
</copy>
<copy
file="../common/Tapestry.fop-xsl.template"
tofile="${docbook.fop.xsl}">
<filterset>
<filter token="docbook.xsl.base" value="${docbook.xsl.base}"/>
</filterset>
</copy>
</target>
<target name="docbook-setup-inner" depends="docbook-unpack-dtd,docbook-unpack-xsl">
</target>
<target name="docbook-unpack-dtd" unless="docbook.dtd.available">
<echo>Unpacking DocBook DTD distribution ...</echo>
<unzip src="${ext.dist.dir}/${docbook.dtd.base}.zip" dest="../common"/>
</target>
<target name="docbook-unpack-xsl" unless="docbook.xsl.available">
<echo>Unpacking DocBook XSL distribution ...</echo>
<unzip src="${ext.dist.dir}/${docbook.xsl.base}.zip" dest="../common"/>
</target>
<property name="html.output.dir" value="html"/>
<property name="images.src.dir" value="images"/>
<property name="images.dest.dir" value="${html.output.dir}/images"/>
<property name="common-images.dest.dir" value="${html.output.dir}/common-images"/>
<target name="setup">
<mkdir dir="${html.output.dir}"/>
<mkdir dir="${common-images.dest.dir}"/>
</target>
<target name="clean">
<delete dir="${html.output.dir}"/>
</target>
<target name="copy-images" depends="setup">
<copy todir="${images.dest.dir}" >
<fileset dir="${images.src.dir}"/>
</copy>
<copy todir="${html.output.dir}/standard-images">
<fileset dir="${docbook.xsl.dir}/images">
<include name="callouts/*.png"/>
</fileset>
</copy>
<copy todir="${common-images.dest.dir}">
<fileset dir="../common/images">
<include name="*.png"/>
</fileset>
</copy>
</target>
<!-- Only attempt to generate PDF if the developer has set fop.dir
in their build.properties. -->
<target name="pdf" depends="docbook-setup,copy-images" if="fop.dir">
<uptodate property="uptodate.fop"
targetfile="${html.output.dir}/${root.filename}.fop">
<srcfiles dir=".">
<include name="*.xml"/>
</srcfiles>
</uptodate>
<antcall target="generate-fo-from-xml"/>
<uptodate property="pdf.uptodate"
srcfile="${html.output.dir}/${root.filename}.fop"
targetfile="${html.output.dir}/${root.filename}.pdf"/>
<antcall target="convert-fo-to-pdf"/>
</target>
<target name="generate-fo-from-xml" unless="uptodate.fop">
<echo>
Generating Flow Objects from ${root.filename}.xml ...
</echo>
<style destdir="${html.output.dir}"
style="${docbook.fop.xsl}"
processor="trax"
force="true"
in="${root.filename}.xml"
out="${html.output.dir}/${root.filename}.fop">
<xmlcatalog refid="docbook.catalog"/>
</style>
</target>
<target name="convert-fo-to-pdf" unless="pdf.uptodate">
<echo>
Converting Flow Objects to PDF ...
</echo>
<java classname="org.apache.fop.apps.Fop"
fork="true"
dir="${html.output.dir}">
<classpath>
<fileset dir="${fop.dir}">
<include name="build/fop.jar"/>
<include name="lib/*.jar"/>
<include name="lib/*.zip"/>
</fileset>
</classpath>
<arg line="-fo ${root.filename}.fop"/>
<arg line="-pdf ${root.filename}.pdf"/>
</java>
</target>
<!-- Invoked using antcall, setting the property root.filename -->
<target name="html" depends="docbook-setup,copy-images">
<copy todir="${html.output.dir}" file="../common/Tapestry.css"/>
<uptodate property="uptodate.html"
targetfile="${html.output.dir}/${root.filename}.html">
<srcfiles dir=".">
<include name="*.xml"/>
</srcfiles>
</uptodate>
<antcall target="generate-html-chunked"/>
</target>
<target name="generate-html-chunked" unless="uptodate.html">
<echo>
Generating HTML from ${root.filename}.xml ...
</echo>
<style destdir="${html.output.dir}"
style="${docbook.chunked.xsl}"
processor="trax"
force="true"
includes="${root.filename}.xml">
<param name="base.dir" expression="${basedir}/${html.output.dir}/"/>
<param name="root.filename" expression="${root.filename}"/>
<param name="use.id.as.filename" expression="1"/>
<xmlcatalog refid="docbook.catalog"/>
</style>
</target>
<target name="install" depends="html,pdf"
description="Build and install documentation.">
<mkdir dir="${html.install.dir}"/>
<copy todir="${html.install.dir}">
<fileset dir="${html.output.dir}">
<exclude name="*.fop"/>
</fileset>
</copy>
</target>