Project

General

Profile

1 113 jones
<?xml version="1.0"?>
2 1311 berkley
<!--
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 1311 berkley
-->
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 1311 berkley
44 925 berkley
   <target name="postgresql">
45 931 jones
     <!-- Customize these properties if you are using postgres -->
46 1311 berkley
     <property name="jdbc-connect"
47 1051 tao
               value="jdbc:postgresql://localhost/exp"/>
48 925 berkley
     <property name="dbDriver" value="org.postgresql.Driver"/>
49 1311 berkley
     <property name="dbAdapter"
50 931 jones
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
51 925 berkley
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
52
   </target>
53 1311 berkley
54 1227 tao
   <target name="config" depends="oracle">
55 1311 berkley
      <!-- Change the 'depends' attribute above to 'postgresql' to install
56 931 jones
           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 1338 tao
      <property name="context" value="yourcontext" />
62
      <property name="user" value="yourusername"/>
63
      <property name="password" value="yourpasswd"/>
64 1321 tao
      <property name="server" value="dev.nceas.ucsb.edu"/>
65
      <property name="systemidserver" value="http://dev.nceas.ucsb.edu" />
66
      <property name="datafilepath" value="/opt/tomcat/data/tao/data" />
67
      <property name="debuglevel" value="35" />
68 1292 tao
      <property name="forcereplicationwaitingtime" value="30000"/>
69 1311 berkley
      <property name="web-base-url"
70 931 jones
                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 1311 berkley
      <property name="jsdk"
77 931 jones
                value="${tomcat}/lib/common/servlet.jar" />
78 1311 berkley
      <property name="xmlp"
79 931 jones
                value="lib/xerces.jar" />
80 1311 berkley
      <property name="srb"
81 931 jones
                value="lib/srbrmi" />
82 1311 berkley
      <property name="cos"
83 931 jones
                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 1311 berkley
                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 1339 tao
      <property name="release" value="1.2.1"/>
104 1311 berkley
      <property name="replication-path"
105 931 jones
                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 1311 berkley
      <property name="cvsroot"
116 1312 tao
                value=":ext:tao@cvs.ecoinformatics.org:/cvs" />
117 348 jones
118 1311 berkley
      <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 1311 berkley
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 1311 berkley
       <javac srcdir="${build.src}"
187
              destdir="${build.dest}"
188
              classpath="${cpath}"
189
              excludes="**/*.sql" />
190
       <copy file="lib/metacat.properties"
191
             tofile="${build.dest}/${package.home}/metacat.properties"
192 822 jones
             filtering="yes" />
193 1311 berkley
       <copy file="lib/srbProps.properties"
194 822 jones
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
195 1311 berkley
   </target>
196 113 jones
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 1311 berkley
   </target>
205
206 635 jones
   <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 1311 berkley
   </target>
211 113 jones
212 877 jones
   <target name="getdtd" depends="prepare">
213 1307 jones
     <echo>Enter CVS password: </echo>
214
     <cvs cvsRoot="${cvsroot}"
215
          package="${eml-module}"
216
          tag="${eml-tag}"
217
          dest="${build.src}" />
218
     <mkdir dir="lib/dtd" />
219
     <copy todir="lib/dtd" filtering="yes">
220
       <fileset dir="${build.src}/${eml-module}">
221
         <include name="*.dtd"/>
222
       </fileset>
223
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
224
     </copy>
225 1314 tao
     <copy todir="lib/style">
226 1307 jones
       <fileset dir="${build.src}/${eml-module}/style">
227 1311 berkley
       <include name="*.xsl"/>
228
     </fileset>
229 1307 jones
     </copy>
230 877 jones
   </target>
231
232
   <target name="dtdsql" depends="prepare">
233
     <echo/>
234
     <echo>Registering the DTDs with the new Metacat instance...</echo>
235
     <sql driver="${dbDriver}"
236
          classpath="${jdbc}"
237
          url="${jdbc-connect}"
238
          userid="${user}"
239
          password="${password}"
240
          src="${build.src}/loaddtd.sql" />
241
   </target>
242
243 204 jones
   <target name="install" depends="jar">
244 1079 tao
       <mkdir dir="${datafilepath}" />
245
       <chmod dir="${datafilepath}" perm="ug+w" />
246 329 jones
       <mkdir dir="${installdir}/WEB-INF/lib" />
247 1311 berkley
       <copy file="${build.dir}/${name}.jar"
248 822 jones
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
249 1311 berkley
       <copy file="${xmlp}"
250 822 jones
             tofile="${installdir}/WEB-INF/lib/xerces.jar" />
251 1311 berkley
       <copy file="${xalan}"
252 923 jones
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
253 1311 berkley
       <copy file="${apis}"
254 923 jones
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
255 1311 berkley
       <copy file="${jdbc}"
256 822 jones
             tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
257 1311 berkley
       <copy file="${cos}"
258 822 jones
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
259 939 tao
       <copy file="${morpho}"
260 1311 berkley
       tofile="${installdir}/WEB-INF/lib/morpho.jar" />
261
       <copy file="lib/web.xml"
262 822 jones
             tofile="${installdir}/WEB-INF/web.xml" />
263
       <copy todir="${build.img}" filtering="no">
264
         <fileset dir="lib">
265
           <include name="**/*.jpg"/>
266
           <include name="**/*.png"/>
267
           <include name="**/*.gif"/>
268
         </fileset>
269
       </copy>
270
       <copy todir="${installdir}" filtering="yes">
271
         <fileset dir="lib">
272
           <exclude name="*.jar"/>
273
           <exclude name="*.properties"/>
274
           <exclude name="web.xml"/>
275
           <exclude name="**/srbrmi*"/>
276
         </fileset>
277
       </copy>
278 877 jones
       <echo>
279
             ***********************************************************
280
              Remember to register the default DTDs by running the
281
              "${build.src}/loaddtd.sql script". This is most easily
282
              done by using the "ant dtdsql" which will run it for you.
283
             ***********************************************************
284
       </echo>
285 1311 berkley
   </target>
286
287 971 tao
   <target name="test" depends="install">
288
      <!-- copy and compile the tests into a jar file -->
289 1116 tao
      <mkdir dir="${build.metacattest}"/>
290 1049 tao
      <javac srcdir="${junittestsdir}"
291 1116 tao
             destdir="${build.metacattest}"
292 1049 tao
             classpath="${cpath}:${build.dir}/${name}.jar"
293 1311 berkley
       includes="**/*.java" />
294 204 jones
295 1311 berkley
      <jar jarfile="${build.dir}/${name}-junittests.jar"
296
        basedir="${build.metacattest}"
297
                includes="**/*.class" />
298 971 tao
299
      <!-- use the ant "junit" task to run JUnit tests. -->
300
      <junit printsummary="yes" haltonfailure="no" fork="no"
301
             haltonerror="no">
302
        <classpath>
303 1049 tao
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
304 971 tao
        </classpath>
305
306
        <formatter type="plain" />
307
308
        <batchtest fork="yes" todir="${build.dir}">
309 1116 tao
          <fileset dir="${build.metacattest}">
310
            <include name="**/*.class" />
311 971 tao
          </fileset>
312
        </batchtest>
313
     </junit>
314
   </target>
315 1103 tao
316
  <target name="gethttpclient" depends="prepare">
317 1311 berkley
  <!--mkdir dir="${morphosourcedir}" -->
318 1103 tao
        <cvs cvsRoot=":ext:tao@cvs.ecoinformatics.org:/cvs"
319
             package="morpho"
320
             dest="." />
321 1107 tao
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
322 1103 tao
   </target>
323
324
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
325
   <target name="nettest" depends="install">
326
      <echo>***********************************
327 1311 berkley
      Please run ant gethttpclient first!
328
      ***********************************
329 1103 tao
      </echo>
330
      <!-- copy and compile the tests into a jar file -->
331 1116 tao
      <mkdir dir="${build.metacatnettest}"/>
332 1103 tao
      <javac srcdir="${junitnettestsdir}"
333 1116 tao
             destdir="${build.metacatnettest}"
334 1103 tao
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
335
             includes="**/*.java" />
336
337
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
338 1116 tao
                    basedir="${build.metacatnettest}"
339 1103 tao
                    includes="**/*.class" />
340
341
      <!-- use the ant "junit" task to run JUnit tests. -->
342 1107 tao
      <junit printsummary="yes" haltonfailure="no" fork="yes"
343 1103 tao
             haltonerror="no">
344 1107 tao
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
345 1103 tao
        <classpath>
346
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itis}" />
347
        </classpath>
348
349
        <formatter type="plain" />
350
351
        <batchtest fork="yes" todir="${build.dir}">
352 1116 tao
          <fileset dir="${build.metacatnettest}">
353
            <include name="**/*.class" />
354 1103 tao
          </fileset>
355
        </batchtest>
356
     </junit>
357 1311 berkley
   </target>
358 1103 tao
359 113 jones
   <target name="clean" depends="init">
360 822 jones
       <delete dir="${build.dir}" />
361 113 jones
   </target>
362
363 516 jones
   <target name="jdoc" depends="prepare">
364 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
365 516 jones
           sourcepath="${build.src}"
366
           destdir="${build.javadocs}"
367 113 jones
           author="true"
368
           version="true"
369
           use="true"
370 348 jones
           windowtitle="${Name} API"
371
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
372 113 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
373
       />
374
   </target>
375
376 879 jones
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
377 806 jones
      <mkdir dir="${dist.dir}"/>
378
      <delete dir="${ver.dir}" />
379
      <mkdir dir="${ver.dir}"/>
380
      <copy todir="${ver.dir}">
381 1311 berkley
        <fileset dir="."
382 882 jones
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
383 806 jones
      </copy>
384
      <copy todir="${ver.dir}" file="build.xml"/>
385
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
386
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
387 882 jones
388
      <copy todir="${ver.dir}/docs" filtering="yes">
389
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
390
      </copy>
391
      <copy todir="${ver.dir}/docs" filtering="no">
392
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
393
      </copy>
394 806 jones
      <copy todir="${ver.dir}/docs/dev">
395
        <fileset dir="${build.dir}/docs"/>
396
      </copy>
397 917 berkley
      <copy todir="${ver.dir}/src">
398
        <fileset dir="${build.dir}/src"/>
399
      </copy>
400
401 992 berkley
      <delete dir="./${ver.dir}/${build.dir}"/>
402
      <delete dir="./${ver.dir}/dist"/>
403 882 jones
      <delete file="./${name}-${release}.zip"/>
404 1312 tao
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
405 882 jones
      <delete file="./${name}-${release}.tar.gz" />
406 1312 tao
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
407 1311 berkley
      <gzip zipfile="./${name}-${release}.tar.gz"
408 882 jones
                src="./${name}-${release}.tar"/>
409
      <delete file="./${name}-${release}.tar" />
410 1311 berkley
  </target>
411 806 jones
412
  <target name="distsrc" depends="dist">
413
      <mkdir dir="${ver.src}"/>
414
      <copy todir="${ver.src}">
415
        <fileset dir="./src"/>
416
      </copy>
417
418 882 jones
      <delete file="./${name}-src-${release}.zip"/>
419
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
420
      <delete file="./${name}-src-${release}.tar.gz" />
421
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
422 1311 berkley
      <gzip zipfile="./${name}-src-${release}.tar.gz"
423 882 jones
                src="./${name}-src-${release}.tar"/>
424
      <delete file="./${name}-src-${release}.tar" />
425 807 jones
      <delete dir="${dist.dir}"/>
426 1311 berkley
  </target>
427 806 jones
428 113 jones
</project>