1<?xml version="1.0"?>
2<!-- $Id: build.xml 5541 2016-02-18 15:26:36Z fredt $ -->
3<!-- author fredt@users.sourceforge.net 2001 - 2010 -->
4<!-- additional targets 2004-2010: blaine (dot) simpson (at) admc (dot) com -->
5<project name="hsqldb" default="help" basedir="../">
6  <!--  To see what build properties you can change, see the property elements
7        below.
8
9        This loads properties in the same exact way as if you ran
10        "ant -Dprop1name=val1 -Dprop2name=val2...", etc.  To use all
11        defaults, you should have no 'build.properties' file.
12        If you don't understand this or want to know about precedence or
13        how to use an Ant properties file, look up an Ant manual or an
14        Ant expert.
15        If you want to know, "Can I set property 'x' in 'build.properties'",
16        rephrase the question to yourself as "Can I run 'ant -Dx=...?"
17        Do not address questions about property file(s) to the
18        hsqldb community.
19        -->
20
21  <!-- TODO:
22        Use multiple class directories (javac dest dirs).
23        Current tactic requires tons of complicated includes and exludes
24        and still often bundles arbitrary extra stuff (determined by what
25        happened to be built previously).
26  -->
27
28   <property file='build/build.properties'/>
29   <property name="hsqldb.version" value="2.3.4"/>
30
31   <tstamp>
32       <format property="timestamp" pattern="yyyy/MM/dd-HH:mm:ss"
33               locale="en"/>
34   </tstamp>
35
36   <property name="build.label" value="private-${timestamp}"/>
37   <property name="build.vendor" value="${user.name}"/>
38   <property name="hsqldb.title" value="HSQLDB"/>
39   <property name="hsqldb.vendor" value="The HSQL Development Group"/>
40   <property name="description"
41             value="HyperSQL Lightweight 100% Java SQL Database Engine"/>
42   <property name="build.sysclasspath" value="ignore"/>
43   <property name="javac.encoding" value="ISO-8859-1"/>
44   <property name="swsrc" value="${basedir}/tmp/switchedsrc/"/>
45   <available property="switch.inplace"
46              file="${swsrc}/org/hsqldb/package.html"/>
47    <!-- Hosting Junit 3.8.2 JavaDocs at hsqldb.org since it's not available
48         expanded anywhere on Internet that I can find. -->
49   <property name="junit.doc.link"
50             value="http://www.hsqldb.org/doc/junit-3.8.2-javadoc/"/>
51
52   <!-- It is safe to override these with settings in your own
53        build.properties file. -->
54   <property name="build.debug" value="false"/>
55   <property name="build.optimize" value="false"/>
56   <!-- N.b. Compilation optimization only has effect with JDK 1.1 and 1.2 -->
57
58   <property name="servletapi.lib" value="lib/servlet-2_3-fcs-classfiles.zip"/>
59   <property name="junit38.lib" value="lib/junit.jar"/>
60   <property name='jflex.lib' value='lib/JFlex.jar'/>
61
62   <target name="init"/>
63
64   <target name='explainjars'
65           description="List description of jars that you can build">
66     <echo>Ant version: ${ant.version} </echo>
67     <echo>Java version: ${java.version} </echo>
68     <echo>jar filename    build command   explanation
69--------------  -------------   -----------------------------------
70hsqldb.jar      ant hsqldb      Default distribution jar
71hsqljdbc.jar    ant hsqljdbc    JDBC network client JDBC Driver.
72                                (Can connect to HyperSQL Servers)
73hsqldbmain.jar  ant hsqldbmain  No utility programs
74hsqldbutil.jar  ant hsqldbutil  Utility programs only.  No JDBC
75                                driver.  (Includes SqlTool and
76                                DatabaseManagers)
77hsqldbmin.jar   ant hsqldbmin   No utility or server programs.
78                                (Includes in-process JDBC driver,
79                                but no support for HyperSQL
80                                Servers)
81hsqldbtest.jar  ant hsqldbtest  All, including test classes
82sqltool.jar     ant sqltool     SqlTool app (no JDBC driver)</echo>
83   </target>
84
85   <target name="help" description="Top-level help message">
86     <echo>Ant version: ${ant.version} </echo>
87      <echo>usage:
88   ant -help            Display ant help screen
89   ant -projecthelp     Display all invocable targets
90   ant explainjars      List all targets which build jar files
91   ant ANYTHING ELSE    Run 'ant -projecthelp' for details
92
93examples:
94   ant hsqldb
95   ant clean</echo>
96   </target>
97
98   <target name="-javajsse">
99      <available classname="javax.net.ssl.SSLSession" property="ant.java.hasjsse"/>
100      <echo message="ant.java.hasjsse=${ant.java.hasjsse}" />
101   </target>
102
103   <target name="-set-jvmvars">
104   <!-- Besides this one target taking the place of 4 targets (-javaversionX),
105        this target eliminates the redundancy in those methods by making a
106        single class-existence-test definitively responsible for determining if
107        JVM X is supported.
108        It is sufficient for this purposes if the test classes used are
109        verified to be present in version X and in all newer versions (> X)
110        (i.e. that the class is not removed from some higher JVM). -->
111      <available classname="java.lang.ref.Reference" property="ant.java.iscjava12"/>
112      <available classname="java.lang.ref.Reference" property="ant.java.iscjavamodern"/>
113      <available classname="java.nio.Buffer" property="ant.java.iscjava14"/>
114      <available classname="java.util.EnumSet" property="ant.java.iscjava15"/>
115      <available classname="java.net.IDN" property="ant.java.iscjava16"/>
116      <available classname="java.sql.PseudoColumnUsage" property="ant.java.iscjava17"/>
117   </target>
118
119   <target name="-prepare" depends="init,-set-jvmvars">
120       <mkdir dir="classes" />
121   </target>
122
123   <target name="-prepare-javadoc" depends="init">
124     <delete dir="doc/apidocs"/>
125     <!-- Must be vigilant about cleaning up from previous runs, since this
126          same directory is used for both public API spec, and the full
127          code-base API spec.
128          There is no performance penalty, since the javadoc task regenerates
129          everything each run.
130      -->
131     <copy todir="doc/apidocs">
132       <!-- IMPORTANT:
133            Add a fixcrlf if we add non-binary files to doc-src/apidocs. -->
134       <fileset dir="doc-src/apidocs"/>
135     </copy>
136   </target>
137
138
139   <target name="reinit"
140       description="Just like 'clean' target, except overwrites switched source files to prevent need for a complete re-copy">
141       <!-- Beware this will refresh a copy of removed artifacts under swsrc.
142            You must use the real 'clean' target to really purge everything. -->
143       <fail message="Just use 'clean' for inplace-switching setups"
144             if="switch.inplace"/>
145       <delete dir="classes"/>
146       <copy todir='${swsrc}' preservelastmodified='true'>
147           <fileset dir='src' includes='**/*.java'/>
148       </copy>
149   </target>
150
151   <target name="clean" depends="-clean, -clean-switch-branch"
152           description="Delete the /classes and work directories created by ant tasks">
153        <echo message="Use the 'clean-all' target to also purge generated doc and .jar files"/>
154   </target>
155
156   <target name="-clean">
157        <delete dir="classes"/>
158   </target>
159
160   <target name="clean-all" depends="-clean, -clean-switch-branch, clean-docs"
161           description="Same as clean but delete the jar and doc files as well">
162      <delete>
163         <fileset dir="lib" includes="sqltool*.jar, hsql*.jar, testsuite.jar"/>
164      </delete>
165   </target>
166
167    <target name="codeswitcher" depends="-prepare"
168            description="uses +-JAVA4 +-JAVA5 +-JAVA6 +-JAVA7 etc">
169      <javac destdir="classes" includeantruntime="false">
170         <src path="src"/>
171         <include name="org/hsqldb/util/CodeSwitcher.java"/>
172      </javac>
173      <antcall target="-update-switch-branch"/>
174    </target>
175
176    <target name="switchtodeprecatedjdbc" depends="codeswitcher"
177            description="self explanatory">
178      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
179        <arg file="${swsrc}/org/hsqldb/jdbc/JDBCCallableStatement.java"/>
180        <arg file="${swsrc}/org/hsqldb/jdbc/JDBCPreparedStatement.java"/>
181        <arg file="${swsrc}/org/hsqldb/jdbc/JDBCResultSet.java"/>
182        <arg value="+DEPRECATEDJDBC"/>
183      </java>
184    </target>
185
186    <target name="switchoffdeprecatedjdbc" depends="codeswitcher"
187            description="self explanatory">
188      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
189        <arg file="${swsrc}/org/hsqldb/jdbc/JDBCCallableStatement.java"/>
190        <arg file="${swsrc}/org/hsqldb/jdbc/JDBCPreparedStatement.java"/>
191        <arg file="${swsrc}/org/hsqldb/jdbc/JDBCResultSet.java"/>
192        <arg value="-DEPRECATEDJDBC"/>
193      </java>
194    </target>
195
196    <!-- If this should not be called externally, rename to -switches
197         and remove the description attribute -->
198    <target name="switches" depends="codeswitcher"
199            description="Execute code switchers, other than for JVM version">
200    </target>
201
202    <target name="switchtojdk14" depends="switches" unless="ant.java.iscjava15"
203            description="self explanatory" if="ant.java.iscjava14">
204      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
205          <arg value="+JAVA4"/>
206          <arg value="-JAVA5"/>
207          <arg value="-JAVA6"/>
208          <arg value="-JAVA7"/>
209          <arg value="--pathlist=${basedir}/build/jdkcodeswitch.list"/>
210          <arg value="--basedir=${swsrc}"/>
211          <!-- Since these paths are interpreted by the JVM, not ant,
212               the path must be relative to run dir (build), not the
213               Ant basedir -->
214       </java>
215    </target>
216
217    <target name="switchtojdk15" depends="switches" unless="ant.java.iscjava16"
218      description="self explanatory" if="ant.java.iscjava15">
219      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
220          <arg value="+JAVA4"/>
221          <arg value="+JAVA5"/>
222          <arg value="-JAVA6"/>
223          <arg value="-JAVA7"/>
224          <arg value="--pathlist=${basedir}/build/jdkcodeswitch.list"/>
225          <arg value="--basedir=${swsrc}"/>
226          <!-- Since these paths are interpreted by the JVM, not ant,
227               the path must be relative to run dir (build), not the
228               Ant basedir -->
229       </java>
230    </target>
231
232    <target name="switchtojdk16" depends="switches"
233            description="self explanatory" if="ant.java.iscjava16">
234      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
235          <arg value="+JAVA4"/>
236          <arg value="+JAVA5"/>
237          <arg value="+JAVA6"/>
238          <arg value="-JAVA7"/>
239          <arg value="--pathlist=${basedir}/build/jdkcodeswitch.list"/>
240          <arg value="--basedir=${swsrc}"/>
241          <!-- Since these paths are interpreted by the JVM, not ant,
242               the path must be relative to run dir (build), not the
243               Ant basedir -->
244       </java>
245    </target>
246
247    <target name="switchtojdk17" depends="switches"
248            description="self explanatory" if="ant.java.iscjava17">
249      <java classname="org.hsqldb.util.CodeSwitcher" classpath="classes" >
250          <arg value="+JAVA4"/>
251          <arg value="+JAVA5"/>
252          <arg value="+JAVA6"/>
253          <arg value="+JAVA7"/>
254          <arg value="--pathlist=jdkcodeswitch.list"/>
255          <arg value="--basedir=${swsrc}"/>
256          <!-- Since these paths are interpreted by the JVM, not ant,
257               the path must be relative to run dir (build), not the
258               Ant basedir -->
259       </java>
260    </target>
261
262    <target name="map" description="compiles the /map folder"
263            depends="switchtojdk14,
264                     switchtojdk15,switchtojdk16,
265                     switchtojdk17">
266      <javac srcdir="${swsrc}" includeantruntime="false"
267             encoding="${javac.encoding}"
268             destdir="classes"
269             debug="${build.debug}"
270             optimize="${build.optimize}"
271      >
272         <include name="org/hsqldb/map/**"/>
273      </javac>
274    </target>
275
276    <target name="lib" depends="map"
277            description="compiles the JVM-independent lib classes">
278      <javac srcdir="${swsrc}"
279             includeantruntime="false"
280             destdir="classes"
281             debug="${build.debug}"
282             optimize="${build.optimize}"
283             encoding="${javac.encoding}"
284      >
285         <exclude name="org/hsqldb/lib/AppendableException.java"/>
286         <exclude name="org/hsqldb/lib/RefCapablePropertyResourceBundle.java"/>
287         <exclude name="org/hsqldb/lib/RefCapableRBInterface.java"/>
288         <exclude name="org/hsqldb/lib/ValidatingResourceBundle.java"/>
289         <exclude name="org/hsqldb/lib/tar/**"/>
290         <include name="org/hsqldb/lib/**"/>
291      </javac>
292    </target>
293
294    <target name="classes" depends="lib,-javajsse"
295      description="compiles JVM-independent non-lib/util/cmdline/auth classes">
296      <available property='_servlet_available' classpath='${servletapi.lib}'
297                 classname='javax.servlet.ServletException'/>
298      <fail unless='_servlet_available'
299            message="Place Jar file for Servlet API at '${servletapi.lib}', or set property 'servletapi.lib'"/>
300      <javac srcdir="${swsrc}"
301             includeantruntime="false"
302             encoding="${javac.encoding}"
303             destdir="classes"
304             debug="${build.debug}"
305             optimize="${build.optimize}"
306       >
307         <classpath>
308            <pathelement location="${servletapi.lib}"/>
309         </classpath>
310         <include name="org/hsqldb/*.java"/>
311         <include name="org/hsqldb/dbinfo/*.java"/>
312         <include name="org/hsqldb/index/*.java"/>
313         <include name="org/hsqldb/jdbc/*.java"/>
314         <include name="org/hsqldb/navigator/*.java"/>
315         <include name="org/hsqldb/persist/*.java"/>
316         <include name="org/hsqldb/resources/*.java"/>
317         <include name="org/hsqldb/result/*.java"/>
318         <include name="org/hsqldb/rowio/*.java"/>
319         <include name="org/hsqldb/scriptio/*.java"/>
320         <include name="org/hsqldb/server/*.java"/>
321         <include name="org/hsqldb/map/*.java"/>
322         <include name="org/hsqldb/types/*.java"/>
323         <include name="org/hsqldb/rights/*.java"/>
324         <exclude name="org/hsqldb/server/HsqlSocketFactorySecure.java" unless="ant.java.hasjsse"/>
325         <exclude name="org/hsqldb/jdbc/JDBCArray.java"/>
326         <exclude name="org/hsqldb/jdbc/JDBCBlob.java"/>
327         <exclude name="org/hsqldb/jdbc/JDBCClob.java"/>
328         <exclude name="org/hsqldb/jdbc/JDBCDataSource*.java"/>
329         <exclude name="org/hsqldb/jdbc/JDBCParameterMetaData.java"/>
330         <exclude name="org/hsqldb/jdbc/JDBCSavepoint.java"/>
331<!-- BEGIN JDBC 4-->
332         <exclude name="org/hsqldb/jdbc/JDBCNClob.java"/>
333         <exclude name="org/hsqldb/jdbc/JDBCRowId.java"/>
334         <exclude name="org/hsqldb/jdbc/JDBCSQLXML.java"/>
335         <exclude name="org/hsqldb/jdbc/JDBCPool.java"/>
336<!-- TODO
337         <exclude name="org/hsqldb/jdbc/jdbcConflictingRowImpl.java"/>
338         <exclude name="org/hsqldb/jdbc/jdbcDataSetImpl.java"/>
339         <exclude name="org/hsqldb/jdbc/jdbcDataSetResolverImpl.java"/>
340         <exclude name="org/hsqldb/jdbc/jdbcQueryObjectGeneratorImpl.java"/>
341         <exclude name="org/hsqldb/jdbc/jdbcRowSet.java"/>
342-->
343<!-- end JDBC 4 -->
344         <exclude name="org/hsqldb/persist/RAFileNIO.java"/>
345         <exclude name="org/hsqldb/rights/Grantee.java"/>
346      </javac>
347      <fixcrlf destdir="classes" preservelastmodified='true' eol="lf"
348               encoding="ISO-8859-1" srcdir="src"
349               includes="**/*.properties, **/*.text, **/*.sql, **/*.html"/>
350    </target>
351
352   <target name="classes12" depends="classes" if="ant.java.iscjavamodern"
353           description="compiles 1.2 specific classes">
354      <javac srcdir="${swsrc}"
355             includeantruntime="false"
356             encoding="${javac.encoding}"
357             destdir="classes"
358             debug="${build.debug}"
359             optimize="${build.optimize}"
360       >
361         <include name="org/hsqldb/jdbc/JDBCArray.java"/>
362         <include name="org/hsqldb/jdbc/JDBCBlob.java"/>
363         <include name="org/hsqldb/jdbc/JDBCClob.java"/>
364      </javac>
365   </target>
366
367   <target name="classes14" depends="classes12" if="ant.java.iscjava14"
368           description="compiles 1.4 specific classes">
369      <javac srcdir="${swsrc}" destdir="classes" debug="${build.debug}"
370             includeantruntime="false"
371             encoding="${javac.encoding}" optimize="${build.optimize}" >
372        <include name="org/hsqldb/jdbc/pool/*.java"/>
373        <include name="org/hsqldb/jdbc/JDBCCommonDataSource.java"/>
374        <include name="org/hsqldb/jdbc/JDBCDataSource*.java"/>
375        <include name="org/hsqldb/jdbc/JDBCParameterMetaData.java"/>
376        <include name="org/hsqldb/jdbc/JDBCSavepoint.java"/>
377        <include name="org/hsqldb/persist/RAFileNIO.java"/>
378      </javac>
379   </target>
380
381   <target name="classes15" depends="classes14" if="ant.java.iscjava15"
382           description="compiles 1.5 specific classes">
383      <javac srcdir="${swsrc}" destdir="classes" debug="${build.debug}"
384             includeantruntime="false"
385             encoding="${javac.encoding}" optimize="${build.optimize}" >
386        <include name="org/hsqldb/lib/AppendableException.java"/>
387        <include name="org/hsqldb/lib/RefCapablePropertyResourceBundle.java"/>
388        <include name="org/hsqldb/lib/RefCapableRBInterface.java"/>
389        <include name="org/hsqldb/lib/ValidatingResourceBundle.java"/>
390        <include name="org/hsqldb/lib/tar/**"/>
391      </javac>
392   </target>
393
394   <target name="classes16" depends="classes15" if="ant.java.iscjava16"
395           description="compiles 1.6 specific classes">
396      <javac srcdir="${swsrc}" destdir="classes" debug="${build.debug}"
397             includeantruntime="false"
398             encoding="${javac.encoding}" optimize="${build.optimize}" >
399         <include name="org/hsqldb/jdbc/JDBCNClob.java"/>
400         <include name="org/hsqldb/jdbc/JDBCRowId.java"/>
401         <include name="org/hsqldb/jdbc/JDBCSQLXML.java"/>
402         <include name="org/hsqldb/jdbc/JDBCPool.java"/>
403<!-- TODO
404         <include name="org/hsqldb/jdbc/jdbcConflictingRowImpl.java"/>
405         <include name="org/hsqldb/jdbc/jdbcDataSetImpl.java"/>
406         <include name="org/hsqldb/jdbc/jdbcDataSetResolverImpl.java"/>
407         <include name="org/hsqldb/jdbc/jdbcQueryObjectGeneratorImpl.java"/>
408         <include name="org/hsqldb/jdbc/jdbcRowSet.java"/>
409-->
410      </javac>
411   </target>
412
413   <!-- Don't both use name beginning with - AND supply a 'description'.
414        If this should be externally callable, then remove the leading -
415        and change the following description to a description attribute:
416                                               - blaine
417
418        compiles 1.4-specific test classes
419   -->
420    <target name="-test14" if="ant.java.iscjava14" depends='switches'>
421      <antcall target='-requireJunit'/>
422      <!-- using antcall instead of depends so that it is not called if the
423           target "if" above is false. -->
424      <javac srcdir="${swsrc}"
425             includeantruntime="false"
426             encoding="${javac.encoding}"
427             destdir="classes"
428             debug="${build.debug}"
429             optimize="${build.optimize}"
430             classpath="${junit38.lib}"
431       >
432          <include name="org/hsqldb/test/TestJDBCSavepoints.java"/>
433      </javac>
434   </target>
435
436    <target name="util" depends="lib, -cmdline, -auth"
437            description="compiles the util, cmdline, and auth folders">
438      <javac srcdir="${swsrc}"
439             includeantruntime="false"
440             encoding="${javac.encoding}"
441             destdir="classes"
442             debug="${build.debug}"
443             optimize="${build.optimize}"
444      >
445         <include name="org/hsqldb/util/**"/>
446         <exclude name="org/hsqldb/util/*Swing.java"/>
447         <exclude name="org/hsqldb/util/preprocessor/**"/>
448         <exclude name="org/hsqldb/util/TableSorter.java"/>
449      </javac>
450      <copy todir="classes/org/hsqldb/util" preservelastmodified='true'>
451          <fileset dir="src/org/hsqldb/util" includes='*.gif, *.png'/>
452      </copy>
453    </target>
454
455    <target name="-preprocessor">
456      <!-- This javac is dependent upon default attr. includeAntRuntime=true -->
457      <javac srcdir="src"
458             encoding="${javac.encoding}"
459             destdir="classes"
460             debug="${build.debug}"
461             optimize="${build.optimize}"
462      >
463         <include name="org/hsqldb/util/preprocessor/**"/>
464      </javac>
465    </target>
466
467    <!-- compiles the cmdline classes -->
468    <target name="-cmdline" if="ant.java.iscjava15"
469            depends="-prepare, -update-switch-branch,
470                     -conditionalize-sqlfile-scanner, -sqlfile-scanner">
471      <javac srcdir="${swsrc}"
472             includeantruntime="false"
473             encoding="${javac.encoding}"
474             destdir="classes"
475             debug="${build.debug}"
476             optimize="${build.optimize}"
477      >
478         <include name="org/hsqldb/cmdline/**"/>
479      </javac>
480    </target>
481
482    <!-- compiles the auth classes -->
483    <target name="-auth" if="ant.java.iscjava15"
484            depends="lib, classes">
485      <javac srcdir="${swsrc}"
486             includeantruntime="false"
487             encoding="${javac.encoding}"
488             destdir="classes"
489             debug="${build.debug}"
490             optimize="${build.optimize}"
491      >
492         <include name="org/hsqldb/auth/**"/>
493      </javac>
494    </target>
495
496
497   <target name="swing" depends="util" unless="noswing"
498           description="compiles the swing based classes in the util folder">
499      <javac srcdir="${swsrc}"
500             includeantruntime="false"
501             encoding="${javac.encoding}"
502             destdir="classes"
503             debug="${build.debug}"
504             optimize="${build.optimize}"
505       >
506      <include name="org/hsqldb/util/*Swing.java"/>
507      <include name="org/hsqldb/util/TableSorter.java"/>
508      </javac>
509   </target>
510
511   <target name='-requireJunit'>
512      <available property='_junit_available' classpath='${junit38.lib}'
513                 classname='junit.swingui.TestRunner'/>
514      <fail unless='_junit_available'
515            message="Place Jar file for v. 3.8.x of Junit at '${junit38.lib}', or set property 'junit38.lib'"/>
516   </target>
517
518   <target name="scanner-driver" depends="util"
519       description="Build Scanner Driver.  For SqlTool scanner developers.">
520      <javac srcdir="${swsrc}"
521             includeantruntime="false"
522             encoding="${javac.encoding}"
523             includes="org/hsqldb/test/SqlFileScannerDriver.java"
524             destdir="classes"
525             debug="${build.debug}"
526             optimize="${build.optimize}"
527             />
528   </target>
529
530   <target name="test" depends="-requireJunit, classes16"
531           description="compiles the test package classes">
532         <javac srcdir="${swsrc}"
533                includeantruntime="false"
534                encoding="${javac.encoding}"
535                destdir="classes"
536                debug="${build.debug}"
537                optimize="${build.optimize}"
538         >
539         <classpath>
540            <pathelement location="${junit38.lib}"/>
541            <pathelement location="lib/dbunit.jar"/>
542         </classpath>
543         <include name="org/hsqldb/test/**"/>
544         <exclude name="org/hsqldb/test/TestJDBCSavepoints.java"/>
545         <exclude name="org/hsqldb/test/SqlFileScannerDriver.java"/>
546      </javac>
547      <antcall target='-test14'/>
548   </target>
549
550    <!--jar with (jdkversion-switched) sources, useful for reading/debugging the code from other projects, can be specified via maven too-->
551    <target name="hsqldbsources" description="builds jar file containing source code"
552            depends="switchtojdk14,
553                     switchtojdk15,
554                     switchtojdk16,
555                     switchtojdk17">
556        <jar jarfile="lib/hsqldb-sources.jar"
557             basedir="tmp/switchedsrc">
558        </jar>
559    </target>
560
561    <target name="hsqldbtest" depends="test,swing, -prep-license-files"
562            description="Build the hsqldbtest.jar (default plus test classes)">
563        <jar jarfile="lib/hsqldbtest.jar"
564             basedir="classes"
565         >
566         <metainf dir="doc" includes="*_lic.txt"/>
567         <service type="java.sql.Driver" provider="org.hsqldb.jdbc.JDBCDriver"/>
568         <manifest>
569             <attribute name='Specification-Title' value='${hsqldb.title}'/>
570             <attribute name='Specification-Version' value='${hsqldb.version}'/>
571             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
572             <attribute name='Implementation-Title' value='Test runtime'/>
573             <attribute name='Implementation-Version' value='${build.label}'/>
574             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
575         </manifest>
576         <exclude name="org/hsqldb/jmx/**"/>
577         <exclude name="org/hsqldb/sample/*"/>
578      </jar>
579    </target>
580
581    <target name="hsqldbserver" depends="classes16, -auth, -prep-license-files"
582            description="Build the hsqldserver.jar (no engin)">
583        <jar jarfile="lib/hsqldbserver.jar"
584             basedir="classes"
585         >
586         <metainf dir="doc" includes="*_lic.txt"/>
587         <service type="java.sql.Driver" provider="org.hsqldb.jdbc.JDBCDriver"/>
588         <manifest>
589             <attribute name='Implementation-Title' value='Server'/>
590             <attribute name='Specification-Version' value='${hsqldb.version}'/>
591             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
592             <attribute name='Implementation-Version' value='${build.label}'/>
593             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
594             <attribute name='Main-Class' value='org.hsqldb.server.Server'/>
595         </manifest>
596         <include name="org/hsqldb/server/**"/>
597         <exclude name="org/hsqldb/server/Servlet*"/>
598         <exclude name="org/hsqldb/server/WebServer*"/>
599      </jar>
600    </target>
601
602    <!--
603            Sat Nov 19 17:52:33 EST 2005  Blaine changing this description,
604            because I see no Swing classes in hsqldbmain.jar when I build
605            it... why would anybody ever want them in a no-util jar anyways?
606
607            description="Build the hsqldbmain.jar (no utilities) (use ant switch '-Dnoswing=true' to exclude swing classes)">
608    -->
609    <target name="hsqldbmain" depends="classes16, -auth, -prep-license-files"
610            description="Build the hsqldbmain.jar (no utilities)">
611        <jar jarfile="lib/hsqldbmain.jar"
612             basedir="classes"
613         >
614         <metainf dir="doc" includes="*_lic.txt"/>
615         <service type="java.sql.Driver" provider="org.hsqldb.jdbc.JDBCDriver"/>
616         <manifest>
617             <attribute name='Specification-Title' value='${hsqldb.title}'/>
618             <attribute name='Specification-Version' value='${hsqldb.version}'/>
619             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
620             <attribute name='Implementation-Title'
621                        value='Runtime without utilities'/>
622             <attribute name='Implementation-Version' value='${build.label}'/>
623             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
624         </manifest>
625         <exclude name="org/hsqldb/jmx/**"/>
626         <exclude name="org/hsqldb/util/**"/>
627         <exclude name="org/hsqldb/cmdline/**"/>
628         <exclude name="org/hsqldb/test/**"/>
629         <exclude name="org/hsqldb/sample/**"/>
630      </jar>
631    </target>
632
633    <target name="hsqldbmin" depends="classes16, -auth, -prep-license-files"
634            description="Build the hsqldbmin.jar (no servers)">
635        <jar jarfile="lib/hsqldbmin.jar"
636             basedir="classes"
637         >
638         <metainf dir="doc" includes="*_lic.txt"/>
639         <service type="java.sql.Driver" provider="org.hsqldb.jdbc.JDBCDriver"/>
640         <manifest>
641             <attribute name='Specification-Title' value='${hsqldb.title}'/>
642             <attribute name='Specification-Version' value='${hsqldb.version}'/>
643             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
644             <attribute name='Implementation-Title'
645                 value='Runtime without utilities and servers'/>
646             <attribute name='Implementation-Version' value='${build.label}'/>
647             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
648         </manifest>
649         <!-- Without this, some ANT/Java combinations may get confused and
650              include nothing in the jar -->
651         <include name="**/*"/>
652         <!-- -->
653         <exclude name="org/hsqldb/jmx/**"/>
654         <exclude name="org/hsqldb/util/**"/>
655         <exclude name="org/hsqldb/cmdline/**"/>
656         <exclude name="org/hsqldb/test/**"/>
657         <exclude name="org/hsqldb/sample/**"/>
658         <exclude name="org/hsqldb/resources/org_hsqldb_Server_messages.properties"/>
659         <exclude name="org/hsqldb/resources/webserver.properties"/>
660         <exclude name="hsqlServlet.class"/>
661         <exclude name="org/hsqldb/Servlet.class"/>
662         <exclude name="org/hsqldb/Server.class"/>
663         <exclude name="org/hsqldb/server/HsqlSocketFactory.class"/>
664         <exclude name="org/hsqldb/server/HsqlSocketFactorySecure.class"/>
665         <exclude name="org/hsqldb/srever/HsqlServerFactory.class"/>
666         <exclude name="org/hsqldb/srever/HsqlServerProperties.class"/>
667         <exclude name="org/hsqldb/server/HsqlSocketRequestHandler.class"/>
668         <exclude name="org/hsqldb/server/HsqlSocketRequestHandlerImpl.class"/>
669         <exclude name="org/hsqldb/server/Server.class"/>
670         <exclude name="org/hsqldb/server/Server$ServerThread.class"/>
671         <exclude name="org/hsqldb/server/ServerConnection.class"/>
672         <exclude name="org/hsqldb/server/ServerConfiguration.class"/>
673         <exclude name="org/hsqldb/server/WebServer.class"/>
674         <exclude name="org/hsqldb/server/WebServerConnection.class"/>
675         <exclude name="org/hsqldb/rowio/RowInputLegacy.class"/>
676         <exclude name="org/hsqldb/rowio/RowOutputLegacy.class"/>
677         <!-- Exclude command-line classes -->
678         <exclude name="org/hsqldb/auth/LdapAuthBeanTester.class"/>
679         <exclude name="org/hsqldb/lib/tar/DbBackupMain.class"/>
680         <exclude name="org/hsqldb/lib/tar/TarGeneratorMain.class"/>
681         <exclude name="org/hsqldb/lib/tar/TarReaderMain.class"/>
682       </jar>
683    </target>
684
685    <target name="hsqldb" depends="classes16, util, swing, -prep-license-files"
686            description="Build the default hsqldb.jar">
687        <jar jarfile="lib/hsqldb.jar"
688             basedir="classes"
689             compress="true"
690         >
691         <metainf dir="doc" includes="*_lic.txt"/>
692         <service type="java.sql.Driver" provider="org.hsqldb.jdbc.JDBCDriver"/>
693         <manifest>
694             <attribute name='Specification-Title' value='${hsqldb.title}'/>
695             <attribute name='Specification-Version' value='${hsqldb.version}'/>
696             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
697             <attribute name='Implementation-Title'
698                        value='Standard runtime'/>
699             <attribute name='Implementation-Version' value='${build.label}'/>
700             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
701             <!-- This attribute is completely ignored unless the user
702                  uses the jar like "java -jar .../hsqldb.jar" -->
703             <attribute name='Main-Class' value='org.hsqldb.util.DatabaseManagerSwing'/>
704         </manifest>
705         <exclude name="org/hsqldb/jmx/**"/>
706         <exclude name="org/hsqldb/util/*Swing.*" if="noswing"/>
707         <exclude name="org/hsqldb/util/*Transfer*"/>
708         <exclude name="org/hsqldb/util/DataAccess*"/>
709         <exclude name="org/hsqldb/util/*Helper*"/>
710         <exclude name="org/hsqldb/util/JDBCTypes.*"/>
711         <exclude name="org/hsqldb/util/SQLStatements.*"/>
712         <exclude name="org/hsqldb/util/QueryTool.*"/>
713         <exclude name="org/hsqldb/util/Zaurus*"/>
714         <exclude name="org/hsqldb/test/*.class"/>
715         <exclude name="org/hsqldb/sample/*.class"/>
716         <exclude name="org/hsqldb/cmdline/**"/>
717      </jar>
718    </target>
719
720    <fileset id='jdbcclasses' dir='classes'
721        includes='
722                  org/hsqldb/error/*,
723                  org/hsqldb/navigator/*,
724                  org/hsqldb/result/*,
725                  org/hsqldb/lib/ArrayUtil*,
726                  org/hsqldb/lib/CountdownInputStream*,
727                  org/hsqldb/lib/HsqlByte*,
728                  org/hsqldb/lib/IntValueHashMap*,
729                  org/hsqldb/lib/InOutUtil*,
730                  org/hsqldb/lib/Iterator*,
731                  org/hsqldb/lib/HsqlHeap*,
732                  org/hsqldb/lib/HsqlArray*,
733                  org/hsqldb/lib/ObjectComparator*,
734                  org/hsqldb/lib/IntKeyHashMap*,
735                  org/hsqldb/lib/Collection*,
736                  org/hsqldb/lib/*List*,
737                  org/hsqldb/lib/Set*,
738                  org/hsqldb/lib/Hash*,
739                  org/hsqldb/lib/HsqlTimer*,
740                  org/hsqldb/lib/StringConverter*,
741                  org/hsqldb/lib/StringInputStream*,
742                  org/hsqldb/lib/java/JavaSystem*,
743                  org/hsqldb/lib/FileAccess*,
744                  org/hsqldb/ClientConnection*,
745                  org/hsqldb/SchemaObject*,
746                  org/hsqldb/HsqlNameManager*,
747                  org/hsqldb/SqlInvariants*,
748                  org/hsqldb/Constraint*,
749                  org/hsqldb/TableBase*,
750                  org/hsqldb/Table.*,
751                  org/hsqldb/lib/IntKeyIntValueHashMap*,
752                  org/hsqldb/lib/DataOutputStream*,
753                  org/hsqldb/lib/ReaderInputStream*,
754                  org/hsqldb/Scanner*,
755                  org/hsqldb/lib/StringUtil*,
756                  org/hsqldb/lib/OrderedIntHashSet*,
757                  org/hsqldb/Token*,
758                  org/hsqldb/lib/CharArrayWriter*,
759                  org/hsqldb/resources/sql-state-messages.properties,
760                  org/hsqldb/jdbc/JDBC*,
761                  org/hsqldb/jdbc/pool/*,
762                  org/hsqldb/rights/Grantee.class,
763                  org/hsqldb/rowio/RowOutputBase*,
764                  org/hsqldb/rowio/RowInputBase*,
765                  org/hsqldb/rowio/RowOutputBinary*,
766                  org/hsqldb/rowio/RowInputBinary*,
767                  org/hsqldb/rowio/RowOutputInterface*,
768                  org/hsqldb/rowio/RowInputInterface*,
769                  org/hsqldb/persist/HsqlDatabaseProperties*,
770                  org/hsqldb/persist/HsqlProperties*,
771                  org/hsqldb/map/ValuePool*,
772                  org/hsqldb/map/HashIndex*,
773                  org/hsqldb/map/BaseHashMap*,
774                  org/hsqldb/map/BitMap*,
775                  org/hsqldb/types/*,
776                  org/hsqldb/Column*,
777                  org/hsqldb/DatabaseURL*,
778                  org/hsqldb/HSQLClient*,
779                  org/hsqldb/HsqlDateTime*,
780                  org/hsqldb/HsqlException*,
781                  org/hsqldb/server/HsqlSocketFactory*,
782                  org/hsqldb/HTTPClientConnection*,
783                  org/hsqldb/jdbcDriver*,
784                  org/hsqldb/Row*,
785                  org/hsqldb/SessionInterface*,
786                  org/hsqldb/types/Types*,
787                  org/hsqldb/resources/BundleHandler*,
788                  org/hsqldb/resources/sql-state-messages*
789                  '/>
790
791    <fileset id='utilclasses' dir='classes' includes='
792         org/hsqldb/util/**
793         org/hsqldb/lib/*Log*
794      '/>
795
796    <fileset id='sqltoolclasses' dir='classes'
797      includes='org/hsqldb/cmdline/**/*.class
798                  org/hsqldb/lib/RCData*
799                  org/hsqldb/lib/RefCapablePropertyResourceBundle*
800                  org/hsqldb/lib/RefCapableRBInterface*
801                  org/hsqldb/lib/ValidatingResourceBundle*
802                  org/hsqldb/lib/AppendableException*
803                  org/hsqldb/lib/FileAccess*
804                  org/hsqldb/lib/StringUtil*
805                  org/hsqldb/lib/BasicTextJdkLogFormatter*
806                  org/hsqldb/lib/FrameworkLogger*
807                  org/hsqldb/resources/jdklogging-default.properties
808                  '/>
809    <fileset id='sqltoolres' dir='classes'
810        includes='org/hsqldb/cmdline/**/*.text
811                  org/hsqldb/cmdline/**/*.properties
812                  org/hsqldb/cmdline/sqltool/**/*.html
813                  '/>
814
815    <target name="sqltool" depends="classes15, -cmdline, -prep-license-files"
816            description="Build 'sqltool.jar' file">
817      <fail unless="ant.java.iscjava15"
818            message="Can't build sqltool with JVM less than v. 1.5"/>
819       <jar jarfile="lib/sqltool.jar" compress="true" filesonly="true">
820         <metainf dir="doc" includes="*_lic.txt"/>
821         <manifest>
822             <attribute name='Specification-Title' value='${hsqldb.title}'/>
823             <attribute name='Specification-Version' value='${hsqldb.version}'/>
824             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
825             <attribute name='Implementation-Title' value='SqlTool Client'/>
826             <attribute name='Implementation-Version' value='${build.label}'/>
827             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
828             <attribute name='Main-Class' value='org.hsqldb.cmdline.SqlTool'/>
829             <attribute name='Class-Path'
830               value='hsqldb-${hsqldb.version}.jar hsqljdbc-${hsqldb.version}.jar hsqldbmain.jar-${hsqldb.version}.jar hsqldb.jar hsqljdbc.jar hsqldbmain.jar'/>
831         </manifest>
832         <fileset refid='sqltoolclasses'/>
833         <fileset refid='sqltoolres'/>
834       </jar>
835    </target>
836
837        <fileset id='preprocessorclasses' dir='classes' includes='org/hsqldb/util/preprocessor/*.class'/>
838
839    <target name="preprocessor" depends="-prepare,-prep-license-files,-preprocessor"
840            description="Build 'preprocessor.jar' file">
841       <jar jarfile="lib/preprocessor.jar" compress="true" filesonly="true">
842         <metainf dir="doc" includes="*_lic.txt"/>
843         <manifest>
844             <attribute name='Specification-Title' value='${hsqldb.title}'/>
845             <attribute name='Specification-Version' value='${hsqldb.version}'/>
846             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
847             <attribute name='Implementation-Title' value='HSQLDB Java Source Preprocessor Library'/>
848             <attribute name='Implementation-Version' value='${build.label}'/>
849             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
850         </manifest>
851         <fileset refid='preprocessorclasses' />
852       </jar>
853    </target>
854
855<!-- classes referenced by the org.hsqldb.jdbc package classes -->
856<!-- or the org.hsqldb.jdbcDriver class are included here with some -->
857<!-- ommissions where the calling methods are not actually used -->
858    <target name="hsqljdbc" depends="classes16, -prep-license-files"
859             description="Build the hsqljdbc.jar for network clients">
860        <jar jarfile="lib/hsqljdbc.jar" compress="true">
861         <service type="java.sql.Driver" provider="org.hsqldb.jdbc.JDBCDriver"/>
862         <metainf dir="doc" includes="*_lic.txt"/>
863         <manifest>
864             <attribute name='Specification-Title' value='${hsqldb.title}'/>
865             <attribute name='Specification-Version' value='${hsqldb.version}'/>
866             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
867             <attribute name='Implementation-Title'
868                        value='JDBC client runtime'/>
869             <attribute name='Implementation-Version' value='${build.label}'/>
870             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
871         </manifest>
872          <fileset refid='jdbcclasses'/>
873        </jar>
874    </target>
875
876    <target name="hsqldbutil" depends="util, swing, -prep-license-files"
877            description="Build the utility hsqldbutil.jar">
878        <jar jarfile="lib/hsqldbutil.jar" compress="true">
879         <metainf dir="doc" includes="*_lic.txt"/>
880         <manifest>
881             <attribute name='Specification-Title' value='${hsqldb.title}'/>
882             <attribute name='Specification-Version' value='${hsqldb.version}'/>
883             <attribute name='Specification-Vendor' value='${hsqldb.vendor}'/>
884             <attribute name='Implementation-Title'
885                        value='Utilities runtime, without JDBC driver'/>
886             <attribute name='Implementation-Version' value='${build.label}'/>
887             <attribute name='Implementation-Vendor' value='${build.vendor}'/>
888             <attribute name='Main-Class' value='org.hsqldb.cmdline.SqlTool'/>
889             <attribute name='Class-Path'
890                        value='hsqldb-2.0.0.jar hsqldbmain.jar hsqldb.jar'/>
891         </manifest>
892         <fileset refid='utilclasses'/>
893         <fileset refid='sqltoolclasses'/>
894         <fileset refid='sqltoolres'/>
895      </jar>
896    </target>
897
898    <target name="-doclink-17"
899                depends="-set-jvmvars"
900                if="ant.java.iscjava17">
901        <!-- The depends above is a Gradle work-around.
902             It is not necessary for Ant.  -->
903        <property name="jse.doc.link"
904                  value="http://docs.oracle.com/javase/7/docs/api/"/>
905        <property name="jee.doc.link"
906                  value="http://docs.oracle.com/javaee/6/api/"/>
907    </target>
908
909    <target name="-doclink-16"
910                depends="-doclink-17"
911                    if="ant.java.iscjava16"
912            unless="ant.java.iscjava17">
913        <property name="jse.doc.link"
914                  value="http://docs.oracle.com/javase/6/docs/api/"/>
915        <property name="jee.doc.link"
916                  value="http://docs.oracle.com/javaee/6/api/"/>
917    </target>
918
919    <target name="-doclink-15"
920                    depends="-doclink-16"
921                    if="ant.java.iscjava15"
922            unless="ant.java.iscjava16">
923        <property name="jse.doc.link"
924                  value="http://docs.oracle.com/javase/1.5.0/docs/api/"/>
925        <property name="jee.doc.link"
926                  value="http://docs.oracle.com/javaee/5/api/"/>
927    </target>
928
929    <target name="-doclink-14"
930            depends="-doclink-15"
931            if="ant.java.iscjava14"
932            unless="ant.java.iscjava15">
933        <property name="jse.doc.link"
934                  value="http://docs.oracle.com/javase/1.4.2/docs/api/"/>
935        <property name="jee.doc.link"
936                  value="http://docs.oracle.com/javaee/1.4/api/"/>
937    </target>
938
939    <target name="-doclink-12"
940            depends="-doclink-14"
941            if="ant.java.iscjava12"
942            unless="ant.java.iscjava14">
943        <property name="jse.doc.link"
944                  value="http://docs.oracle.com/javase/1.3/docs/api/"/>
945        <property name="jee.doc.link"
946                  value="http://docs.oracle.com/javaee/1.3/api/"/>
947    </target>
948
949    <target name="javadoc" depends="-prepare-javadoc,-set-jvmvars,-doclink-12"
950            description="Create javadoc for the distribution package">
951      <!-- TODO:  Find out why JDBCDriver class is listed twice in the lass
952           list pane, but only when All Classes selected
953           only listed once if jdbc package is selected). -->
954      <javadoc
955           sourcefiles="src/org/hsqldb/jdbc/JDBCDriver.java,
956                        src/org/hsqldb/Trigger.java,
957                        src/org/hsqldb/server/Server.java,
958                        src/org/hsqldb/server/WebServer.java,
959                        src/org/hsqldb/server/ServerAcl.java,
960                        src/org/hsqldb/sample/TriggerSample.java,
961                        src/org/hsqldb/sample/SqlFileEmbedder.java,
962                        src/org/hsqldb/lib/FrameworkLogger.java,
963                        src/org/hsqldb/lib/RCData.java,
964                        src/org/hsqldb/lib/tar/DbBackup.java,
965                        src/org/hsqldb/lib/tar/DbBackupMain.java,
966                        src/org/hsqldb/test/TestScriptRunner.java,
967                        src/org/hsqldb/cmdline/SqlFile.java,
968                        src/org/hsqldb/util/MainInvoker.java,
969                        src/org/hsqldb/cmdline/SqlTool.java,
970                        src/org/hsqldb/auth/AuthBeanMultiplexer.java,
971                        src/org/hsqldb/auth/AuthFunctionBean.java,
972                        src/org/hsqldb/auth/JaasAuthBean.java,
973                        src/org/hsqldb/auth/HsqldbSlaveAuthBean.java,
974                        src/org/hsqldb/auth/LdapAuthBean.java,
975                        src/org/hsqldb/auth/LdapAuthBeanTester.java"
976           destdir="doc/apidocs"
977           stylesheetfile="doc-src/apidocs/javadoc.css"
978           docencoding="UTF-8"
979           charset="UTF-8"
980           author="true"
981           version="false"
982           use="true"
983           public="true"
984           failonerror="true"
985           windowtitle="${hsqldb.title} ${hsqldb.version} API"
986           doctitle="${hsqldb.title} ${hsqldb.version}"
987           bottom="&lt;i&gt;Copyright &#169; 2001 - 2013 HSQL Development Group.&lt;/i&gt;">
988           <classpath>
989             <pathelement location="${servletapi.lib}"/>
990             <pathelement location="${junit38.lib}"/>
991           </classpath>
992           <packageset dir='src'>
993               <include name='org/hsqldb/jdbc'/>
994           </packageset>
995           <link href="${jse.doc.link}"/>
996           <link href="${jee.doc.link}"/>
997           <tag name="todo" enabled="false"/>
998           <tag name="revised" enabled="false"/>
999           <tag name="jboss.xmbean" enabled="false"/>
1000           <tag name="jmx.mbean" enabled="false"/>
1001           <tag name="jmx.managed-attribute" enabled="false"/>
1002           <tag name="jmx.managed-operation" enabled="false"/>
1003           <tag name="jmx.managed-operation-parameter" enabled="false"/>
1004     </javadoc>
1005     <fixcrlf preservelastmodified='true' eol="lf" encoding="UTF-8"
1006         srcdir="doc/apidocs" includes="**/*.css, **/*.html, **/package-list"/>
1007   </target>
1008
1009   <target name="javadocdev"
1010            depends="-prepare-javadoc,-set-jvmvars,-doclink-12"
1011            description="Create javadoc for all HSQLDB code-base classes">
1012      <!-- Since our preprocessor package compilatoin depends on the
1013           env-specific ant runtime lib via includeAntRuntime=true, Javadoc
1014           will fail to resolve Ant classes and produce error messages
1015           accordingly. -->
1016      <javadoc
1017           destdir="doc/apidocs"
1018           docencoding="UTF-8"
1019           stylesheetfile="doc-src/apidocs/javadoc.css"
1020           charset="UTF-8"
1021           linksource="true"
1022           author="true"
1023           version="true"
1024           use="true"
1025           package="true"
1026           failonerror="true"
1027           windowtitle="${hsqldb.title} ${hsqldb.version} Product Dev. API"
1028           doctitle="${hsqldb.title} ${hsqldb.version} Product"
1029           bottom="&lt;i&gt;Copyright &#169; 2001 - 2013 HSQL Development Group.&lt;/i&gt;">
1030           <fileset dir="src" includes="**/*.java"/>
1031           <!-- Fileset is really good for maintenance and control purposes,
1032                but it makes the generator produce an incredible amount of
1033                output when there are no errors.  The verbose attribute
1034                doesn't help at all. -->
1035           <classpath>
1036             <pathelement path="${java.class.path}"/>
1037             <pathelement location="${junit38.lib}"/>
1038             <pathelement location="${servletapi.lib}"/>
1039           </classpath>
1040           <link href="${jse.doc.link}"/>
1041           <link href="${jee.doc.link}"/>
1042           <link href="${junit.doc.link}"/>
1043           <tag name="todo"/>
1044           <tag name="revised"/>
1045           <tag name="jboss.xmbean"/>
1046           <tag name="jmx.mbean"/>
1047           <tag name="jmx.managed-attribute"/>
1048           <tag name="jmx.managed-operation"/>
1049           <tag name="jmx.managed-operation-parameter"/>
1050     </javadoc>
1051     <fixcrlf preservelastmodified='true' eol="lf" encoding="UTF-8"
1052         srcdir="doc/apidocs" includes="**/*.css, **/*.html, **/package-list"/>
1053   </target>
1054
1055    <target name="sqlfile-scanner"
1056            depends="-delete.SqlFileScanner, -sqlfile-scanner"
1057    description="Unconditionally run JFlex to regenerate SqlFileScanner.java"/>
1058
1059    <target name="-delete.SqlFileScanner">
1060      <delete file="src/org/hsqldb/cmdline/sqltool/SqlFileScanner.java"/>
1061    </target>
1062
1063     <!-- If you don't want this to run unless ant.java.iscjava15 is set,
1064          then call -conditionalize-sqlfile-scanner before this target. -->
1065    <target name="-sqlfile-scanner" depends="-conditionalize-jflex, jflex"
1066            unless="-sqlfile-scanner.skip">
1067      <!-- Prepares SqlFileScanner.java, running Jflex only if needed.
1068           Purpose here is to require jflex library only if user modifies
1069           the *.flex file.
1070      -->
1071
1072      <!-- We no longer remove SqlFileScanner.java automatically.
1073           We can't depend on file timestamps, because Subversion doesn't
1074           preserve them, so we must depend on the user to manually remove
1075           SqlFileScanner.java if they want it regenerated.
1076      <dependset>
1077        <srcfilelist dir="src/org/hsqldb/cmdline">
1078          <file name="sqltool.flex"/>
1079        </srcfilelist>
1080        <targetfilelist dir="src/org/hsqldb/cmdline/sqltool">
1081          <file name="SqlFileScanner.java"/>
1082        </targetfilelist>
1083      </dependset>
1084      -->
1085      <copy todir="${swsrc}/org/hsqldb/cmdline/sqltool"
1086            file="src/org/hsqldb/cmdline/sqltool/SqlFileScanner.java"/>
1087    </target>
1088
1089    <target name="-init-jflex" unless="jflex.skip">
1090      <available property='_jflex_available' classpath='${jflex.lib}'
1091                 classname='JFlex.anttask.JFlexTask'/>
1092      <fail unless='_jflex_available'
1093            message="Run target 'fetch-jflex' or otherwise place a JFlex jar file at '${jflex.lib}'"/>
1094      <taskdef classname="JFlex.anttask.JFlexTask" name="jflex"
1095               classpath='${jflex.lib}'/>
1096     </target>
1097
1098     <target name="fetch-jflex" depends="-ivy-setup"
1099       description="Fetch JFlex jar file from Internet, for rebuilding SqlTool scanner">
1100       <copy tofile="${jflex.lib}" preservelastmodified="true">
1101         <path refid="jflex-jar.cpref"/>
1102       </copy>
1103     </target>
1104
1105    <target name="-conditionalize-jflex" depends="-set-jvmvars">
1106      <!-- JFlex will only run if SqlFileScanner.java does not exist
1107           and ant.java.iscjava15 -->
1108      <available property="jflex.skip" type="file"
1109                 file="src/org/hsqldb/cmdline/sqltool/SqlFileScanner.java"/>
1110      <condition property="jflex.skip"> <not>
1111        <isset property="ant.java.iscjava15"/>
1112      </not> </condition>
1113    </target>
1114
1115    <target name="-conditionalize-sqlfile-scanner" depends="-set-jvmvars">
1116      <condition property="-sqlfile-scanner.skip"> <not>
1117        <isset property="ant.java.iscjava15"/>
1118      </not> </condition>
1119    </target>
1120
1121    <!-- If called internally, always call the -conditionalize-flex target
1122         before this one, to eliminate unnecessary executions. -->
1123    <target name="jflex" depends="-init-jflex" unless="jflex.skip"
1124            description="Execute JFlex.  For SqlTool scanner developers.">
1125        <jflex file="src/org/hsqldb/cmdline/sqltool.flex" destdir="src"/>
1126        <!-- A limitation of the jflex task is that you must specify the .flex
1127             files individually and explicitly.  No filesets, etc. -->
1128    </target>
1129
1130    <target name="-update-switch-branch" unless="switch.inplace">
1131       <mkdir dir='${swsrc}'/>
1132       <copy todir='${swsrc}' preservelastmodified='true'>
1133           <fileset dir='src' includes='**/*.java'/>
1134       </copy>
1135    </target>
1136
1137    <target name="-clean-switch-branch" unless="switch.inplace">
1138      <available property="_inplace.doublecheck"
1139                 file="${swsrc}/org/hsqldb/cmdline/sqltool.properties"/>
1140      <fail if="_inplace.doublecheck"
1141  message="Aborting to prevent detected attempt to wipe original source code"/>
1142      <delete dir="${swsrc}"/>
1143    </target>
1144
1145    <target name="update-readme"
1146        description="Update the version number in the root readme.txt file">
1147      <!-- Want to have this target depended upon by some other target that
1148           is always run after changing the version yet before tagging a
1149           release.
1150           Unfortunately, there is no such target, since somebody could do all
1151           testing, then change the version number right before tagging. :(
1152           Therefore, instead of automating, we just have the distribution
1153           assembly task fail if the readme.txt is not up to date w/ version.
1154           (Can't actually change readme.txt when assembling, since tagging
1155           must be completed before-hand).
1156      -->
1157      <copy file="doc-src/readme-template.txt" tofile="readme.txt"
1158            overwrite="true">
1159        <filterchain> <expandproperties/> </filterchain>
1160      </copy>
1161    </target>
1162
1163    <!-- ***********************************************************
1164    *************   DOCBOOK v.5 BUILD SYSTEM   *********************
1165    *************************************************************-->
1166  <!-- See the file doc-src/readme-docauthors.txt for details about out DocBook
1167       build system.  -->
1168  <import file="build-docbook.xml"/>
1169
1170  <target name="-prep-images">
1171    <!-- This will only add 'new' files to our "doc-src/images/db" directory.
1172         Therefore, if you want to update file "x.png", then remove it there
1173         before this target runs, and it will be pulled from ${dbimage.path}.
1174         After you have built the docs once, you will need to check your source
1175         for the document source code to see which images HSQLDB
1176         change-controls.  Just see what is in directory "doc-src/images/db",
1177         in Subversion or your distribution zip. -->
1178    <fail unless="dbimage.path">
1179Ant property 'dbimage.path' is required.  This should be set to the "images"
1180subdirectory of a DocBook v.5 NS Style Sheet distribution, on your local
1181filesystem.  If you run the Gradle task 'installDbImages', I'll do that for
1182you, downloading and installing the resources from sourceforge.net if you
1183don't already have them.  You will have the option of installing the entire
1184Style Sheet distribution (instead of just the images) to speed up your future
1185DocBook builds and decrease dependency upon a network and Internet connection.
1186('installDbImages' is only available as a Gradle task, not as an Ant target).
1187
1188See comments at the top of file "${basedir}/build/local-docbook.properties"
1189for instructions on how set up the DocBook images (and other optional
1190optimizations) manually.
1191</fail>
1192   <!-- The touch is to prevent overwriting customized images.
1193        Ant will overwrite if the destination file is older than the source.-->
1194    <touch> <fileset dir="doc-src/images/db" excludes="**/.*/**"/> </touch>
1195    <copy todir="doc-src/images/db">
1196      <fileset dir="${dbimage.path}"/>
1197    </copy>
1198  </target>
1199
1200  <!-- See comments at top of "build-docbook.xml" about doc.target property -->
1201  <target name="gen-docs" description="Generate Docbook documents for project"
1202          depends="validate-docs, -prep-images, -gen-docs-setup">
1203    <!-- These doc-skip properties can be simplified once we require Ant 1.8 -->
1204    <condition property="_genskip-guide" value="DUMMY">
1205      <equals arg1="guide" arg2="${doc.target}"/>
1206    </condition>
1207    <condition property="_genskip-guide" value="-dbtransform-skip">
1208      <isset property="doc.target"/>
1209    </condition>
1210    <property name="_genskip-guide" value="DUMMY"/>
1211    <condition property="_genskip-util-guide" value="DUMMY">
1212      <equals arg1="util-guide" arg2="${doc.target}"/>
1213    </condition>
1214    <condition property="_genskip-util-guide" value="-dbtransform-skip">
1215      <isset property="doc.target"/>
1216    </condition>
1217    <property name="_genskip-util-guide" value="DUMMY"/>
1218
1219    <antcall target="docbook-transform" inheritrefs="true">
1220      <param name="${_genskip-guide}" value="true"/>
1221      <param name="doc.name" value="guide"/>
1222    </antcall>
1223    <antcall target="docbook-transform" inheritrefs="true">
1224      <param name="${_genskip-util-guide}" value="true"/>
1225      <param name="doc.name" value="util-guide"/>
1226    </antcall>
1227    <antcall target="-gen-docs-complete"/>
1228  </target>
1229
1230  <!-- See comments at top of "build-docbook.xml" about doc.target property -->
1231  <target name="validate-docs" depends="-ivy-setup"
1232          description="Validate project DocBook source files">
1233    <!-- The depends above would be redundant, except that Gradle needs
1234         -ivy-setup to execute BEFORE the first antcall executes -->
1235
1236    <!-- These doc-skip properties can be simplified once we require Ant 1.8 -->
1237    <condition property="_valskip-guide" value="DUMMY">
1238      <equals arg1="guide" arg2="${doc.target}"/>
1239    </condition>
1240    <condition property="_valskip-guide" value="validation.skip">
1241      <isset property="doc.target"/>
1242    </condition>
1243    <property name="_valskip-guide" value="DUMMY"/>
1244    <condition property="_valskip-util-guide" value="DUMMY">
1245      <equals arg1="util-guide" arg2="${doc.target}"/>
1246    </condition>
1247    <condition property="_valskip-util-guide" value="validation.skip">
1248      <isset property="doc.target"/>
1249    </condition>
1250    <property name="_valskip-util-guide" value="DUMMY"/>
1251    <antcall target="validate-doc" inheritrefs="true">
1252      <param name="${_valskip-guide}" value="true"/>
1253      <param name="doc.name" value="guide"/>
1254    </antcall>
1255    <antcall target="validate-doc" inheritrefs="true">
1256      <param name="${_valskip-util-guide}" value="true"/>
1257      <param name="doc.name" value="util-guide"/>
1258    </antcall>
1259  </target>
1260
1261  <target name="-validation-setup">
1262    <copy file="build/rng-catalog-template.xml"
1263          tofile="stylesheets/rng-catalog.xml">
1264      <filterset>
1265        <filter token="DBCENTX_URL" value="${dbcentx.url}"/>
1266      </filterset>
1267    </copy>
1268  </target>
1269
1270  <target name="-prep-license-files">
1271    <mkdir dir="doc"/>
1272    <fixcrlf destdir="doc" preservelastmodified='true' eol="crlf"
1273             srcdir="doc-src" includes="*_lic.txt"/>
1274  </target>
1275
1276  <target name="osgi" depends="-ivy-setup, hsqldb"
1277    description="Generates 'hsqldb-osgi.jar' file with OSGI properties in manifest">
1278    <pathconvert property="bndjar.file" refid="bnd-jar.cpref"/>
1279    <!-- Purposefully not using the bndwrap task available for this purpose,
1280         because the docs don't explain how to use the attributes clearly enough
1281         to figure out how to use it. -->
1282    <java failonerror="true" fork="true" dir="lib" classpath="${bndjar.file}"
1283          classname="aQute.bnd.main.bnd">
1284      <sysproperty key="hsqldb.version" value="${hsqldb.version}"/>
1285      <sysproperty key="build.vendor" value="${user.name}"/>
1286      <sysproperty key="build.description" value="${description}"/>
1287      <sysproperty key="hsqldb.title" value="${hsqldb.title}"/>
1288      <arg value="wrap"/>
1289      <arg value="-output"/>
1290      <arg value="hsqldb-osgi.jar"/>
1291      <arg value="-properties"/>
1292      <arg file="build/hsqldb.bnd"/>
1293      <arg value="hsqldb.jar"/>
1294    </java>
1295  </target>
1296</project>
1297