Project

General

Profile

1 113 jones
<?xml version="1.0"?>
2
<!--
3 670 jones
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8 113 jones
  *
9 670 jones
  *    '$Author$'
10
  *      '$Date$'
11
  *  '$Revision$'
12 666 jones
  *
13 670 jones
  * Build file for the Ant cross-platform build system for metacat
14
  * See http://jakarta.apache.org for details on Ant
15 113 jones
  *
16 303 jones
  * usage: ant [compile|jar|install|jdoc]
17 666 jones
  *
18
  * This program is free software; you can redistribute it and/or modify
19
  * it under the terms of the GNU General Public License as published by
20
  * the Free Software Foundation; either version 2 of the License, or
21
  * (at your option) any later version.
22
  *
23
  * This program is distributed in the hope that it will be useful,
24
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
  * GNU General Public License for more details.
27
  *
28
  * You should have received a copy of the GNU General Public License
29
  * along with this program; if not, write to the Free Software
30
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31 113 jones
-->
32 329 jones
<project name="metacat" default="jar" basedir=".">
33 931 jones
34 925 berkley
   <target name="oracle">
35 931 jones
     <!-- Customize these properties if you are using oracle -->
36
     <property name="jdbc-connect"
37
               value="jdbc:oracle:thin:@dev.nceas.ucsb.edu:1521:exp"/>
38 925 berkley
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
39
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
40
     <property name="oracle_home" value="/oracle01/app/oracle/product/8.1.6" />
41
     <property name="jdbc" value="${oracle_home}/jdbc/lib/classes111.zip" />
42
   </target>
43
44
   <target name="postgresql">
45 931 jones
     <!-- Customize these properties if you are using postgres -->
46
     <property name="jdbc-connect"
47 977 tao
               value="jdbc:postgresql://localhost/exp"/>
48 925 berkley
     <property name="dbDriver" value="org.postgresql.Driver"/>
49 931 jones
     <property name="dbAdapter"
50
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
51 925 berkley
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
52
   </target>
53
54 1009 tao
   <target name="config" depends="postgresql">
55 931 jones
      <!-- Change the 'depends' attribute above to 'postgresql' to install
56
           metacat with postgres instead of oracle -->
57
58
      <!-- Customize these properties for your system -->
59 1009 tao
      <property name="tomcat" value="/home/tao/tomcat" />
60
      <property name="webapps" value="/home/tao/tomcat/webapps" />
61
      <property name="context" value="tao" />
62
      <property name="user" value="tao"/>
63 992 berkley
      <property name="password" value="your-pw-goes-here"/>
64 1009 tao
      <property name="server" value="epsilon.nceas.ucsb.edu:8443"/>
65
      <property name="systemidserver" value="http://epsilon.nceas.ucsb.edu:8080" />
66 993 tao
      <property name="datadir" value="data" />
67 1018 tao
      <property name="replication" value="on" />
68
      <property name="replicationdata" value="off" />
69 931 jones
      <property name="web-base-url"
70
                value="http://knb.ecoinformatics.org"/>
71
      <property name="default-style" value="knb" />
72
73
      <!-- Make sure these paths match the location of the jar files
74
           on your system, the defaults should usually work -->
75
      <property name="jsdk"
76
                value="${tomcat}/lib/common/servlet.jar" />
77
      <property name="xmlp"
78
                value="lib/xerces.jar" />
79
      <property name="srb"
80
                value="lib/srbrmi" />
81
      <property name="cos"
82
                value="lib/cos.jar" />
83 939 tao
      <property name="morpho"
84
                value="lib/morpho.jar" />
85 931 jones
      <property name="xalan"
86
                value="lib/xalan/xalan.jar" />
87
      <property name="apis"
88
                value="lib/xalan/xml-apis.jar" />
89
   </target>
90
91
   <target name="init" depends="config">
92
      <!-- It is less likely you'll need to make any changes from here down,
93
           but customization is possible -->
94
      <property name="installdir" value="${webapps}/${context}" />
95 348 jones
      <property name="name" value="metacat"/>
96
      <property name="Name" value="MetaCat"/>
97 992 berkley
      <property name="release" value="1.1.0"/>
98 931 jones
      <property name="replication-path"
99
                value="/${context}/servlet/replication"/>
100
      <property name="servlet-path" value="/${context}/servlet/metacat"/>
101
      <property name="html-path" value="/${context}"/>
102
      <property name="image-path" value="/img/${context}" />
103
      <property name="style-path" value="/${context}/style"/>
104 923 jones
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
105 832 jones
      <property name="config-dir" value="${installdir}" />
106 924 jones
      <property name="eml-module" value="eml" />
107 877 jones
      <property name="eml-version" value="2.0.0beta6" />
108
      <property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6" />
109
      <property name="cvsroot"
110 1009 tao
                value=":ext:tao@cvs.ecoinformatics.org:/cvs" />
111 348 jones
112 931 jones
      <property name="cpath"
113 939 tao
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}"/>
114 882 jones
115
      <filter token="docrooturl" value="./" />
116 588 berkley
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
117 882 jones
      <filter token="dbDriver" value="${dbDriver}"/>
118 915 berkley
      <filter token="dbAdapter" value="${dbAdapter}"/>
119 614 bojilova
      <filter token="install-dir" value="${installdir}"/>
120 586 berkley
      <filter token="server" value="${server}"/>
121 977 tao
      <filter token="systemidserver" value="${systemidserver}"/>
122 586 berkley
      <filter token="replication-log" value="${replication-log}"/>
123 348 jones
      <filter token="release" value="${release}"/>
124
      <filter token="servlet-path" value="${servlet-path}"/>
125 359 bojilova
      <filter token="html-path" value="${html-path}"/>
126 362 jones
      <filter token="user" value="${user}"/>
127
      <filter token="password" value="${password}"/>
128 409 berkley
      <filter token="image-path" value="${image-path}"/>
129 828 jones
      <filter token="style-path" value="${style-path}"/>
130 506 jones
      <filter token="web-base-url" value="${web-base-url}"/>
131 525 berkley
      <filter token="replication-path" value="${replication-path}"/>
132 832 jones
      <filter token="config-dir" value="${config-dir}"/>
133
      <filter token="default-style" value="${default-style}"/>
134 877 jones
      <filter token="eml-version" value="${eml-version}"/>
135 1009 tao
      <filter token="context" value="${context}"/>
136 1018 tao
      <filter token="replication" value="${replication}" />
137
      <filter token="replicationdata" value="${replicationdata}" />
138 254 jones
      <property name="srcdir" value="./src" />
139 971 tao
      <property name="junittestsdir" value="./junittests" />
140 348 jones
      <property name="build.dir" value="./build"/>
141
      <property name="build.src" value="${build.dir}/src"/>
142
      <property name="build.dest" value="${build.dir}/classes"/>
143 516 jones
      <property name="build.docs" value="${build.dir}/docs"/>
144 348 jones
      <property name="build.samples" value="${build.dir}/samples"/>
145
      <property name="build.tests" value="${build.dir}/tests"/>
146 971 tao
      <property name="build.junittests" value="${build.dir}/junittests"/>
147 348 jones
      <property name="build.data" value="${build.dir}/data"/>
148 806 jones
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
149 887 berkley
      <property name="build.img" value="${installdir}/${image-path}"/>
150 348 jones
151 882 jones
      <property name="dist.dir" value="dist"/>
152 806 jones
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
153
      <property name="ver.src" value="${ver.dir}/src"/>
154
155 254 jones
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
156 915 berkley
157 113 jones
   </target>
158
159 348 jones
   <target name="prepare" depends="init">
160
      <mkdir dir="${build.dir}"/>
161
      <mkdir dir="${build.src}"/>
162
      <mkdir dir="${build.dest}"/>
163 516 jones
      <mkdir dir="${build.javadocs}"/>
164 348 jones
165 822 jones
      <copy todir="${build.src}" filtering="yes">
166
        <fileset dir="${srcdir}">
167
          <include name="edu/**"/>
168
          <include name="com/**"/>
169 877 jones
          <include name="**/*.sql"/>
170 822 jones
          <exclude name="**/CVS*"/>
171
          <exclude name="**/.#*"/>
172
        </fileset>
173
      </copy>
174 348 jones
   </target>
175
176
   <target name="compile" depends="prepare">
177
       <javac srcdir="${build.src}"
178
              destdir="${build.dest}"
179 257 jones
              classpath="${cpath}"
180
              excludes="**/*.sql" />
181 822 jones
       <copy file="lib/metacat.properties"
182
             tofile="${build.dest}/${package.home}/metacat.properties"
183
             filtering="yes" />
184
       <copy file="lib/srbProps.properties"
185
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
186 113 jones
   </target>
187
188 204 jones
   <target name="jar" depends="compile">
189 353 jones
       <delete file="${build.dir}/${name}.jar" />
190 822 jones
       <copy todir="${build.dest}">
191
         <fileset dir="lib/srbrmi"/>
192
       </copy>
193 635 jones
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
194
            excludes="**/protocols/" />
195 113 jones
   </target>
196 635 jones
197
   <target name="protocol" depends="compile">
198
       <delete file="${build.dir}/protocol.jar" />
199
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
200
            includes="**/protocols/" />
201
   </target>
202 113 jones
203 877 jones
   <target name="getdtd" depends="prepare">
204
        <cvs cvsRoot="${cvsroot}"
205
             package="${eml-module}"
206
             tag="${eml-tag}"
207
             dest="${build.src}" />
208 879 jones
       <mkdir dir="lib/dtd" />
209
       <copy todir="lib/dtd" filtering="yes">
210
         <fileset dir="${build.src}/${eml-module}">
211
           <include name="*.dtd"/>
212
         </fileset>
213
         <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
214
       </copy>
215 877 jones
   </target>
216
217
   <target name="dtdsql" depends="prepare">
218
     <echo/>
219
     <echo>Registering the DTDs with the new Metacat instance...</echo>
220
     <sql driver="${dbDriver}"
221
          classpath="${jdbc}"
222
          url="${jdbc-connect}"
223
          userid="${user}"
224
          password="${password}"
225
          src="${build.src}/loaddtd.sql" />
226
   </target>
227
228 204 jones
   <target name="install" depends="jar">
229 993 tao
       <mkdir dir="${installdir}/${datadir}" />
230
       <chmod dir="${installdir}/${datadir}" perm="ug+w" />
231 329 jones
       <mkdir dir="${installdir}/WEB-INF/lib" />
232 822 jones
       <copy file="${build.dir}/${name}.jar"
233
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
234 931 jones
       <copy file="${xmlp}"
235 822 jones
             tofile="${installdir}/WEB-INF/lib/xerces.jar" />
236 923 jones
       <copy file="${xalan}"
237
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
238 931 jones
       <copy file="${apis}"
239 923 jones
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
240 822 jones
       <copy file="${jdbc}"
241
             tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
242
       <copy file="${cos}"
243
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
244 939 tao
       <copy file="${morpho}"
245
	     tofile="${installdir}/WEB-INF/lib/morpho.jar" />
246 822 jones
       <copy file="lib/web.xml"
247
             tofile="${installdir}/WEB-INF/web.xml" />
248
       <copy todir="${build.img}" filtering="no">
249
         <fileset dir="lib">
250
           <include name="**/*.jpg"/>
251
           <include name="**/*.png"/>
252
           <include name="**/*.gif"/>
253
         </fileset>
254
       </copy>
255
       <copy todir="${installdir}" filtering="yes">
256
         <fileset dir="lib">
257
           <exclude name="*.jar"/>
258
           <exclude name="*.properties"/>
259
           <exclude name="web.xml"/>
260
           <exclude name="**/srbrmi*"/>
261
         </fileset>
262
       </copy>
263 877 jones
       <echo>
264
             ***********************************************************
265
              Remember to register the default DTDs by running the
266
              "${build.src}/loaddtd.sql script". This is most easily
267
              done by using the "ant dtdsql" which will run it for you.
268
             ***********************************************************
269
       </echo>
270 204 jones
   </target>
271 971 tao
272
   <target name="test" depends="install">
273
      <!-- copy and compile the tests into a jar file -->
274
      <mkdir dir="${build.junittests}"/>
275
      <copy todir="${build.junittests}" filtering="yes">
276
        <fileset dir="${junittestsdir}">
277
          <exclude name="**/CVS*"/>
278
          <exclude name="**/.#*"/>
279
        </fileset>
280
      </copy>
281
      <javac srcdir="${build.junittests}"
282
             destdir="${build.dest}"
283
             classpath="${cpath}" />
284 204 jones
285 971 tao
      <jar jarfile="${build.dir}/${name}-junittests.jar" basedir="${build.dest}"
286
           includes="${package.home}/${name}junittests/**" />
287
288
      <!-- use the ant "junit" task to run JUnit tests. -->
289
      <junit printsummary="yes" haltonfailure="no" fork="no"
290
             haltonerror="no">
291
        <classpath>
292
          <pathelement path="${cpath}:${build.dir}/${name}-junittests.jar" />
293
        </classpath>
294
295
        <formatter type="plain" />
296
297
        <batchtest fork="yes" todir="${build.dir}">
298
          <fileset dir="${build.junittests}">
299
            <include name="**/*.java" />
300
          </fileset>
301
        </batchtest>
302
     </junit>
303
   </target>
304
305 113 jones
   <target name="clean" depends="init">
306 822 jones
       <delete dir="${build.dir}" />
307 113 jones
   </target>
308
309 516 jones
   <target name="jdoc" depends="prepare">
310 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
311 516 jones
           sourcepath="${build.src}"
312
           destdir="${build.javadocs}"
313 113 jones
           author="true"
314
           version="true"
315
           use="true"
316 348 jones
           windowtitle="${Name} API"
317
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
318 113 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
319
       />
320
   </target>
321
322 879 jones
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
323 806 jones
      <mkdir dir="${dist.dir}"/>
324
      <delete dir="${ver.dir}" />
325
      <mkdir dir="${ver.dir}"/>
326
      <copy todir="${ver.dir}">
327 882 jones
        <fileset dir="."
328
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
329 806 jones
      </copy>
330
      <copy todir="${ver.dir}" file="build.xml"/>
331
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
332
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
333 882 jones
334
      <copy todir="${ver.dir}/docs" filtering="yes">
335
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
336
      </copy>
337
      <copy todir="${ver.dir}/docs" filtering="no">
338
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
339
      </copy>
340 806 jones
      <copy todir="${ver.dir}/docs/dev">
341
        <fileset dir="${build.dir}/docs"/>
342
      </copy>
343 917 berkley
      <copy todir="${ver.dir}/src">
344
        <fileset dir="${build.dir}/src"/>
345
      </copy>
346
347 992 berkley
      <delete dir="./${ver.dir}/${build.dir}"/>
348
      <delete dir="./${ver.dir}/dist"/>
349 882 jones
      <delete file="./${name}-${release}.zip"/>
350
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}"/>
351
      <delete file="./${name}-${release}.tar.gz" />
352
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}"/>
353
      <gzip zipfile="./${name}-${release}.tar.gz"
354
                src="./${name}-${release}.tar"/>
355
      <delete file="./${name}-${release}.tar" />
356 806 jones
  </target>
357
358
  <target name="distsrc" depends="dist">
359
      <mkdir dir="${ver.src}"/>
360
      <copy todir="${ver.src}">
361
        <fileset dir="./src"/>
362
      </copy>
363
364 882 jones
      <delete file="./${name}-src-${release}.zip"/>
365
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
366
      <delete file="./${name}-src-${release}.tar.gz" />
367
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
368
      <gzip zipfile="./${name}-src-${release}.tar.gz"
369
                src="./${name}-src-${release}.tar"/>
370
      <delete file="./${name}-src-${release}.tar" />
371 807 jones
      <delete dir="${dist.dir}"/>
372 806 jones
  </target>
373
374 113 jones
</project>