xref: /trunk/main/connectivity/java/dbtools/build.xml (revision 60ba3965)
1<?xml version="1.0" encoding="UTF-8"?>
2<!--***********************************************************
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 *
21 ***********************************************************-->
22
23
24<project name="dbtools" default="main" basedir=".">
25
26    <!-- ================================================================= -->
27    <!-- settings                                                          -->
28    <!-- ================================================================= -->
29
30    <!-- global properties -->
31    <property file="../../../ant.properties"/>
32    <!-- version info -->
33    <property file="../../../solenv/inc/minor.mk"/>
34
35    <!-- name of this sub target used in recursive builds -->
36    <property name="target" value="dbtools"/>
37
38    <!-- name of jar file created, without .jar extension -->
39    <property name="jarname" value="dbtools"/>
40
41    <!-- relative path to project directory -->
42    <property name="prj" value="../.."/>
43
44    <!-- build output directory -->
45    <!-- FIXME: there are also extremely rare/obsolete dbcs/bndchk/truetime/hbtoolkit cases in main/solenv/inc/settings.mk -->
46    <condition property="out" value="${prj}/${OUTPATH}.cap">
47        <isset property="${profile}"/>
48    </condition>
49    <condition property="out" value="${prj}/${OUTPATH}.pro">
50        <isset property="${PRODUCT}"/>
51    </condition>
52    <property name="out" value="${prj}/${OUTPATH}"/>
53
54    <!-- build directories -->
55    <property name="build.dir" value="${out}"/>
56    <property name="build.class" value="${build.dir}/class/${target}"/>
57    <property name="build.misc" value="${build.dir}/misc/${target}"/>
58
59    <!-- start of java source code package structure -->
60    <property name="java.dir" value="src"/>
61
62    <!-- define how to handle CLASSPATH environment -->
63    <property name="build.sysclasspath" value="ignore"/>
64
65    <!-- classpath settings for compile and javadoc tasks -->
66    <condition property="jar-class-path" value="${COMMONS_LANG_JAR}" else="commons-lang3-3.3.jar">
67        <equals arg1="${SYSTEM_APACHE_COMMONS}" arg2="YES"/>
68    </condition>
69    <condition property="commons-lang-jar" value="${COMMONS_LANG_JAR}" else="${OUTDIR}/bin/commons-lang3-3.3.jar">
70        <equals arg1="${SYSTEM_APACHE_COMMONS}" arg2="YES"/>
71    </condition>
72    <path id="classpath">
73        <pathelement location="${OUTDIR}/bin/juh.jar"/>
74        <pathelement location="${OUTDIR}/bin/jurt.jar"/>
75        <pathelement location="${OUTDIR}/bin/ridl.jar"/>
76        <pathelement location="${OUTDIR}/bin/unoil.jar"/>
77        <!-- 3rd party libs -->
78        <pathelement location="${commons-lang-jar}"/>
79    </path>
80
81    <!-- name to display in documentation -->
82    <property name="docname" value="dbtools"/>
83
84    <!-- set "modern" java compiler -->
85    <property name="build.compiler" value="modern"/>
86
87    <!-- set wether we want to compile with debug information -->
88    <property name="debug" value="on"/>
89
90    <!-- set wether we want to compile with optimisation -->
91    <property name="optimize" value="off"/>
92
93    <!-- set wether we want to compile with or without deprecation -->
94    <property name="deprecation" value="on"/>
95
96    <target name="info">
97        <echo message="--------------------"/>
98        <echo message="${target}"/>
99        <echo message="--------------------"/>
100    </target>
101
102    <!-- ================================================================= -->
103    <!-- custom targets                                                    -->
104    <!-- ================================================================= -->
105
106    <!-- the main target, called in recursive builds -->
107    <target name="main" depends="info,prepare,compile,jar,javadoc,zipdoc"/>
108
109    <!-- prepare output directories -->
110    <target name="prepare">
111        <mkdir dir="${build.dir}"/>
112        <mkdir dir="${build.dir}/doc/${target}"/>
113        <mkdir dir="${build.class}"/>
114        <mkdir dir="${build.misc}"/>
115    </target>
116
117
118    <target name="res" depends="prepare">
119        <copy todir="${build.class}">
120             <fileset dir="${java.dir}">
121                 <include name="**/*.properties"/>
122                 <include name="**/*.css"/>
123                 <include name="**/*.dtd"/>
124                 <include name="**/*.form"/>
125                 <include name="**/*.gif "/>
126                 <include name="**/*.htm"/>
127                 <include name="**/*.html"/>
128                 <include name="**/*.js"/>
129                 <include name="**/*.mod"/>
130                 <include name="**/*.sql"/>
131                 <include name="**/*.xml"/>
132                 <include name="**/*.xsl"/>
133                 <include name="**/*.map"/>
134
135             </fileset>
136        </copy>
137    </target>
138
139
140    <target name="compile" depends="prepare,res">
141	<javac destdir="${build.class}"
142	       debug="${debug}"
143               debuglevel="lines,vars,source"
144               deprecation="${deprecation}"
145	       optimize="${optimize}"
146	       classpathref="classpath">
147            <src path="${java.dir}"/>
148	    <include name="**/*.java"/>
149	</javac>
150    </target>
151
152    <!-- check if javadoc is up to date -->
153    <target name="javadoc_check" depends="prepare" if="build.dir">
154	<uptodate property="javadocBuild.notRequired" value="true"
155            targetfile="${build.dir}/doc/${target}/${target}_javadoc.zip">
156		<srcfiles dir="${java.dir}" includes="**/*.java"/>
157	</uptodate>
158    </target>
159
160    <!-- generate java documentation -->
161    <target name="javadoc" depends="prepare,javadoc_check,compile"
162         unless="javadocBuild.notRequired"
163         if="build.dir">
164
165        <javadoc destdir="${build.dir}/doc/${target}/javadoc"
166                 verbose="false"
167                 author="false"
168                 nodeprecated="true"
169                 nodeprecatedlist="true"
170                 use="true"
171                 Doctitle="${docname}"
172                 windowtitle="${docname}"
173                 classpathref="classpath">
174
175            <packageset dir="${java.dir}" defaultexcludes="yes">
176                <include name="com/**"/>
177                <include name="org/**"/>
178            </packageset>
179
180            <link offline="true" href="http://java.sun.com/j2se/1.4.2/docs/api"
181                  packagelistLoc="${common.doc}/jdk1.4.2"/>
182            <link offline="true"
183                  href="http://java.sun.com/products/servlet/2.3/javadoc"
184                  packagelistLoc="${common.doc}/servlet2.3"/>
185            <link offline="true"
186                  href="http://logging.apache.org/log4j/docs/api"
187                  packagelistLoc="${common.doc}/log4j-1.2.8"/>
188            <link offline="true"
189                  href="http://java.sun.com/products/javabeans/glasgow/javadocs"
190                  packagelistLoc="${common.doc}/jaf-1.0.2"/>
191            <link offline="true"
192                  href="http://java.sun.com/products/javamail/javadocs"
193                  packagelistLoc="${common.doc}/javamail-1.3.1"/>
194            <link offline="true"
195                  href="http://ws.apache.org/soap/docs"
196                  packagelistLoc="${common.doc}/soap-2.3.1"/>
197
198            <bottom>&lt;i&gt;Copyright &amp;#169; 2004 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA&lt;/i&gt;</bottom>
199            <header>${docname}</header>
200
201       </javadoc>
202    </target>
203
204    <!-- zip documentation and store in build/doc/${target} -->
205    <target name="zipdoc" depends="javadoc" if="build.dir" unless="javadocBuild.notRequired">
206	<zip zipfile="${build.dir}/doc/${target}/${target}_javadoc.zip"
207      basedir="${build.dir}/doc/${target}/javadoc"
208      update="true"/>
209    </target>
210
211    <!-- clean up -->
212    <target name="clean" depends="prepare">
213        <delete dir="${build.class}" includeEmptyDirs="true"/>
214        <delete dir="${build.dir}/doc/${target}" includeEmptyDirs="true"/>
215    </target>
216
217    <!-- create jar file -->
218    <target name="jar" depends="prepare,compile" if="build.class">
219        <jar jarfile="${build.class}/${jarname}.jar"
220             basedir="${build.class}">
221            <manifest>
222                <attribute name="Class-Path" value="${jar-class-path} juh.jar jurt.jar ridl.jar unoil.jar"/>
223                <attribute name="Solar-Version" value="${RSCREVISION}"/>
224                <attribute name="RegistrationClassName" value="com.sun.star.sdbcx.comp.postgresql.PostgresqlDriver"/>
225                <attribute name="Sealed" value="true"/>
226                <attribute name="UNO-Type-Path" value=""/>
227            </manifest>
228            <include name="**/*.class"/>
229            <include name="**/*.properties"/>
230            <include name="**/*.css"/>
231            <include name="**/*.dtd"/>
232            <include name="**/*.form"/>
233            <include name="**/*.gif "/>
234            <include name="**/*.htm"/>
235            <include name="**/*.html"/>
236            <include name="**/*.js"/>
237            <include name="**/*.mod"/>
238            <include name="**/*.sql"/>
239            <include name="**/*.xml"/>
240            <include name="**/*.xsl"/>
241            <include name="**/*.map"/>
242        </jar>
243    </target>
244
245    <target name="test" depends="prepare">
246    </target>
247
248</project>
249
250