Project

General

Profile

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