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