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