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 925 berkley
   <target name="oracle">
34
     <property name="jdbc-connect" value="jdbc:oracle:thin:@dev.nceas.ucsb.edu:1521:exp"/>
35
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
36
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
37
     <property name="oracle_home" value="/oracle01/app/oracle/product/8.1.6" />
38
     <property name="jdbc" value="${oracle_home}/jdbc/lib/classes111.zip" />
39
     <property name="user" value="berkley"/>
40 926 berkley
     <property name="password" value=""/>
41 925 berkley
   </target>
42
43
   <target name="postgresql">
44
     <property name="jdbc-connect" value="jdbc:postgresql://localhost/metacat"/>
45
     <property name="dbDriver" value="org.postgresql.Driver"/>
46
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
47
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
48
     <property name="user" value="metacat"/>
49
     <property name="password" value=""/>
50
   </target>
51
52
   <target name="init" depends="oracle">
53
      <!--Change the 'depends' attribute above to 'postgresql' to install
54
          metacat with postgres instead of oracle-->
55
      <property name="installdir" value="/opt/tomcat/webapps/berkley" />
56 348 jones
      <property name="name" value="metacat"/>
57
      <property name="Name" value="MetaCat"/>
58 895 berkley
      <property name="release" value="1.0.3"/>
59 685 jones
      <property name="web-base-url"
60 915 berkley
                value="http://knb.ecoinformatics.org"/>
61 887 berkley
62 925 berkley
      <property name="replication-path" value="/berkley/servlet/replication"/>
63
      <property name="servlet-path" value="/berkley/servlet/metacat"/>
64
      <property name="html-path" value="/berkley"/>
65
      <property name="image-path" value="/img/berkley" />
66
      <property name="style-path" value="/berkley/style"/>
67 923 jones
      <property name="server" value="dev.nceas.ucsb.edu"/>
68
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
69 832 jones
      <property name="config-dir" value="${installdir}" />
70
      <property name="default-style" value="knb" />
71 924 jones
      <property name="eml-module" value="eml" />
72 877 jones
      <property name="eml-version" value="2.0.0beta6" />
73
      <property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6" />
74
      <property name="cvsroot"
75 925 berkley
                value=":ext:berkley@cvs.ecoinformatics.org:/cvs" />
76 348 jones
77 882 jones
78
      <filter token="docrooturl" value="./" />
79 588 berkley
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
80 882 jones
      <filter token="dbDriver" value="${dbDriver}"/>
81 915 berkley
      <filter token="dbAdapter" value="${dbAdapter}"/>
82 614 bojilova
      <filter token="install-dir" value="${installdir}"/>
83 882 jones
      <filter token="serverhost" value="${serverhost}"/>
84 586 berkley
      <filter token="server" value="${server}"/>
85
      <filter token="replication-log" value="${replication-log}"/>
86 348 jones
      <filter token="release" value="${release}"/>
87
      <filter token="servlet-path" value="${servlet-path}"/>
88 359 bojilova
      <filter token="html-path" value="${html-path}"/>
89 362 jones
      <filter token="user" value="${user}"/>
90
      <filter token="password" value="${password}"/>
91 409 berkley
      <filter token="image-path" value="${image-path}"/>
92 828 jones
      <filter token="style-path" value="${style-path}"/>
93 506 jones
      <filter token="web-base-url" value="${web-base-url}"/>
94 525 berkley
      <filter token="replication-path" value="${replication-path}"/>
95 832 jones
      <filter token="config-dir" value="${config-dir}"/>
96
      <filter token="default-style" value="${default-style}"/>
97 877 jones
      <filter token="eml-version" value="${eml-version}"/>
98
99 254 jones
      <property name="srcdir" value="./src" />
100 348 jones
      <property name="build.dir" value="./build"/>
101
      <property name="build.src" value="${build.dir}/src"/>
102
      <property name="build.dest" value="${build.dir}/classes"/>
103 516 jones
      <property name="build.docs" value="${build.dir}/docs"/>
104 348 jones
      <property name="build.samples" value="${build.dir}/samples"/>
105
      <property name="build.tests" value="${build.dir}/tests"/>
106
      <property name="build.data" value="${build.dir}/data"/>
107 806 jones
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
108 887 berkley
      <property name="build.img" value="${installdir}/${image-path}"/>
109 348 jones
110 882 jones
      <property name="dist.dir" value="dist"/>
111 806 jones
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
112
      <property name="ver.src" value="${ver.dir}/src"/>
113
114 925 berkley
115 329 jones
      <property name="toolsdir"
116
                value="/usr/local/devtools" />
117 185 jones
      <property name="xmlp2"
118 915 berkley
                value="${toolsdir}/xerces-1_1_3/xerces.jar" />
119 113 jones
      <property name="jserv"
120
                value="/usr/lib/apache/ApacheJServ.jar" />
121
      <property name="jsdk"
122 925 berkley
                value="${toolsdir}/jakarta-tomcat/lib/common/servlet.jar" />
123 213 jones
      <property name="srb"
124
                value="lib/srbrmi" />
125 798 jones
      <property name="cos"
126
                value="lib/cos.jar" />
127 906 berkley
      <property name="xalan"
128
                value="lib/xalan/xalan.jar" />
129
      <property name="xalanxml-apis"
130
                value="lib/xalan/xml-apis.jar" />
131 113 jones
      <property name="cpath"
132 915 berkley
                value="${xmlp2}:${xalan}:${xalanxml-apis}:${jdbc}:${jserv}:${jsdk}:${srb}:${cos}"/>
133 254 jones
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
134 915 berkley
135 113 jones
   </target>
136
137 348 jones
   <target name="prepare" depends="init">
138
      <mkdir dir="${build.dir}"/>
139
      <mkdir dir="${build.src}"/>
140
      <mkdir dir="${build.dest}"/>
141 516 jones
      <mkdir dir="${build.javadocs}"/>
142 348 jones
143 822 jones
      <copy todir="${build.src}" filtering="yes">
144
        <fileset dir="${srcdir}">
145
          <include name="edu/**"/>
146
          <include name="com/**"/>
147 877 jones
          <include name="**/*.sql"/>
148 822 jones
          <exclude name="**/CVS*"/>
149
          <exclude name="**/.#*"/>
150
        </fileset>
151
      </copy>
152 348 jones
   </target>
153
154
   <target name="compile" depends="prepare">
155
       <javac srcdir="${build.src}"
156
              destdir="${build.dest}"
157 257 jones
              classpath="${cpath}"
158
              excludes="**/*.sql" />
159 822 jones
       <copy file="lib/metacat.properties"
160
             tofile="${build.dest}/${package.home}/metacat.properties"
161
             filtering="yes" />
162
       <copy file="lib/srbProps.properties"
163
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
164 113 jones
   </target>
165
166 204 jones
   <target name="jar" depends="compile">
167 353 jones
       <delete file="${build.dir}/${name}.jar" />
168 822 jones
       <copy todir="${build.dest}">
169
         <fileset dir="lib/srbrmi"/>
170
       </copy>
171 635 jones
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
172
            excludes="**/protocols/" />
173 113 jones
   </target>
174 635 jones
175
   <target name="protocol" depends="compile">
176
       <delete file="${build.dir}/protocol.jar" />
177
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
178
            includes="**/protocols/" />
179
   </target>
180 113 jones
181 877 jones
   <target name="getdtd" depends="prepare">
182
        <cvs cvsRoot="${cvsroot}"
183
             package="${eml-module}"
184
             tag="${eml-tag}"
185
             dest="${build.src}" />
186 879 jones
       <mkdir dir="lib/dtd" />
187
       <copy todir="lib/dtd" filtering="yes">
188
         <fileset dir="${build.src}/${eml-module}">
189
           <include name="*.dtd"/>
190
         </fileset>
191
         <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
192
       </copy>
193 877 jones
   </target>
194
195
   <target name="dtdsql" depends="prepare">
196
     <echo/>
197
     <echo>Registering the DTDs with the new Metacat instance...</echo>
198
     <sql driver="${dbDriver}"
199
          classpath="${jdbc}"
200
          url="${jdbc-connect}"
201
          userid="${user}"
202
          password="${password}"
203
          src="${build.src}/loaddtd.sql" />
204
   </target>
205
206 204 jones
   <target name="install" depends="jar">
207 329 jones
       <mkdir dir="${installdir}/WEB-INF/lib" />
208 822 jones
       <copy file="${build.dir}/${name}.jar"
209
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
210
       <copy file="${xmlp2}"
211
             tofile="${installdir}/WEB-INF/lib/xerces.jar" />
212 923 jones
       <copy file="${xalan}"
213
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
214
       <copy file="${xalanxml-apis}"
215
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
216 822 jones
       <copy file="${jdbc}"
217
             tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
218
       <copy file="${cos}"
219
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
220
       <copy file="lib/web.xml"
221
             tofile="${installdir}/WEB-INF/web.xml" />
222
       <copy todir="${build.img}" filtering="no">
223
         <fileset dir="lib">
224
           <include name="**/*.jpg"/>
225
           <include name="**/*.png"/>
226
           <include name="**/*.gif"/>
227
         </fileset>
228
       </copy>
229
       <copy todir="${installdir}" filtering="yes">
230
         <fileset dir="lib">
231
           <exclude name="*.jar"/>
232
           <exclude name="*.properties"/>
233
           <exclude name="web.xml"/>
234
           <exclude name="**/srbrmi*"/>
235
         </fileset>
236
       </copy>
237 877 jones
       <echo>
238
             ***********************************************************
239
              Remember to register the default DTDs by running the
240
              "${build.src}/loaddtd.sql script". This is most easily
241
              done by using the "ant dtdsql" which will run it for you.
242
             ***********************************************************
243
       </echo>
244 204 jones
   </target>
245
246 113 jones
   <target name="clean" depends="init">
247 822 jones
       <delete dir="${build.dir}" />
248 113 jones
   </target>
249
250 516 jones
   <target name="jdoc" depends="prepare">
251 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
252 516 jones
           sourcepath="${build.src}"
253
           destdir="${build.javadocs}"
254 113 jones
           author="true"
255
           version="true"
256
           use="true"
257 348 jones
           windowtitle="${Name} API"
258
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
259 113 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
260
       />
261
   </target>
262
263 879 jones
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
264 806 jones
      <mkdir dir="${dist.dir}"/>
265
      <delete dir="${ver.dir}" />
266
      <mkdir dir="${ver.dir}"/>
267
      <copy todir="${ver.dir}">
268 882 jones
        <fileset dir="."
269
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
270 806 jones
      </copy>
271
      <copy todir="${ver.dir}" file="build.xml"/>
272
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
273
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
274 882 jones
275
      <copy todir="${ver.dir}/docs" filtering="yes">
276
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
277
      </copy>
278
      <copy todir="${ver.dir}/docs" filtering="no">
279
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
280
      </copy>
281 806 jones
      <copy todir="${ver.dir}/docs/dev">
282
        <fileset dir="${build.dir}/docs"/>
283
      </copy>
284 917 berkley
      <copy todir="${ver.dir}/src">
285
        <fileset dir="${build.dir}/src"/>
286
      </copy>
287
288 806 jones
289 882 jones
      <delete file="./${name}-${release}.zip"/>
290
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}"/>
291
      <delete file="./${name}-${release}.tar.gz" />
292
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}"/>
293
      <gzip zipfile="./${name}-${release}.tar.gz"
294
                src="./${name}-${release}.tar"/>
295
      <delete file="./${name}-${release}.tar" />
296 806 jones
  </target>
297
298
  <target name="distsrc" depends="dist">
299
      <mkdir dir="${ver.src}"/>
300
      <copy todir="${ver.src}">
301
        <fileset dir="./src"/>
302
      </copy>
303
304 882 jones
      <delete file="./${name}-src-${release}.zip"/>
305
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
306
      <delete file="./${name}-src-${release}.tar.gz" />
307
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
308
      <gzip zipfile="./${name}-src-${release}.tar.gz"
309
                src="./${name}-src-${release}.tar"/>
310
      <delete file="./${name}-src-${release}.tar" />
311 807 jones
      <delete dir="${dist.dir}"/>
312 806 jones
  </target>
313
314 113 jones
</project>