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