Ignore:
Timestamp:
May 16, 2007, 2:57:02 PM (14 years ago)
Author:
Martin Svensson
Message:

Fixes #603 Done some clean-up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/docbook/ant-build-docbook.xml

    r3346 r3349  
    3232 
    3333  <property name="docbook.style"           value="plain" />
    34   <property name="website.style"           value="plain" />
    35 
    36   <!-- website rendering -->
    37   <property name="website.xml.dir"         value="${undefined}" />
    3834
    3935  <!-- ## override these properties, if needed -->
     
    4339       ## of the styles folder -->
    4440  <property name="docbook.styles"          location="${ant.docbook.styler.dir}/custom-styles/docbook" />
    45   <!-- ## (MM 20040303) added parameter for finding the styles folder for website projects -->
    46   <property name="website.styles"          location="${ant.docbook.styler.dir}/custom-styles/website" />
    4741 
    4842  <!-- The version of base2 -->
     
    125119  </target>
    126120
    127   <target name="check.expand.zips">
    128   <!--
    129     <antcall target="check.expand.docbook-distribution.zip" />
    130     <antcall target="check.expand.website-distribution.zip" />
    131    -->
    132   </target>
    133  
    134   <target name="check.expand.docbook-distribution.zip">
    135     <condition property="tmp:docbook.available" value="true">
    136         <and>
    137         <available file="${ant.docbook.styler.dir}/docbook/dtd" type="dir" />
    138         <available file="${ant.docbook.styler.dir}/docbook/xsl/fo" type="dir" />
    139         <available file="${ant.docbook.styler.dir}/docbook/xsl/html" type="dir" />
    140         <uptodate srcfile="${ant.docbook.styler.dir}/docbook/docbook.zip"
    141               targetfile="${ant.docbook.styler.dir}/docbook/docbook.zip.tstamp" />
    142         </and>
    143     </condition>
    144     <antcall target="expand.docbook-distribution.zip" />
    145   </target>
    146  
    147   <target name="expand.docbook-distribution.zip" unless="tmp:docbook.available">
    148     <echo>
    149     #####################################################
    150         UNPACKING OR UPGRADING DOCBOOK DISTRIBUTION
    151     #####################################################
    152     </echo>
    153     <delete failonerror="false" quiet="true">
    154         <fileset dir="docbook">
    155         <include name="dtd/**" />
    156         <include name="xsl/**" />
    157         </fileset>
    158     </delete>
    159     <unzip src="docbook/docbook.zip" dest="docbook" overwrite="true" />
    160    
    161     <taskdef name="LastModifiedMillis" classname="LastModifiedMillis">
    162         <classpath refid="ant-extensions" />
    163     </taskdef>
    164 
    165     <LastModifiedMillis file="docbook/docbook.zip" property="millis" />
    166     <touch file="docbook/docbook.zip.tstamp" millis="${millis}" />
    167   </target>
    168  
    169121  <target name="clean">
    170122    <delete failonerror="false" quiet="true" includeEmptyDirs="true">
     
    176128  </target> 
    177129
    178   <target name="check.expand.website-distribution.zip">
    179     <condition property="tmp:website.available" value="true">
    180         <and>
    181         <available file="${ant.docbook.styler.dir}/website/schema" type="dir" />
    182         <available file="${ant.docbook.styler.dir}/website/schema/dtd" type="dir" />
    183         <available file="${ant.docbook.styler.dir}/website/xsl" type="dir" />
    184         <uptodate srcfile="${ant.docbook.styler.dir}/website/website.zip"
    185               targetfile="${ant.docbook.styler.dir}/website/website.zip.tstamp" />
    186         </and>
    187     </condition>
    188     <antcall target="expand.website-distribution.zip" />
    189   </target>
    190  
    191   <target name="expand.website-distribution.zip" unless="tmp:website.available">
    192     <echo>
    193     #####################################################
    194         UNPACKING OR UPGRADING WEBSITE DISTRIBUTION
    195     #####################################################
    196     </echo>
    197     <delete failonerror="false" quiet="true">
    198         <fileset dir="website">
    199         <include name="schema/**" />
    200         <include name="xsl/**" />
    201         </fileset>
    202     </delete>
    203     <unzip src="website/website.zip" dest="website" overwrite="true" />
    204    
    205     <taskdef name="LastModifiedMillis" classname="LastModifiedMillis">
    206         <classpath refid="ant-extensions" />
    207     </taskdef>
    208 
    209     <LastModifiedMillis file="website/website.zip" property="millis" />
    210     <touch file="website/website.zip.tstamp" millis="${millis}" />
    211   </target>
    212130  <!-- }}} -->
    213131
     
    217135  <!-- ##################################### -->
    218136
    219   <target name="prepare" depends="modules.detection,check.expand.zips, check.required-properties, xsltprocessor">
     137  <target name="prepare" depends="modules.detection, check.required-properties, xsltprocessor">
    220138  </target>
    221139 
     
    223141    <available file="${ant.docbook.styler.dir}/module-fop" type="dir"
    224142               property="module.fop.present" value="true" />
    225                
    226     <available file="${ant.docbook.styler.dir}/module-xep" type="dir"
    227                property="module.xep.present" value="true" />
    228     <property file="${ant.docbook.styler.dir}/module-xep/xep-config.properties" />
    229 
    230143  </target>
    231144
     
    366279  </target>
    367280  <!-- }}} -->
    368  
    369   <!-- ########################################################## -->
    370   <!-- ### {{{ builds PDF documentation using FOP             ### -->
    371   <!-- ########################################################## -->
    372   <property name="module.xep.basedir" location="${ant.docbook.styler.dir}/module-xep" />
    373 
    374   <target name="pdf.xep" depends="modules.detection, pdf.xep.internal">
    375     <fail unless="module.xep.present">
    376     ### ERROR: module for PDF XEP rendering not installed. Please download
    377     it and look in the readme file for installation instructions.
    378     </fail>
    379   </target>
    380 
    381   <target name="pdf.xep.internal" depends="disable.resources.copy,docbook.consolidate" if="module.xep.present">
    382 
    383     <copy file="${docbook.styles}/${docbook.style}/xsl/customized.pdf-xep.xsl"
    384           tofile="${build.dir}/customized.pdf-xep.xsl.tmp"
    385           overwrite="true"
    386     >
    387         <filterset refid="filterset.fileuris" />
    388     </copy>
    389 
    390     <path id="xep.classpath">
    391         <fileset dir="${xep.installation.dir}" includes="lib/*.jar" />
    392     </path>
    393     <available property="xep.task.available" value="true"
    394         classname="com.renderx.ant.XEPTask" classpathref="xep.classpath" >
    395     </available>
    396     <fail unless="xep.task.available">
    397 ** ERROR: XEP task is not available. Make sure you installed XEP module correctly and
    398 set up XEP's installation directory in the module's configuration property file.
    399     </fail>
    400     <taskdef name="xep" classname="com.renderx.ant.XEPTask">
    401         <classpath refid="xep.classpath" />
    402     </taskdef>
    403 
    404     <style
    405         in      = "${temp:docbook.ready.file}"
    406         style   = "${build.dir}/customized.pdf-xep.xsl.tmp"
    407         out     = "${build.dir}/xep-ready.fo"
    408         processor = "${xslt.processor}"
    409         >
    410         <classpath refid="ant-extensions" />
    411     </style>
    412 
    413     <xep in="${build.dir}/xep-ready.fo" out="${distribution.dir}/${manual.name}.pdf" format="PDF">
    414         <sysproperty key="com.renderx.xep.ROOT" value="${xep.installation.dir}"/>
    415         <sysproperty key="com.renderx.xep.FONTLIST" value="${module.xep.basedir}/conf/fonts.xml" />
    416         <sysproperty key="com.renderx.xep.METRICS" value="${module.xep.basedir}/conf" />
    417     </xep>
    418 
    419   </target>
    420   <!-- }}} -->
    421 
    422 
    423 
    424  
     281   
    425282  <!-- ########################################################## -->
    426283  <!-- ### {{{ builds HTML documentation (single and chunked) ### -->
     
    500357
    501358  <!-- ########################################################################## -->
    502   <!-- ### {{{ INSTALLATION                                                       -->
    503   <!-- ########################################################################## -->
    504   <target name="install.step1">
    505     <property name="ant.docbook.styler.dir" location="${basedir}" />
    506   </target>
    507 
    508   <target name="install" depends="modules.detection,install.step1,create.styler.uri,check.expand.zips">
    509 
    510     <available classname="org.apache.xml.resolver.Resolver" property="ok:resolver.available" />
    511     <fail unless="ok:resolver.available">
    512  ##
    513  ## FAILED: you must download Jakarta Commons' Resolver
    514  ## package and install it in ANT's lib directory.
    515  ## Download it from: http://xml.apache.org/commons/
    516  ##
    517     </fail>
    518    
    519     <!-- Install modules, if present. -->
    520     <antcall target="install.module.fop" />
    521 
    522     <echo>
    523  ##
    524  ## ANT-DOCBOOK-STYLER INSTALLED.
    525  ## ant.docbook.styler.dir is:
    526  ## ${basedir}
    527  ##
    528     </echo>
    529    
    530   </target>
    531  
    532   <target name="install.module.fop" if="module.fop.present">
    533     <echo>Installing FOP module</echo>
    534 
    535     <copy file="${ant.docbook.styler.dir}/module-fop/conf/config.xml-preinstall"
    536           tofile="${ant.docbook.styler.dir}/module-fop/conf/config.xml"
    537           overwrite="true"
    538     >
    539         <filterset refid="filterset.fileuris" />
    540     </copy>
    541   </target>
    542  
    543   <!-- }}} --> 
    544 
    545   <!-- ########################################################################## -->
    546   <!-- ### {{{ Renders DocBook Website project into HTML                          -->
    547   <!-- ########################################################################## -->
    548  
    549   <target name="website.check.required-properties">
    550     <condition property="tmp:ant.docbook.styler.dir" value="true">
    551         <and>
    552             <!-- ## (dw 20040307) check that we really point at the base directory
    553                  of ant-docbook-styler -->
    554             <available file="${ant.docbook.styler.dir}" type="dir" />
    555             <available file="${ant.docbook.styler.dir}/custom-styles" type="dir" />
    556             <available file="${ant.docbook.styler.dir}/docbook" type="dir" />
    557         </and>
    558     </condition>
    559     <fail message="### 'ant.docbook.styler.dir' does not point at the styler's installation directory: ${ant.docbook.styler.dir}"
    560         unless="tmp:ant.docbook.styler.dir"/>
    561 
    562     <condition property="tmp:website.xml.dir.ok" value="true">
    563         <and>
    564             <not>
    565                 <equals arg1="${website.xml.dir}" arg2="${undefined}" />
    566             </not>
    567             <available file="${website.xml.dir}" type="dir" />
    568         </and>
    569     </condition>
    570     <fail message="### Define 'website.xml.dir' property pointing at Website XMLs folder."
    571           unless="tmp:website.xml.dir.ok" />
    572 
    573     <condition property="tmp:website.startfile.ok" value="true">
    574         <and>
    575             <available file="${website.xml.dir}/layout.xml" type="file" />
    576         </and>
    577     </condition>
    578     <fail message="### Cannot find root Website file: ${website.xml.dir}/layout.xml"
    579           unless="tmp:website.startfile.ok" />
    580 
    581     <condition property="tmp:website.build.dir.ok" value="true">
    582         <and>
    583             <not>
    584                 <equals arg1="${build.dir}" arg2="${undefined}" />
    585             </not>
    586             <available file="${build.dir}" type="dir" />
    587         </and>
    588     </condition>
    589     <fail message="### Define 'build.dir' property pointing at a temporary folder (will be erased!)."
    590           unless="tmp:website.build.dir.ok" />         
    591 
    592     <condition property="tmp:website.distribution.dir.ok" value="true">
    593         <and>
    594             <not>
    595                 <equals arg1="${distribution.dir}" arg2="${undefined}" />
    596             </not>
    597             <available file="${distribution.dir}" type="dir" />
    598         </and>
    599     </condition>
    600     <fail message="### Define 'distribution.dir' property pointing at your destination folder."
    601           unless="tmp:website.distribution.dir.ok" />         
    602   </target>
    603  
    604 
    605   <target name="website" depends="check.expand.zips, website.check.required-properties, xsltprocessor, create.styler.uri"
    606           description="Renders a docbook Website project into HTML.">
    607 
    608     <property name="website.catalog.location" location="${ant.docbook.styler.dir}/website/catalog.xml" />
    609 
    610     <!-- (MM 20040314) make the Java XSLT use the same catalog as the XSLTProc -->
    611     <!-- works only with ant 1.6 and newer, but avoids problems when upgrading
    612          from Java XSLT to XSLTProc later                                      -->
    613     <xmlcatalog id="websitedtdcatalog">
    614             <catalogpath>
    615                 <fileset file="${website.catalog.location}"/>
    616             </catalogpath>
    617     </xmlcatalog>
    618    
    619     <copy todir="${build.dir}" includeemptydirs="false">
    620         <fileset dir="${website.styles}/${website.style}" excludes="**/*.xsl" />
    621     </copy>
    622     <copy todir="${build.dir}" includeemptydirs="false">
    623         <fileset dir="${website.xml.dir}" includes="**/*" />
    624     </copy>
    625     <delete file="${build.dir}/autolayout.xml" />
    626 
    627     <style
    628         in      = "${build.dir}/layout.xml"
    629         style   = "website/xsl/autolayout.xsl"
    630         out     = "${build.dir}/autolayout.xml"
    631         processor = "${xslt.processor}"
    632         >
    633         <xmlcatalog refid="websitedtdcatalog"/>
    634         <classpath refid="ant-extensions" />
    635         <param name="xsltproc.catalog" expression="${website.catalog.location}" />       
    636         <param name="xsltproc.option.--nonet"  expression="" />
    637     </style>
    638 
    639     <!-- (MM 20040315) Make sure that XSLT was successful
    640               It doesn't fail, if the DTDs cannot be found, though ... -->
    641     <condition property="tmp:website.autolayout.xml.ok" value="true">
    642             <available file="${build.dir}/autolayout.xml" type="file" />
    643     </condition>
    644     <fail message="### First step (creation of autolayout.xml) failed while building website."
    645           unless="tmp:website.autolayout.xml.ok" />         
    646 
    647     <delete file="${build.dir}/tmp.ref" />
    648     <property name="abs.build.dir" location="${build.dir}" />
    649 
    650     <copy file="${website.styles}/${website.style}/style-driver.xsl"
    651           tofile="${build.dir}/style-driver.xsl.tmp"
    652           overwrite="true"
    653     >
    654         <filterset refid="filterset.fileuris" />
    655     </copy>
    656 
    657     <!-- (MM 20040303) <style...> uses now the temporary style-driver.xsl having the real path
    658          for the import file -->
    659     <style
    660         in      = "${build.dir}/autolayout.xml"
    661         style   = "${build.dir}/style-driver.xsl.tmp"
    662         out     = "${build.dir}/tmp.ref"
    663         processor = "${xslt.processor}"
    664         >
    665         <xmlcatalog refid="websitedtdcatalog"/>
    666         <classpath refid="ant-extensions" />
    667         <param name="xsltproc.catalog" expression="${website.catalog.location}" />
    668         <param name="xsltproc.option.--nonet"  expression="" />
    669         <param name="output-root" expression="${abs.build.dir}" />       
    670     </style>
    671     <!-- (MM 20040315) Make sure that XSLT was successful
    672           It doesn't fail, if the DTDs cannot be found, though ... -->
    673     <condition property="tmp:website.tmp.ref.ok" value="true">
    674             <available file="${build.dir}/tmp.ref" type="file" />
    675     </condition>
    676     <fail message="### Second step (creation of HTML files) failed while building website."
    677           unless="tmp:website.tmp.ref.ok" />         
    678    
    679     <!-- (MM 20040303) deleting temporary style-driver.xsl -->
    680     <delete file="${build.dir}/style-driver.xsl.tmp" />
    681 
    682     <delete file="${build.dir}/tmp.ref" />
    683     <copy todir="${distribution.dir}" includeemptydirs="false">
    684         <fileset dir="${build.dir}" excludes="**/*.xml" />
    685     </copy>
    686   </target>
    687   <!-- }}} --> 
    688 
    689   <!-- ########################################################################## -->
    690359  <!-- ### {{{ XSLT processor recognition. If xsltproc[.exe] is found in path,    -->
    691360  <!-- ### it will be used for stylesheet processing (much faster than Xalan)     -->
Note: See TracChangeset for help on using the changeset viewer.