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 1292 tao
  *    '$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 1051 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 1227 tao
   <target name="config" depends="oracle">
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 1051 tao
      <property name="tomcat" value="/usr/local/devtools/jakarta-tomcat" />
60 1227 tao
      <property name="webapps" value="/opt/tomcat/webapps" />
61 1051 tao
      <property name="context" value="tao" />
62 1009 tao
      <property name="user" value="tao"/>
63 1292 tao
      <property name="password" value="your-pw-goes-here"/>
64
      <property name="server" value="pine.nceas.ucsb.edu:8443"/>
65
      <property name="systemidserver" value="http://pine.nceas.ucsb.edu:8080" />
66
      <property name="datafilepath" value="/usr/local/devtools/jakarta-tomcat/data/tao/data" />
67 1296 tao
      <property name="debuglevel" value="50" />
68 1292 tao
      <property name="forcereplicationwaitingtime" value="30000"/>
69 931 jones
      <property name="web-base-url"
70
                value="http://knb.ecoinformatics.org"/>
71
      <property name="default-style" value="knb" />
72 1107 tao
      <property name="morphosourcedir" value="morpho" />
73 931 jones
74
      <!-- Make sure these paths match the location of the jar files
75
           on your system, the defaults should usually work -->
76
      <property name="jsdk"
77
                value="${tomcat}/lib/common/servlet.jar" />
78
      <property name="xmlp"
79
                value="lib/xerces.jar" />
80
      <property name="srb"
81
                value="lib/srbrmi" />
82
      <property name="cos"
83
                value="lib/cos.jar" />
84 939 tao
      <property name="morpho"
85
                value="lib/morpho.jar" />
86 931 jones
      <property name="xalan"
87
                value="lib/xalan/xalan.jar" />
88
      <property name="apis"
89
                value="lib/xalan/xml-apis.jar" />
90 1103 tao
      <property name="httpclient"
91
                value="${morphosourcedir}/lib/httpclient.jar" />
92
      <property name="itis"
93
                value="${morphosourcedir}/lib/itislib.jar" />
94 931 jones
95 1103 tao
  </target>
96
97 931 jones
   <target name="init" depends="config">
98
      <!-- It is less likely you'll need to make any changes from here down,
99
           but customization is possible -->
100
      <property name="installdir" value="${webapps}/${context}" />
101 348 jones
      <property name="name" value="metacat"/>
102
      <property name="Name" value="MetaCat"/>
103 992 berkley
      <property name="release" value="1.1.0"/>
104 931 jones
      <property name="replication-path"
105
                value="/${context}/servlet/replication"/>
106
      <property name="servlet-path" value="/${context}/servlet/metacat"/>
107
      <property name="html-path" value="/${context}"/>
108
      <property name="image-path" value="/img/${context}" />
109
      <property name="style-path" value="/${context}/style"/>
110 923 jones
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
111 832 jones
      <property name="config-dir" value="${installdir}" />
112 924 jones
      <property name="eml-module" value="eml" />
113 877 jones
      <property name="eml-version" value="2.0.0beta6" />
114 1227 tao
      <property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6_REV1" />
115 877 jones
      <property name="cvsroot"
116 1009 tao
                value=":ext:tao@cvs.ecoinformatics.org:/cvs" />
117 348 jones
118 931 jones
      <property name="cpath"
119 1049 tao
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}"/>
120 882 jones
121
      <filter token="docrooturl" value="./" />
122 588 berkley
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
123 882 jones
      <filter token="dbDriver" value="${dbDriver}"/>
124 915 berkley
      <filter token="dbAdapter" value="${dbAdapter}"/>
125 614 bojilova
      <filter token="install-dir" value="${installdir}"/>
126 586 berkley
      <filter token="server" value="${server}"/>
127 977 tao
      <filter token="systemidserver" value="${systemidserver}"/>
128 586 berkley
      <filter token="replication-log" value="${replication-log}"/>
129 348 jones
      <filter token="release" value="${release}"/>
130
      <filter token="servlet-path" value="${servlet-path}"/>
131 359 bojilova
      <filter token="html-path" value="${html-path}"/>
132 362 jones
      <filter token="user" value="${user}"/>
133
      <filter token="password" value="${password}"/>
134 409 berkley
      <filter token="image-path" value="${image-path}"/>
135 828 jones
      <filter token="style-path" value="${style-path}"/>
136 506 jones
      <filter token="web-base-url" value="${web-base-url}"/>
137 525 berkley
      <filter token="replication-path" value="${replication-path}"/>
138 832 jones
      <filter token="config-dir" value="${config-dir}"/>
139
      <filter token="default-style" value="${default-style}"/>
140 877 jones
      <filter token="eml-version" value="${eml-version}"/>
141 1009 tao
      <filter token="context" value="${context}"/>
142 1292 tao
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
143 1051 tao
      <filter token="debuglevel" value="${debuglevel}" />
144 1079 tao
      <filter token="datafilepath" value="${datafilepath}" />
145 254 jones
      <property name="srcdir" value="./src" />
146 1116 tao
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
147
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
148 348 jones
      <property name="build.dir" value="./build"/>
149
      <property name="build.src" value="${build.dir}/src"/>
150
      <property name="build.dest" value="${build.dir}/classes"/>
151 516 jones
      <property name="build.docs" value="${build.dir}/docs"/>
152 348 jones
      <property name="build.samples" value="${build.dir}/samples"/>
153
      <property name="build.tests" value="${build.dir}/tests"/>
154 1116 tao
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
155
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
156 348 jones
      <property name="build.data" value="${build.dir}/data"/>
157 806 jones
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
158 887 berkley
      <property name="build.img" value="${installdir}/${image-path}"/>
159 348 jones
160 882 jones
      <property name="dist.dir" value="dist"/>
161 806 jones
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
162
      <property name="ver.src" value="${ver.dir}/src"/>
163
164 254 jones
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
165 915 berkley
166 113 jones
   </target>
167
168 348 jones
   <target name="prepare" depends="init">
169
      <mkdir dir="${build.dir}"/>
170
      <mkdir dir="${build.src}"/>
171
      <mkdir dir="${build.dest}"/>
172 516 jones
      <mkdir dir="${build.javadocs}"/>
173 348 jones
174 822 jones
      <copy todir="${build.src}" filtering="yes">
175
        <fileset dir="${srcdir}">
176
          <include name="edu/**"/>
177
          <include name="com/**"/>
178 877 jones
          <include name="**/*.sql"/>
179 822 jones
          <exclude name="**/CVS*"/>
180
          <exclude name="**/.#*"/>
181
        </fileset>
182
      </copy>
183 348 jones
   </target>
184
185
   <target name="compile" depends="prepare">
186
       <javac srcdir="${build.src}"
187
              destdir="${build.dest}"
188 257 jones
              classpath="${cpath}"
189
              excludes="**/*.sql" />
190 822 jones
       <copy file="lib/metacat.properties"
191
             tofile="${build.dest}/${package.home}/metacat.properties"
192
             filtering="yes" />
193
       <copy file="lib/srbProps.properties"
194
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
195 113 jones
   </target>
196
197 204 jones
   <target name="jar" depends="compile">
198 353 jones
       <delete file="${build.dir}/${name}.jar" />
199 822 jones
       <copy todir="${build.dest}">
200
         <fileset dir="lib/srbrmi"/>
201
       </copy>
202 635 jones
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
203
            excludes="**/protocols/" />
204 113 jones
   </target>
205 635 jones
206
   <target name="protocol" depends="compile">
207
       <delete file="${build.dir}/protocol.jar" />
208
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
209
            includes="**/protocols/" />
210
   </target>
211 113 jones
212 877 jones
   <target name="getdtd" depends="prepare">
213
        <cvs cvsRoot="${cvsroot}"
214
             package="${eml-module}"
215
             tag="${eml-tag}"
216
             dest="${build.src}" />
217 879 jones
       <mkdir dir="lib/dtd" />
218
       <copy todir="lib/dtd" filtering="yes">
219
         <fileset dir="${build.src}/${eml-module}">
220
           <include name="*.dtd"/>
221
         </fileset>
222
         <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
223
       </copy>
224 1227 tao
       <copy todir="lib/style" filtering="yes">
225
         <fileset dir="${build.src}/${eml-module}/style">
226
	    <include name="*.xsl"/>
227
	 </fileset>
228
       </copy>
229 877 jones
   </target>
230
231
   <target name="dtdsql" depends="prepare">
232
     <echo/>
233
     <echo>Registering the DTDs with the new Metacat instance...</echo>
234
     <sql driver="${dbDriver}"
235
          classpath="${jdbc}"
236
          url="${jdbc-connect}"
237
          userid="${user}"
238
          password="${password}"
239
          src="${build.src}/loaddtd.sql" />
240
   </target>
241
242 204 jones
   <target name="install" depends="jar">
243 1079 tao
       <mkdir dir="${datafilepath}" />
244
       <chmod dir="${datafilepath}" perm="ug+w" />
245 329 jones
       <mkdir dir="${installdir}/WEB-INF/lib" />
246 822 jones
       <copy file="${build.dir}/${name}.jar"
247
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
248 931 jones
       <copy file="${xmlp}"
249 822 jones
             tofile="${installdir}/WEB-INF/lib/xerces.jar" />
250 923 jones
       <copy file="${xalan}"
251
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
252 931 jones
       <copy file="${apis}"
253 923 jones
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
254 822 jones
       <copy file="${jdbc}"
255
             tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
256
       <copy file="${cos}"
257
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
258 939 tao
       <copy file="${morpho}"
259
	     tofile="${installdir}/WEB-INF/lib/morpho.jar" />
260 822 jones
       <copy file="lib/web.xml"
261
             tofile="${installdir}/WEB-INF/web.xml" />
262
       <copy todir="${build.img}" filtering="no">
263
         <fileset dir="lib">
264
           <include name="**/*.jpg"/>
265
           <include name="**/*.png"/>
266
           <include name="**/*.gif"/>
267
         </fileset>
268
       </copy>
269
       <copy todir="${installdir}" filtering="yes">
270
         <fileset dir="lib">
271
           <exclude name="*.jar"/>
272
           <exclude name="*.properties"/>
273
           <exclude name="web.xml"/>
274
           <exclude name="**/srbrmi*"/>
275
         </fileset>
276
       </copy>
277 877 jones
       <echo>
278
             ***********************************************************
279
              Remember to register the default DTDs by running the
280
              "${build.src}/loaddtd.sql script". This is most easily
281
              done by using the "ant dtdsql" which will run it for you.
282
             ***********************************************************
283
       </echo>
284 204 jones
   </target>
285 971 tao
286
   <target name="test" depends="install">
287
      <!-- copy and compile the tests into a jar file -->
288 1116 tao
      <mkdir dir="${build.metacattest}"/>
289 1049 tao
      <javac srcdir="${junittestsdir}"
290 1116 tao
             destdir="${build.metacattest}"
291 1049 tao
             classpath="${cpath}:${build.dir}/${name}.jar"
292
	     includes="**/*.java" />
293 204 jones
294 1049 tao
      <jar jarfile="${build.dir}/${name}-junittests.jar"
295 1116 tao
		    basedir="${build.metacattest}"
296 1049 tao
          	    includes="**/*.class" />
297 971 tao
298
      <!-- use the ant "junit" task to run JUnit tests. -->
299
      <junit printsummary="yes" haltonfailure="no" fork="no"
300
             haltonerror="no">
301
        <classpath>
302 1049 tao
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
303 971 tao
        </classpath>
304
305
        <formatter type="plain" />
306
307
        <batchtest fork="yes" todir="${build.dir}">
308 1116 tao
          <fileset dir="${build.metacattest}">
309
            <include name="**/*.class" />
310 971 tao
          </fileset>
311
        </batchtest>
312
     </junit>
313
   </target>
314 1103 tao
315
  <target name="gethttpclient" depends="prepare">
316
	<!--mkdir dir="${morphosourcedir}" -->
317
        <cvs cvsRoot=":ext:tao@cvs.ecoinformatics.org:/cvs"
318
             package="morpho"
319
             dest="." />
320 1107 tao
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
321 1103 tao
   </target>
322
323
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
324
   <target name="nettest" depends="install">
325
      <echo>***********************************
326
	    Please run ant gethttpclient first!
327
	    ***********************************
328
      </echo>
329
      <!-- copy and compile the tests into a jar file -->
330 1116 tao
      <mkdir dir="${build.metacatnettest}"/>
331 1103 tao
      <javac srcdir="${junitnettestsdir}"
332 1116 tao
             destdir="${build.metacatnettest}"
333 1103 tao
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
334
             includes="**/*.java" />
335
336
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
337 1116 tao
                    basedir="${build.metacatnettest}"
338 1103 tao
                    includes="**/*.class" />
339
340
      <!-- use the ant "junit" task to run JUnit tests. -->
341 1107 tao
      <junit printsummary="yes" haltonfailure="no" fork="yes"
342 1103 tao
             haltonerror="no">
343 1107 tao
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
344 1103 tao
        <classpath>
345
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itis}" />
346
        </classpath>
347
348
        <formatter type="plain" />
349
350
        <batchtest fork="yes" todir="${build.dir}">
351 1116 tao
          <fileset dir="${build.metacatnettest}">
352
            <include name="**/*.class" />
353 1103 tao
          </fileset>
354
        </batchtest>
355
     </junit>
356
   </target>
357
358 113 jones
   <target name="clean" depends="init">
359 822 jones
       <delete dir="${build.dir}" />
360 113 jones
   </target>
361
362 516 jones
   <target name="jdoc" depends="prepare">
363 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
364 516 jones
           sourcepath="${build.src}"
365
           destdir="${build.javadocs}"
366 113 jones
           author="true"
367
           version="true"
368
           use="true"
369 348 jones
           windowtitle="${Name} API"
370
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
371 113 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
372
       />
373
   </target>
374
375 879 jones
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
376 806 jones
      <mkdir dir="${dist.dir}"/>
377
      <delete dir="${ver.dir}" />
378
      <mkdir dir="${ver.dir}"/>
379
      <copy todir="${ver.dir}">
380 882 jones
        <fileset dir="."
381
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
382 806 jones
      </copy>
383
      <copy todir="${ver.dir}" file="build.xml"/>
384
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
385
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
386 882 jones
387
      <copy todir="${ver.dir}/docs" filtering="yes">
388
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
389
      </copy>
390
      <copy todir="${ver.dir}/docs" filtering="no">
391
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
392
      </copy>
393 806 jones
      <copy todir="${ver.dir}/docs/dev">
394
        <fileset dir="${build.dir}/docs"/>
395
      </copy>
396 917 berkley
      <copy todir="${ver.dir}/src">
397
        <fileset dir="${build.dir}/src"/>
398
      </copy>
399
400 992 berkley
      <delete dir="./${ver.dir}/${build.dir}"/>
401
      <delete dir="./${ver.dir}/dist"/>
402 882 jones
      <delete file="./${name}-${release}.zip"/>
403
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}"/>
404
      <delete file="./${name}-${release}.tar.gz" />
405
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}"/>
406
      <gzip zipfile="./${name}-${release}.tar.gz"
407
                src="./${name}-${release}.tar"/>
408
      <delete file="./${name}-${release}.tar" />
409 806 jones
  </target>
410
411
  <target name="distsrc" depends="dist">
412
      <mkdir dir="${ver.src}"/>
413
      <copy todir="${ver.src}">
414
        <fileset dir="./src"/>
415
      </copy>
416
417 882 jones
      <delete file="./${name}-src-${release}.zip"/>
418
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
419
      <delete file="./${name}-src-${release}.tar.gz" />
420
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
421
      <gzip zipfile="./${name}-src-${release}.tar.gz"
422
                src="./${name}-src-${release}.tar"/>
423
      <delete file="./${name}-src-${release}.tar" />
424 807 jones
      <delete dir="${dist.dir}"/>
425 806 jones
  </target>
426
427 113 jones
</project>