<?xml version="1.0"?>
<!-- author fredt@users.sourceforge.net 2001 - 2008 -->
<!-- additional targets by unsaved@users.sourceforge.net 2004 - 2008 -->

<project name="hsqldb" default="help" basedir="../">
   <!-- This loads properties in the same exact way as if you ran
        "ant -Dprop1name=val1 -Dprop2name=val2...", etc.  To use all
        defaults, you should have no 'build.properties' file.
        If you don't understand this or want to know about precedence or
        how to use an Ant properties file, look up an Ant manual or an
        Ant expert.
        If you want to know, "Can I set property 'x' in 'build.properties'",
        rephrase the question to yourself as "Can I run 'ant -Dx=...?"
        Do not address questions about property file(s) to the
        hsqldb community. -->
   <property file='build/build.properties'/>
   <property name="hsqldb.version" value="1.8.0.10"/>

   <tstamp>
       <format property="_tmpstamp" pattern="yyyy/MM/dd-hh:mm:ss"
               locale="en"/>
   </tstamp>

   <property name="build.label" value="private-${_tmpstamp}"/>
   <property name="build.vendor" value="${user.name}"/>
   <property name="hsqldb.title" value="HSQLDB"/>
   <property name="hsqldb.vendor" value="The HSQLDB Development Group"/>
   <property name="src" value="${basedir}/src"/>
   <property name="build.debug" value="off"/>

   <target name="init">
   </target>

   <target name='explainjars'
           description="List description of jars that you can build">
     <echo>jar filename    build command   explanation
--------------  -------------   -----------------------------------
hsqldb.jar      ant hsqldb      Default distribution jar
hsqljdbc.jar    ant hsqljdbc    JDBC client only.  (No direct urls
                                of form jdbc:hsqldb:mem/file/res:*)
hsqldbmain.jar  ant hsqldbmain  No utility programs
hsqldbutil.jar  ant hsqldbutil  Utility programs only.  No JDBC
                                driver.  (Includes SqlTool and
                                DatabaseManagers)
hsqldbmin.jar   ant hsqldbmin   No utility or server programs.
                                (Include JDBC driver, but no support
                                for urls of form jdbc:hsqldb:ht*...)
hsqldbtest.jar  ant hsqldbtest  All, including test classes
hsqldbz.jar     ant hsqldbz     Min jar plus necessary util classes
                                for Zaurus
hsqltool.jar    ant hsqltool    SqlTool client and JDBC driver.
                                (No direct urls of form
                                jdbc:hsqldb:mem/file/res:*)
transfer.jar    ant transfer    Transfer Tool classes only.

jars built with JDK 1.2 OR 1.3 can now be used with JRE 1.1.</echo>
   </target>

   <!-- Blaine's new jar target naming strategy.
        Target name is always the same as the desired jar file name, less
        the ".jar" extension. -->
   <!-- Commented out descriptions can be enabled if we want to assist
        people using old-style target names.  If so, remember to remove
        the trailing "/>" on every first target line. -->
   <target name='jar' depends='hsqldb'/>
       <!-- description="Same as target 'hsqldb'"/> -->
   <target name='jarclient' depends='hsqljdbc'/>
       <!-- description="Same as target 'hsqljdbc'"/> -->
   <target name='jarmain' depends='hsqldbmain'/>
       <!-- description="Same as target 'hsqldbmain'"/> -->
   <target name='jarmin' depends='hsqldbmin'/>
       <!-- description="Same as target 'hsqldbmin'"/> -->
   <target name='jarsqltool' depends='hsqltool'/>
       <!-- description="Same as target 'hsqltool'"/> -->
   <target name='jartest' depends='hsqldbtest'/>
       <!-- description="Same as target 'hsqldbtest'"/> -->
   <target name='jarutil' depends='hsqldbutil'/>
       <!-- description="Same as target 'hsqldbutil'"/> -->
   <target name='jarzaurus' depends='hsqldbz'/>
       <!-- description="Same as target 'hsqldbz'"/> -->

   <target name="help" description="Top-level help message">
      <echo>usage:
   ant -help            Display ant help screen
   ant -projecthelp     Display all invocable targets
   ant explainjars      List all targets which build jar files
   ant ANYTHING ELSE    Run 'ant -projecthelp' for details

   jars built with JDK 1.2 OR 1.3 can now be used with JRE 1.1

examples:
   ant jar
   ant clean</echo>
   </target>

   <target name="-javajsse">
      <available classname="javax.net.ssl.SSLSession" property="ant.java.hasjsse"/>
      <echo message="ant.java.hasjsse=${ant.java.hasjsse}" />
   </target>

   <target name="javaversion6">
      <available classname="java.net.IDN" property="ant.java.iscjava16"/>
   </target>

   <target name="javaversion4" depends="javaversion6" unless="ant.java.iscjava16">
      <available classname="java.nio.Buffer" property="ant.java.iscjava14"/>
   </target>

   <target name="javaversion2" depends="javaversion4" unless="ant.java.iscjava14">
      <available classname="java.lang.ref.Reference" property="ant.java.iscjava12"/>
   </target>

   <target name="-prepare" depends="init,javaversion2">
       <mkdir dir="classes" />
   </target>

   <target name="-preparedoc" depends="init">
       <mkdir dir="doc/src" />
   </target>

   <target name="clean" depends="clean-docwork"
           description="Delete the /classes directory created by ant tasks">
        <delete dir="classes"/>
   </target>

   <target name="cleanall" depends="clean,clean-doc"
           description="Same as clean but delete the jar files as well">
      <delete>
         <fileset dir="lib" includes="hsql*.jar"/>
      </delete>
   </target>

    <target name="codeswitcher" depends="-prepare"
            description="uses +-JAVA2 +-JAVA4">
      <javac destdir="classes">
         <src path="${src}"/>
         <include name="org/hsqldb/util/CodeSwitcher.java"/>
       </javac>
    </target>

    <target name="switchtodeprecatedjdbc" depends="codeswitcher"
            description="self explanatory">
      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
        <arg file="${src}/org/hsqldb/jdbc/jdbcCallableStatement.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcPreparedStatement.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcResultSet.java"/>
        <arg value="+DEPRECATEDJDBC"/>
      </java>
    </target>

    <target name="switchoffdeprecatedjdbc" depends="codeswitcher"
            description="self explanatory">
      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
        <arg file="${src}/org/hsqldb/jdbc/jdbcCallableStatement.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcPreparedStatement.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcResultSet.java"/>
        <arg value="-DEPRECATEDJDBC"/>
      </java>
    </target>

    <target name="switches" depends="codeswitcher"
            description="self explanatory">
    </target>

    <target name="switchtojdk11" depends="switches" description="self explanatory">
      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
        <arg file="${src}/org/hsqldb/lib/java/JavaSystem.java"/>
        <arg file="${src}/org/hsqldb/lib/HsqlTimer.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcStatement.java"/>
        <arg file="${src}/org/hsqldb/persist/LockFile.java"/>
        <arg file="${src}/org/hsqldb/persist/Logger.java"/>
        <arg file="${src}/org/hsqldb/util/DatabaseManager.java"/>
        <arg file="${src}/org/hsqldb/util/ConnectionDialogCommon.java"/>
        <arg value="+JAVA2"/>
        <arg value="-JAVA2FULL"/>
        <arg value="-JAVA4"/>
       </java>
       <available classname="java.util.Vector" property="noswing"/>
    </target>

    <target name="switchtojdk13" depends="switches"
            description="self explanatory" if="ant.java.iscjava12">
      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
        <arg file="${src}/org/hsqldb/lib/java/JavaSystem.java"/>
        <arg file="${src}/org/hsqldb/lib/HsqlTimer.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcBlob.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcDatabaseMetaData.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcDataSource.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcDriver.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcCallableStatement.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcClob.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcConnection.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcParameterMetaData.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcPreparedStatement.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcResultSet.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcResultSetMetaData.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcStatement.java"/>
        <arg file="${src}/org/hsqldb/persist/LockFile.java"/>
        <arg file="${src}/org/hsqldb/persist/Logger.java"/>
        <arg file="${src}/org/hsqldb/persist/ScaledRAFile.java"/>
        <arg file="${src}/org/hsqldb/rowio/RowInputTextLog.java"/>
        <arg file="${src}/org/hsqldb/util/DatabaseManager.java"/>
        <arg file="${src}/org/hsqldb/util/ConnectionDialogCommon.java"/>
        <arg file="${src}/org/hsqldb/lib/SimpleLog.java"/>
        <arg file="${src}/org/hsqldb/rowio/RowInputTextLog.java"/>
        <arg file="${src}/org/hsqldb/lib/SimpleLog.java"/>
        <arg file="${src}/org/hsqldb/rowio/RowInputTextLog.java"/>
        <arg file="${src}/org/hsqldb/HsqlDateTime.java"/>
        <arg value="+JAVA2"/>
        <arg value="+JAVA2FULL"/>
        <arg value="-JAVA4"/>
        <arg value="-JAVA6"/>
       </java>
    </target>

    <target name="switchtojdk14" depends="switches"
            description="self explanatory" if="ant.java.iscjava14">
      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
        <arg file="${src}/org/hsqldb/lib/java/JavaSystem.java"/>
        <arg file="${src}/org/hsqldb/lib/HsqlTimer.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcBlob.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcDatabaseMetaData.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcDataSource.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcCallableStatement.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcClob.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcConnection.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcParameterMetaData.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcPreparedStatement.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcResultSet.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcResultSetMetaData.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcStatement.java"/>
        <arg file="${src}/org/hsqldb/persist/LockFile.java"/>
        <arg file="${src}/org/hsqldb/persist/Logger.java"/>
        <arg file="${src}/org/hsqldb/persist/ScaledRAFile.java"/>
        <arg file="${src}/org/hsqldb/rowio/RowInputTextLog.java"/>
        <arg file="${src}/org/hsqldb/util/DatabaseManager.java"/>
        <arg file="${src}/org/hsqldb/util/ConnectionDialogCommon.java"/>
        <arg file="${src}/org/hsqldb/lib/SimpleLog.java"/>
        <arg file="${src}/org/hsqldb/rowio/RowInputTextLog.java"/>
        <arg file="${src}/org/hsqldb/lib/SimpleLog.java"/>
        <arg file="${src}/org/hsqldb/rowio/RowInputTextLog.java"/>
        <arg file="${src}/org/hsqldb/HsqlDateTime.java"/>
        <arg value="+JAVA2"/>
        <arg value="+JAVA2FULL"/>
        <arg value="+JAVA4"/>
        <arg value="-JAVA6"/>
       </java>
    </target>


    <target name="switchtojdk16" depends="switchtojdk14"
            description="self explanatory" if="ant.java.iscjava16">
      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
        <arg file="${src}/org/hsqldb/lib/java/JavaSystem.java"/>
        <arg file="${src}/org/hsqldb/lib/HsqlTimer.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcBlob.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcDatabaseMetaData.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcDataSource.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcCallableStatement.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcClob.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcConnection.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcParameterMetaData.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcPreparedStatement.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcResultSet.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcResultSetMetaData.java"/>
        <arg file="${src}/org/hsqldb/jdbc/jdbcStatement.java"/>
        <arg file="${src}/org/hsqldb/persist/LockFile.java"/>
        <arg file="${src}/org/hsqldb/persist/Logger.java"/>
        <arg file="${src}/org/hsqldb/persist/ScaledRAFile.java"/>
        <arg file="${src}/org/hsqldb/rowio/RowInputTextLog.java"/>
        <arg file="${src}/org/hsqldb/util/DatabaseManager.java"/>
        <arg file="${src}/org/hsqldb/util/ConnectionDialogCommon.java"/>
        <arg file="${src}/org/hsqldb/lib/SimpleLog.java"/>
        <arg file="${src}/org/hsqldb/rowio/RowInputTextLog.java"/>
        <arg file="${src}/org/hsqldb/lib/SimpleLog.java"/>
        <arg file="${src}/org/hsqldb/rowio/RowInputTextLog.java"/>
        <arg file="${src}/org/hsqldb/HsqlDateTime.java"/>
        <arg value="+JAVA2"/>
        <arg value="+JAVA2FULL"/>
        <arg value="+JAVA4"/>
        <arg value="+JAVA6"/>
      </java>
    </target>

    <target name="store" depends="switchtojdk16"
            description="compiles the /store folder">
      <javac srcdir="${src}"
             destdir="classes"
                 debug="${build.debug}"
                 optimize="${build.optimize}"
      >
         <include name="org/hsqldb/store/**"/>
      </javac>
    </target>

    <target name="lib" depends="store"
            description="compiles the /lib folder">
      <javac srcdir="${src}"
             destdir="classes"
                 debug="${build.debug}"
                 optimize="${build.optimize}"
      >
         <include name="org/hsqldb/lib/**"/>
         <include name="org/hsqldb/lib/java/**"/>
      </javac>
    </target>

    <target name="classes" depends="lib,-javajsse"
            description="compiles all the classes">
      <javac srcdir="${src}"
             destdir="classes"
                 debug="${build.debug}"
                 optimize="${build.optimize}"
       >
         <classpath>
            <pathelement location="lib/servlet.jar"/>
         </classpath>
         <include name="*.java"/>
         <include name="org/hsqldb/*.java"/>
         <include name="org/hsqldb/index/*.java"/>
         <include name="org/hsqldb/jdbc/*.java"/>
         <include name="org/hsqldb/persist/*.java"/>
         <include name="org/hsqldb/resources/*.java"/>
         <include name="org/hsqldb/rowio/*.java"/>
         <include name="org/hsqldb/scriptio/*.java"/>
         <include name="org/hsqldb/types/*.java"/>
         <exclude name="org/hsqldb/HsqlSocketFactorySecure.java" unless="ant.java.hasjsse"/>
         <exclude name="org/hsqldb/jdbc/jdbcBlob.java"/>
         <exclude name="org/hsqldb/jdbc/jdbcClob.java"/>
         <exclude name="org/hsqldb/jdbc/jdbcDataSourceFactory.java"/>
         <exclude name="org/hsqldb/jdbc/jdbcParameterMetaData.java"/>
         <exclude name="org/hsqldb/jdbc/jdbcSavepoint.java"/>
         <exclude name="org/hsqldb/persist/NIOLockFile.java"/>
         <exclude name="org/hsqldb/persist/ScaledRAFileNIO.java"/>
         <exclude name="org/hsqldb/persist/ScaledRAFileHybrid.java"/>
      </javac>
      <copy todir="${basedir}/classes">
        <fileset dir="${src}" includes="**/*.properties, **/*.text"/>
      </copy>
    </target>


   <target name="classes14" depends="classes" if="ant.java.iscjava14"
           description="compiles 1.4 specific classes">
      <javac srcdir="${src}"
             destdir="classes"
                 debug="${build.debug}"
                 optimize="${build.optimize}"
       >
      <include name="org/hsqldb/jdbc/jdbcDataSourceFactory.java"/>
      <include name="org/hsqldb/jdbc/jdbcParameterMetaData.java"/>
      <include name="org/hsqldb/jdbc/jdbcSavepoint.java"/>
      <include name="org/hsqldb/persist/NIOLockFile.java"/>
      <include name="org/hsqldb/persist/ScaledRAFileNIO.java"/>
      <include name="org/hsqldb/persist/ScaledRAFileHybrid.java"/>
      </javac>
   </target>

   <target name="-test14" if="ant.java.iscjava14"
           description="compiles 1.4-specific test classes">
      <javac srcdir="${src}"
             destdir="classes"
             debug="${build.debug}"
             optimize="${build.optimize}"
             classpath="lib/junit.jar"
       >
          <include name="org/hsqldb/test/TestJDBCSavepoints.java"/>
          <include name="org/hsqldb/test/SqlToolHarness.java"/>
          <include name="org/hsqldb/test/TestSqlTool*.java"/>
      </javac>
   </target>

    <target name="util" depends="lib"
            description="compiles the /util folder">
      <javac srcdir="${src}"
             destdir="classes"
                 debug="${build.debug}"
                 optimize="${build.optimize}"
      >
         <include name="org/hsqldb/util/**"/>
         <exclude name="org/hsqldb/util/*Swing.java"/>
         <exclude name="org/hsqldb/util/TableSorter.java"/>
      </javac>
      <copy todir="classes/org/hsqldb/util">
          <fileset dir="${src}/org/hsqldb/util" includes='*.gif, *.png'/>
      </copy>
    </target>

   <target name="swing" depends="util" unless="noswing"
           description="compiles the swing based classes in the /util folder">
      <javac srcdir="${src}"
             destdir="classes"
                 debug="${build.debug}"
                 optimize="${build.optimize}"
       >
      <include name="org/hsqldb/util/*Swing.java"/>
      <include name="org/hsqldb/util/TableSorter.java"/>
      </javac>
   </target>

   <target name="test" depends="classes14"
           description="compiles the /test folder">
      <available property='_junit_available' file='lib/junit.jar' type='file'/>
      <fail unless='_junit_available'
            message="'junit.jar' must reside in the /lib directory in order to use this target"/>
      <javac srcdir="${src}"
             destdir="classes"
                 debug="${build.debug}"
                 optimize="${build.optimize}"
         >
         <classpath>
            <pathelement location="lib/junit.jar"/>
            <pathelement location="lib/dbunit.jar"/>
         </classpath>
         <include name="org/hsqldb/test/**"/>
         <exclude name="org/hsqldb/test/TestJDBCSavepoints.java"/>
         <exclude name="org/hsqldb/test/*SqlTool*.java"/>
      </javac>
      <antcall inheritall='true' target='-test14'/>
   </target>

    <target name="hsqldbz" depends="classes14,util"
            description="Build the hsqldbz.jar for Zaurus">
        <jar jarfile="lib/hsqldbz.jar"
             basedir="classes"
         >
         <manifest>
             <attribute name='Specification-Title' value='${hsqldb.title}'/>
             <attribute name='Specification-Version' value='${hsqldb.version}'/>
             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
             <attribute name='Implementation-Title'
                        value='Zaurus runtime'/>
             <attribute name='Implementation-Version' value='${build.label}'/>
             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
         </manifest>
         <exclude name="org/hsqldb/jmx/**"/>
         <exclude name="org/hsqldb/util/*Transfer*.*"/>
         <exclude name="org/hsqldb/util/*Swing*.*"/>
         <exclude name="org/hsqldb/util/DataAccess*.*"/>
         <exclude name="org/hsqldb/util/*Helper*.*"/>
         <exclude name="org/hsqldb/util/JDBCTypes.*"/>
         <exclude name="org/hsqldb/util/SQLStatements.*"/>
         <exclude name="org/hsqldb/util/QueryTool.*"/>
         <exclude name="org/hsqldb/util/ShutdownServer.*"/>
         <exclude name="org/hsqldb/util/CodeSwitcher.*"/>
         <exclude name="org/hsqldb/test/*.*"/>
         <exclude name="org/hsqldb/sample/*.*"/>
         <exclude name="hsqlServlet.class"/>
         <exclude name="org/hsqldb/Servlet.class"/>
         <exclude name="org/hsqldb/HsqlServerFactory.class"/>
         <exclude name="org/hsqldb/HsqlServerProperties.class"/>
         <exclude name="org/hsqldb/HsqlSocketRequestHandler.class"/>
         <exclude name="org/hsqldb/HsqlSocketRequestHandlerImpl.class"/>
         <exclude name="org/hsqldb/jdbc/jdbcDataSource.class"/>
         <exclude name="org/hsqldb/jdbc/jdbcDataSourceFactory.class"/>
         <exclude name="org/hsqldb/Server.class"/>
         <exclude name="org/hsqldb/ServerConnection.class"/>
         <exclude name="org/hsqldb/WebServer.class"/>
         <exclude name="org/hsqldb/WebServerConnection.class"/>
         <exclude name="org/hsqldb/jdbc/jdbcStubs.class"/>
         <exclude name="org/hsqldb/jdbc/Array.class"/>
         <exclude name="org/hsqldb/jdbc/Blob.class"/>
         <exclude name="org/hsqldb/jdbc/Clob.class"/>
         <exclude name="org/hsqldb/jdbc/Ref.class"/>
         <exclude name="org/hsqldb/jdbc/Map.class"/>
       </jar>
    </target>

    <target name="hsqldbtest" depends="test,swing"
            description="Build the hsqldbtest.jar (default plus test classes)">
        <jar jarfile="lib/hsqldbtest.jar"
             basedir="classes"
         >
         <manifest>
             <attribute name='Specification-Title' value='${hsqldb.title}'/>
             <attribute name='Specification-Version' value='${hsqldb.version}'/>
             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
             <attribute name='Implementation-Title'
                        value='Test runtime'/>
             <attribute name='Implementation-Version' value='${build.label}'/>
             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
         </manifest>
         <exclude name="org/hsqldb/jmx/**"/>
         <exclude name="org/hsqldb/sample/*.*"/>
         <exclude name="org/hsqldb/jdbc/jdbcStubs.class"/>
         <exclude name="org/hsqldb/jdbc/Array.class"/>
         <exclude name="org/hsqldb/jdbc/Blob.class"/>
         <exclude name="org/hsqldb/jdbc/Clob.class"/>
         <exclude name="org/hsqldb/jdbc/Ref.class"/>
         <exclude name="org/hsqldb/jdbc/Map.class"/>
      </jar>
    </target>

    <target name="hsqldbmain" depends="classes14"
            description="Build the hsqldbmain.jar (no utilities) (use '-Dnoswing=true jarmain' to exclude swing classes)">
        <jar jarfile="lib/hsqldbmain.jar"
             basedir="classes"
         >
         <manifest>
             <attribute name='Specification-Title' value='${hsqldb.title}'/>
             <attribute name='Specification-Version' value='${hsqldb.version}'/>
             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
             <attribute name='Implementation-Title'
                        value='Runtime without utilities'/>
             <attribute name='Implementation-Version' value='${build.label}'/>
             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
         </manifest>
         <exclude name="org/hsqldb/jmx/**"/>
         <exclude name="org/hsqldb/util/**"/>
         <exclude name="org/hsqldb/test/**"/>
         <exclude name="org/hsqldb/sample/**"/>
         <exclude name="org/hsqldb/jdbc/jdbcStubs.class"/>
         <exclude name="org/hsqldb/jdbc/Array.class"/>
         <exclude name="org/hsqldb/jdbc/Blob.class"/>
         <exclude name="org/hsqldb/jdbc/Clob.class"/>
         <exclude name="org/hsqldb/jdbc/Ref.class"/>
         <exclude name="org/hsqldb/jdbc/Map.class"/>
      </jar>
    </target>

    <target name="hsqldbmin" depends="classes14"
            description="Build the hsqldbmin.jar (no servers)">
        <jar jarfile="lib/hsqldbmin.jar"
             basedir="classes"
         >
         <manifest>
             <attribute name='Specification-Title' value='${hsqldb.title}'/>
             <attribute name='Specification-Version' value='${hsqldb.version}'/>
             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
             <attribute name='Implementation-Title'
                 value='Runtime without utilities and servers'/>
             <attribute name='Implementation-Version' value='${build.label}'/>
             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
         </manifest>
         <exclude name="org/hsqldb/jdbc/jdbcStubs.class"/>
         <exclude name="org/hsqldb/jdbc/Array.class"/>
         <exclude name="org/hsqldb/jdbc/Blob.class"/>
         <exclude name="org/hsqldb/jdbc/Clob.class"/>
         <exclude name="org/hsqldb/jdbc/Ref.class"/>
         <exclude name="org/hsqldb/jdbc/Map.class"/>
         <exclude name="org/hsqldb/jdbc/jdbcDataSourceFactory.class"/>
         <exclude name="org/hsqldb/jmx/**"/>
         <exclude name="org/hsqldb/util/**"/>
         <exclude name="org/hsqldb/test/**"/>
         <exclude name="org/hsqldb/sample/**"/>
         <exclude name="**/*.properties"/>
         <exclude name="hsqlServlet.class"/>
         <exclude name="org/hsqldb/Servlet.class"/>
         <exclude name="org/hsqldb/HsqlSocketFactory.class"/>
         <exclude name="org/hsqldb/HsqlSocketFactorySecure.class"/>
         <exclude name="org/hsqldb/HsqlServerFactory.class"/>
         <exclude name="org/hsqldb/HsqlServerProperties.class"/>
         <exclude name="org/hsqldb/HsqlSocketRequestHandler.class"/>
         <exclude name="org/hsqldb/HsqlSocketRequestHandlerImpl.class"/>
         <exclude name="org/hsqldb/Server.class"/>
         <exclude name="org/hsqldb/ServerConnection.class"/>
         <exclude name="org/hsqldb/WebServer.class"/>
         <exclude name="org/hsqldb/WebServerConnection.class"/>
         <exclude name="org/hsqldb/rowio/RowInputLegacy.class"/>
         <exclude name="org/hsqldb/rowio/RowOutputLegacy.class"/>
         <exclude name="org/hsqldb/DIProcedureInfo.class"/>
         <exclude name="org/hsqldb/HSQLClientConnection.class"/>
         <exclude name="org/hsqldb/HTTPClientConnection.class"/>
         <fileset dir="classes"
                includes="org/hsqldb/resources/sql-error-messages.properties"/>
       </jar>
    </target>

    <target name="hsqldb" depends="classes14,util,swing"
            description="Build the default hsqldb.jar">
        <jar jarfile="lib/hsqldb.jar"
             basedir="classes"
             compress="true"
         >
         <manifest>
             <attribute name='Specification-Title' value='${hsqldb.title}'/>
             <attribute name='Specification-Version' value='${hsqldb.version}'/>
             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
             <attribute name='Implementation-Title'
                        value='Standard runtime'/>
             <attribute name='Implementation-Version' value='${build.label}'/>
             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
             <!-- This attribute is completely ignored unless the user
                  uses the jar like "java -jar .../hsqldb.jar" -->
             <attribute name='Main-Class' value='org.hsqldb.util.SqlTool'/>
         </manifest>
         <exclude name="org/hsqldb/jmx/**"/>
         <exclude name="org/hsqldb/util/*Swing.*" if="noswing"/>
         <exclude name="org/hsqldb/util/*Transfer*.*"/>
         <exclude name="org/hsqldb/util/DataAccess*.*"/>
         <exclude name="org/hsqldb/util/*Helper*.*"/>
         <exclude name="org/hsqldb/util/JDBCTypes.*"/>
         <exclude name="org/hsqldb/util/SQLStatements.*"/>
         <exclude name="org/hsqldb/util/QueryTool.*"/>
         <exclude name="org/hsqldb/util/Zaurus*.*"/>
         <exclude name="org/hsqldb/test/*.class"/>
         <exclude name="org/hsqldb/sample/*.class"/>
         <exclude name="org/hsqldb/jdbcStubs.class"/>
         <exclude name="org/hsqldb/jdbc/Array.class"/>
         <exclude name="org/hsqldb/jdbc/Blob.class"/>
         <exclude name="org/hsqldb/jdbc/Clob.class"/>
         <exclude name="org/hsqldb/jdbc/Ref.class"/>
         <exclude name="org/hsqldb/jdbc/Map.class"/>
      </jar>
    </target>

    <fileset id='jdbcclasses' dir='classes'
        includes='org/hsqldb/lib/ArrayUtil*,
                  org/hsqldb/lib/AsciiStringInputStream*,
                  org/hsqldb/lib/HsqlByte*,
                  org/hsqldb/lib/IntValueHashMap*,
                  org/hsqldb/lib/InOutUtil*,
                  org/hsqldb/lib/Iterator*,
                  org/hsqldb/lib/HsqlHeap*,
                  org/hsqldb/lib/HsqlArray*,
                  org/hsqldb/lib/ObjectComparator*,
                  org/hsqldb/lib/IntKeyHashMap*,
                  org/hsqldb/lib/Collection*,
                  org/hsqldb/lib/*List*,
                  org/hsqldb/lib/Set*,
                  org/hsqldb/lib/Hash*,
                  org/hsqldb/lib/HsqlTimer*,
                  org/hsqldb/lib/StringConverter*,
                  org/hsqldb/lib/StringInputStream*,
                  org/hsqldb/lib/java/JavaSystem*,
                  org/hsqldb/jdbc/jdbc*,
                  org/hsqldb/jdbc/Util*,
                  org/hsqldb/rowio/RowOutputBase*,
                  org/hsqldb/rowio/RowInputBase*,
                  org/hsqldb/rowio/RowOutputBinary*,
                  org/hsqldb/rowio/RowInputBinary*,
                  org/hsqldb/rowio/RowOutputInterface*,
                  org/hsqldb/rowio/RowInputInterface*,
                  org/hsqldb/persist/HsqlDatabaseProperties*,
                  org/hsqldb/persist/HsqlProperties*,
                  org/hsqldb/store/ValuePool*,
                  org/hsqldb/store/HashIndex*,
                  org/hsqldb/store/BaseHashMap*,
                  org/hsqldb/types/*,
                  org/hsqldb/Column*,
                  org/hsqldb/DatabaseURL*,
                  org/hsqldb/HSQLClient*,
                  org/hsqldb/HsqlDateTime*,
                  org/hsqldb/HsqlException*,
                  org/hsqldb/HsqlSocketFactory*,
                  org/hsqldb/HTTPClientConnection*,
                  org/hsqldb/jdbcDriver*,
                  org/hsqldb/Library*,
                  org/hsqldb/Record*,
                  org/hsqldb/Result*,
                  org/hsqldb/Result$*,
                  org/hsqldb/Row*,
                  org/hsqldb/SessionInterface*,
                  org/hsqldb/Trace*,
                  org/hsqldb/Types*,
                  org/hsqldb/resources/*
                  '/>

    <fileset id='utilclasses' dir='classes'
        includes='org/hsqldb/util/**,
                  '/>

    <fileset id='sqltoolclasses' dir='classes'
        includes='org/hsqldb/util/SqlTool*,
                  org/hsqldb/util/RCData*,
                  org/hsqldb/util/RefCapablePropertyResourceBundle*,
                  org/hsqldb/util/SqltoolRB*,
                  org/hsqldb/util/ValidatingResourceBundle*,
                  org/hsqldb/util/AppendableException*,
                  org/hsqldb/util/SqlToolError*,
                  org/hsqldb/util/SqlFile*
                  org/hsqldb/lib/StringUtil*
                  org/hsqldb/lib/FileAccess*
                  '/>
    <fileset id='sqltoolres' dir='classes'
        includes='org/hsqldb/util/**/*.text,
                  org/hsqldb/util/**/*.properties
                  '/>

<!-- classes referenced by the org.hsqldb.jdbc package classes -->
<!-- or the org.hsqldb.jdbcDriver class are included here with some -->
<!-- ommissions where the calling methods are not actually used -->
    <target name="hsqljdbc" depends="classes14"
             description="Build the hsqljdbc.jar">
        <jar jarfile="lib/hsqljdbc.jar" compress="true">
          <manifest>
             <attribute name='Specification-Title' value='${hsqldb.title}'/>
             <attribute name='Specification-Version' value='${hsqldb.version}'/>
             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
             <attribute name='Implementation-Title'
                        value='JDBC client runtime'/>
             <attribute name='Implementation-Version' value='${build.label}'/>
             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
          </manifest>
          <fileset refid='jdbcclasses'/>
        </jar>
    </target>

    <target name="hsqltool" depends="classes14, util"
            description="Build the hsqltool.jar">
        <jar jarfile="lib/hsqltool.jar">
            <manifest>
                <attribute name='Specification-Title' value='${hsqldb.title}'/>
                <attribute name='Specification-Version' value='${hsqldb.version}'/>
                <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
                <attribute name='Implementation-Title'
                           value='SqlTool runtime, with JDBC driver'/>
                <attribute name='Implementation-Version' value='${build.label}'/>
                <attribute name='Implementation-Vendor' value='${build.vendor}'/>
                <attribute name='Main-Class' value='org.hsqldb.util.SqlTool'/>
            </manifest>
            <!-- including 'org/hsqldb/jdbc*' just to be safe -->
            <fileset refid='jdbcclasses'/>
            <fileset refid='sqltoolclasses'/>
            <fileset refid='sqltoolres'/>
        </jar>
    </target>

    <target name="transfer" depends="classes14, util"
            description="Build the transfer.jar">
        <jar jarfile="lib/transfer.jar">
            <manifest>
                <attribute name='Specification-Title' value='${hsqldb.title}'/>
                <attribute name='Specification-Version' value='${hsqldb.version}'/>
                <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
                <attribute name='Implementation-Title'
                           value='HSQLDB Transfer Tool classes'/>
                <attribute name='Implementation-Version' value='${build.label}'/>
                <attribute name='Class-Path' value='hsqldb.jar'/>
                <attribute name='Main-Class' value='org.hsqldb.util.DatabaseManagerSwing'/>
                <!-- If we prefer to encourage use of Transfer instead of
                     using Transfer functionality from DatabaseManager, then
                     change the Main-Class to org.hsqldb.util.Transfer. -->
            </manifest>
            <!-- including 'org/hsqldb/jdbc*' just to be safe -->
            <fileset dir='classes'
                includes='
                    org/hsqldb/util/Transfer*,
                    org/hsqldb/util/DataAccessPoint*,
                    org/hsqldb/util/HelperFactory*
                    org/hsqldb/util/*TransferHelper*
                    org/hsqldb/util/JDBCTypes*
                    org/hsqldb/util/SQLStatements*
            '/>
        </jar>
    </target>

    <target name="hsqldbutil" depends="util,swing"
            description="Build the utility hsqldbutil.jar">
        <jar jarfile="lib/hsqldbutil.jar" compress="true">
         <manifest>
             <attribute name='Specification-Title' value='${hsqldb.title}'/>
             <attribute name='Specification-Version' value='${hsqldb.version}'/>
             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
             <attribute name='Implementation-Title'
                        value='Utilities runtime, without JDBC driver'/>
             <attribute name='Implementation-Version' value='${build.label}'/>
             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
             <!-- N.b. Blaine removed the Main-Class because this jar is
                  useless without a JDBC driver in the classpath, and you
                  can't add to classpath if invoked with "-jar" -->
         </manifest>
         <fileset refid='utilclasses'/>
      </jar>
    </target>

    <target name="javadoc" depends="-preparedoc"
            description="Create javadoc for the distribution package">
      <javadoc
		   sourcefiles="${src}/org/hsqldb/jdbcDriver.java,
                        ${src}/org/hsqldb/Trigger.java,
		   				${src}/org/hsqldb/Server.java,
		   				${src}/org/hsqldb/WebServer.java,
		   				${src}/org/hsqldb/sample/TriggerSample.java,
		   				${src}/org/hsqldb/util/RCData.java,
		   				${src}/org/hsqldb/util/SqlTool.java"
           destdir="${basedir}/doc/src"
           classpath="${basedir}/lib/servlet.jar;${basedir}/lib/junit.jar"
           author="true"
           version="false"
           use="true"
           public="true"
           stylesheetfile="${basedir}/doc/src/hsqldbstylesheet.css"
           windowtitle="${hsqldb.title} ${hsqldb.version} API"
           doctitle="${hsqldb.title} ${hsqldb.version}"
           bottom="&lt;i&gt;Copyright &#169; 2001 - 2005 HSQL Development Group. All Rights Reserved.&lt;/i&gt;">
           <packageset dir='${src}'>
               <include name='org/hsqldb/jdbc'/>
           </packageset>

     </javadoc>
   </target>

    <target name="javadocdev" depends="-preparedoc"
            description="Create javadoc for developers">
      <javadoc packagenames="org.hsqldb.*,org.hsqldb.jdbc.*,org.hsqldb.lib.*,org.hsqldb.util.*"
           sourcepath="${src}"
           destdir="${basedir}/doc/src"
           classpath="${basedir}/lib/servlet.jar;${basedir}/lib/junit.jar"
           author="true"
           version="false"
           use="true"
           public="true"
           stylesheetfile="${basedir}/doc/src/hsqldbstylesheet.css"
           windowtitle="${hsqldb.title} ${hsqldb.version} API"
           doctitle="${hsqldb.title} ${hsqldb.version}"
           bottom="&lt;i&gt;Copyright &#169; 2001 - 2005 HSQL Development Group. All Rights Reserved.&lt;/i&gt;">
     </javadoc>
   </target>

   <!-- ******************************************************************* -->
   <!--  From here down to the matching ******* line, DocBook-related stuff -->

    <!-- Only do vigilant runtime checking for props for externally
         executable targets.  Requirements for internals are just noted -->

    <property name='fop-loglevel' value='error'/>
    <property name='style.html' value='${docbook.xsl.home}/html/docbook.xsl'/>
    <property name='style.chunk' value='${docbook.xsl.home}/html/chunk.xsl'/>
    <property name='style.fo' value='${docbook.xsl.home}/fo/docbook.xsl'/>
    <!-- This is default only for invoking some external docbook targets -->
    <property name='outputType' value='html'/>

    <!-- Note that we do not generate postscript by default -->
    <target name='docbook'
        description='Generate all DocBook docs in HTML and PDF formats'
            depends='docbooks-html, docbooks-chunk, docbooks-pdf'/>

    <target name='docbooks-html' depends='-initContrib'
            description='Generate all DocBook non-chunk HTML output'>
        <antcall inheritall='false' target='-ddIterate'>
            <param name='outputType' value='html'/>
        </antcall>
    </target>
    <target name='docbooks-chunk' depends='-initContrib'
            description='Generate all DocBook Chunk HTML output'>
        <antcall inheritall='false' target='-ddIterate'>
            <param name='outputType' value='chunk'/>
        </antcall>
    </target>
    <target name='docbooks-pdf' depends='-initContrib'
            description='Generate all DocBook PDF output'>
        <antcall inheritall='false' target='-ddIterate'>
            <param name='outputType' value='pdf'/>
        </antcall>
    </target>
    <target name='docbooks-ps' depends='-initContrib'
            description='Generate all DocBook Postscript output'>
        <antcall inheritall='false' target='-ddIterate'>
            <param name='outputType' value='ps'/>
        </antcall>
    </target>

    <target name='-ddIterate'>
        <!-- Iterate through docsrc dirs, invoking condlGenbok for each -->
        <!-- Internal caller MUST set 'outputType' -->
        <pathconvert property='_docsrcdirs' targetos='unix' pathsep='|'
                     setonempty='false'> <path>
             <dirset dir='docsrc' includes='*'/>
        </path> </pathconvert>
        <!-- If is needed so that ant doesn't fail if there are no
             DocDir documents -->
        <if><isset property='_docsrcdirs'/><then>
            <foreach list='${_docsrcdirs}' param='docdirpath' inheritall='false'
                     target='-condlGenbook' delimiter='|'>
                <param name='outputType' value='${outputType}'/>
            </foreach>
        </then></if>
    </target>

    <target name='-condlGenbook'>
        <!-- Conditionally run target 'html' or 'chunked' or 'pdf' -->
        <!-- Internal caller MUST set 'docdirpath' and 'outputType' -->
        <!-- Invoke genbook target iff corresponding DocBook src file exists -->
        <basename property='book' file='${docdirpath}'/>
        <!-- Note that inheritall is true, so we pass through all vars, incl.
             'book'.  N.b. This target (-condlGenbook) should be called
             with inheritall false!! -->
        <if> <available type='file' file='${docdirpath}/${book}.xml'/> <then>
            <antcall target='${outputType}'/>
        </then> </if>
    </target>

    <target name='-preDocbook'>
        <!-- description='Run before generating docbook for a partic. dir -->
        <!-- Required Props:  book -->
        <mkdir dir='docwork/${book}/cdata'/>
        <if><not><uptodate targetfile='docwork/${book}/cdata/.status'>
            <!-- Mappers don't work with multiple patterns.
            Therefore, have to use a timestamp file.  -->
            <srcfiles dir='src/org/hsqldb/sample'
             includes='*.java, *.txt, *.ksh, *.properties, *.rc, *.cfg, *.sql'/>
        </uptodate></not><then>
            <!-- This copies files matching the fileset below to the docwork
                 dir w/ data so that DocBook may entity include them.
                 For the time being, these files must reside in the main
                 directory  for this specific book. -->
            <pathconvert property='_virginfiles' targetos='unix' pathsep='|'
                         setonempty='false'> <path>
                 <fileset dir='src/org/hsqldb/sample'
             includes='*.java, *.txt, *.ksh, *.properties, *.rc, *.cfg, *.sql'/>
            </path> </pathconvert>
            <if><isset property='_virginfiles'/><then>
                <foreach list='${_virginfiles}' param='vfile' inheritall='false'
                    target='-sandwich' delimiter='|'>
                    <param name='book' value='${book}'/>
                </foreach>
            </then></if>
        </then></if>
        <touch file='docwork/${book}/cdata/.status'/>
    </target>

    <target name='-postDocbook'>
        <!-- Run after generating docbook for a partic. dir -->
        <!-- Property 'book' MUST be set before calling this target -->
        <copy todir='doc'>
            <fileset dir='docsrc' excludes='.*, *.css, *.java, *.sql, *.txt'/>
        </copy>
        <copy todir='doc/${book}'>
            <fileset dir='docsrc/${book}'
                     excludes='.*, *.css, *.java, *.sql, *.txt'/>
        </copy>
        <delete file='doc/${book}/${book}.bs'/>
    </target>

    <target name='chunk' description='Build one Chunk HTML DocBook book'
            depends='-setXsltFilesets'>
        <fail unless='book'
              message="You must set property 'book' to use target 'chunk'"/>
        <dependset>
            <srcfileset refid='sharedXsltSrcFiles'/>
            <srcfileset refid='bookXsltSrcFiles'/>
              <!-- This messy because ant doesn't support wildcard
              ch[0-9]*.html -->
            <targetfileset  dir='doc/${book}'
                includes='ch0*.html, ch1*.html, ch2*.html, ch3*.html,
                         ch4*.html, ch5*.htlm, ch6*.html, ch7*.html,
                         ch8*.html, ch9*.html, index.html'/>
        </dependset>
        <if><not><available type='file' file='doc/${book}/index.html'/></not>
        <then>
            <antcall target='-preDocbook'/>
            <fail unless='style.chunk'
                  message="You must set property 'style.chunk'"/>
            <antcall target='-htmlXslt' inheritall='false'>
                <param name='_stylesheet' value='${style.chunk}'/>
                <param name='book' value='${book}'/>
                <param name='_ext' value='.bs'/>
            </antcall>
            <antcall target='-postDocbook'/>
        </then></if>
        <copy todir='doc'>
            <fileset dir='docsrc'
                     includes='**/*.css, **/*.java, **/*.sql, **/*.txt'/>
        </copy>
    </target>
    <target name='html' description='Build one single-page HTML DocBook book'
            depends='-setXsltFilesets'>
        <fail unless='book'
              message="You must set property 'book' to use target 'html'"/>
        <dependset>
            <srcfileset refid='sharedXsltSrcFiles'/>
            <srcfileset refid='bookXsltSrcFiles'/>
            <targetfileset  dir='doc/${book}' includes='${book}.html'/>
        </dependset>
        <if><not><available type='file' file='doc/${book}/${book}.html'/></not>
        <then>
            <antcall target='-preDocbook'/>
            <antcall target='-htmlXslt' inheritall='false'>
                <param name='_stylesheet' value='${style.html}'/>
                <param name='book' value='${book}'/>
            </antcall>
            <antcall target='-postDocbook'/>
        </then></if>
        <copy todir='doc'>
            <fileset dir='docsrc'
includes='**/*.css, **/*.java, **/*.sql, **/*.txt, **/*.properties, **/*.cfg'/>
        </copy>
    </target>
    <target name='fo' description='Build one DocBook FO file'
            depends='-initContrib, -setXsltFilesets'>
        <fail unless='book'
              message="You must set property 'book' to use target 'fo'"/>
        <dependset>
            <!-- Images and included files may be needed for .fo gen and
                 pdf/ps gen.  Need to test that to optimize the dependsets. -->
            <srcfileset refid='sharedXsltSrcFiles'/>
            <srcfileset refid='bookXsltSrcFiles'/>
              <!-- This messy because ant doesn't support wildcard
              ch[0-9]*.html -->
            <targetfilelist  dir='docwork/${book}' files='${book}.fo'/>
        </dependset>
        <if><not><available type='file'
                            file='docwork/${book}/${book}.fo'/></not>
        <then>
            <antcall target='-preDocbook'/>
            <fail unless='style.html'
                  message="You must set property 'style.html'"/>
            <antcall target='-foXslt' inheritall='false'>
                <param name='book' value='${book}'/>
            </antcall>
            <antcall target='-postDocbook'/>
        </then></if>
    </target>
    <target name='pdf' depends='fo'>
        <!-- The depended-upon fo target will check required props -->
        <dependset>
            <!-- Images and included files may be needed for .fo gen and
                 pdf/ps gen.  Need to test that to optimize the dependsets. -->
            <srcfileset refid='sharedXsltSrcFiles'/>
            <srcfileset refid='bookXsltSrcFiles'/>
            <srcfilelist dir='docwork/${book}' files='${book}.fo'/>
            <targetfilelist dir='doc/${book}' files='${book}.pdf'/>
        </dependset>
        <if><not><available type='file' file='doc/${book}/${book}.pdf'/></not>
        <then>
            <antcall target='-fop' inheritall='false'>
                <param name='_lvl' value='${fop-loglevel}'/>
                <param name='_fmt' value='application/pdf'/>
                <param name='book' value='${book}'/>
            </antcall>
        </then></if>
    </target>
    <target name='ps' depends='fo'>
        <!-- The depended-upon fo target will check required props -->
        <dependset>
            <!-- Images and included files may be needed for .fo gen and
                 pdf/ps gen.  Need to test that to optimize the dependsets. -->
            <srcfileset refid='sharedXsltSrcFiles'/>
            <srcfileset refid='bookXsltSrcFiles'/>
            <srcfilelist dir='docwork/${book}' files='${book}.fo'/>
            <targetfilelist dir='doc/${book}' files='${book}.ps'/>
        </dependset>
        <if><not><available type='file' file='doc/${book}/${book}.ps'/></not>
        <then>
            <antcall target='-fop' inheritall='false'>
                <param name='_lvl' value='${fop-loglevel}'/>
                <param name='_fmt' value='application/postscript'/>
                <param name='book' value='${book}'/>
            </antcall>
        </then></if>
    </target>

    <target name='-checkXslt' unless='_xsltChecked'>
        <!-- Don't call this before -initContrib called -->
        <if><not> <available
            classname='org.apache.xalan.processor.TransformerFactoryImpl'/>
        </not><then>
        <fail message="XSLT library not available.  See 'readmedocbook.txt'"/>
        </then></if>
        <property name='_xsltChecked' value='true'/>
    </target>

    <target name='-setXsltFilesets'>
        <!-- You MUST set property 'book' before calling this target -->
        <fileset id='bookXsltSrcFiles' dir='docsrc/${book}'
            includes='**/*.xml, **/*.png, **/*.jpg, **/*.txt, **/*.java,
                      **/*.sql, **/*.properties, **/*.rc, **/*.cfg'/>
        <fileset id='sharedXsltSrcFiles' dir='docsrc'
                includes='*.xml, *.txt, *.png, *.java, *.jpg, *.html, *.sql'/>
    </target>

    <target name='-sandwich'>
        <basename property='base' file='${vfile}'/>
        <loadfile srcfile='${vfile}' property='content'/>
        <dependset>
            <srcfilelist dir='src/org/hsqldb/sample' files='${base}'/>
            <targetfilelist dir='docwork/${book}/cdata' files='${base}'/>
        </dependset>
        <if><not><available file='docwork/${book}/cdata/${base}'/></not>
        <then>
            <mkdir dir='docwork/${book}/cdata'/>
            <echo file='docwork/${book}/cdata/${base}'
                  message='&lt;![CDATA[${content}]]&gt;'/>
        </then></if>
    </target>

    <!-- I'm not sure that <fop> actually needs the Xslt libs, but it
         probably does.  Test this sometime.  -->
    <target name='-initFop' unless='_fop_initted' depends='-checkXslt'>
        <fail unless='fop.home'
  message="To build from DocBook FO files, you must set property 'fop.home'"/>
        <if><not><available file='${fop.home}' type='dir'/></not><then>
            <fail message="The &lt;fop&gt; target not found where expected under '${fop.home}'"/>
        </then></if>
        <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop">
            <classpath>
                <fileset dir='${fop.home}/build' includes='fop*.jar'/>
                <!-- See the FOP docs for why these are needed, and where
                     to get them from -->
                <fileset dir='${fop.home}/lib'
                         includes='avalon*.jar, batik*.jar, jimi*.jar'/>
            </classpath>
        </taskdef>
        <property name='_fop_initted' value='true'/>
    </target>

    <target name='-initContrib' unless='_contrib_initted'>
        <!-- We use ant-contrib-X.jar (where X is a version).  Make sure
             that this jar is located at path-to-ant-bin/../lib -->
        <available property='_contrib_there'
                   classname='net.sf.antcontrib.logic.ForTask'/>
        <fail unless='_contrib_there' message="You must put a recent cut of ant-contrib-X.jar into 'path-to-ant-bin/../lib/' (or just put the jar into your CLASSPATH before running ant)"/>
        <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
        <property name='_contrib_initted' value='true'/>
    </target>

    <target name='-fop' depends='-initFop'>
        <!-- Required properties:  book, _lvl, _fmt -->
        <fop format="${_fmt}" outdir="doc/${book}" messagelevel="${_lvl}"
            basedir='docsrc/${book}'>
            <fileset file='docwork/${book}/${book}.fo'/>
        </fop>
    </target>

    <target name='-htmlXslt' depends='-checkXslt'>
        <!-- This does not check dependencies.  Do that before calling. -->
        <!-- Required properties:  _stylesheet, book -->
        <fail if='_css' message="Internal property '_css' set externally"/>
        <fail unless='docbook.xsl.home' message="To use the DocBook targets, you must set property 'docbook.xsl.home"/>
        <if><not><available type='file' file='${_stylesheet}'/></not><then>
            <fail message="DocBook style sheet '${_stylesheet}' not found."/>
        </then></if>
        <available property='_css' value='${book}.css' type='file'
                   file='docsrc/${book}/${book}.css'/>
        <property name='_css' value='../shared.css'/>
        <property name='_ext' value='.html'/>
        <style
               basedir='docsrc/${book}'
               destdir='doc/${book}'
               force='yes'
               style='${_stylesheet}'
               includes='${book}.xml'
               extension='${_ext}'>
            <param name='html.stylesheet' expression='${_css}'/>
            <param name='navig.graphics' expression='true'/>
            <param name='navig.graphics.path' expression='navicons/'/>
            <param name='navig.graphics.extension' expression='.gif'/>
            <param name='chunk.section.depth' expression='0'/>
        </style>
    </target>

    <target name='-foXslt' depends='-checkXslt'>
        <!-- This does not check dependencies.  Do that before calling. -->
        <!-- Required props:  book -->
        <fail unless='docbook.xsl.home' message="To use the DocBook targets, you must set property 'docbook.xsl.home"/>
        <if><not><available type='file' file='${style.fo}'/></not><then>
            <fail message="DocBook style sheet '${style.fo}' not found."/>
        </then></if>
        <style
               basedir='docsrc/${book}'
               destdir='docwork/${book}'
               force='yes'
               style='${style.fo}'
               includes='${book}.xml'
               extension='.fo'
         >
            <param name='use.extensions' expression='1'/>
            <param name='tablecolumns.extension' expression='0'/>
            <param name='textinsert.extension' expression='1'/>
            <param name='fop.extensions' expression='1'/>
         </style>
    </target>

    <target name='clean-doc' description='Remove derived documentation files'
            depends='clean-docwork'>
        <!-- All CVS-controlled are in docsrc directory.
             At that point, doc will contain only derived files, and this
             target can just wipe out the docwork and doc directories. -->
        <delete quiet='true' includeEmptyDirs='true'>
            <fileset dir='doc' includes='*.gif, *.css, guide/**'/>
        </delete>
        <delete dir='docwork' quiet='true' includeEmptyDirs='true'/>
    </target>

    <target name='clean-docwork' description='Remove temporary documentation files'>
        <delete dir='docwork' quiet='true' includeEmptyDirs='true'/>
        <delete quiet='true' includeEmptyDirs='true'>
            <fileset dir='doc' includes='**/*.xml'/>
        </delete>
    </target>
</project>
