Project

General

Profile

1
<?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: berkley $'
10
  *      '$Date: 2002-02-05 09:10:15 -0800 (Tue, 05 Feb 2002) $'
11
  *  '$Revision: 926 $'
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="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
     <property name="password" value=""/>
41
   </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
      <property name="name" value="metacat"/>
57
      <property name="Name" value="MetaCat"/>
58
      <property name="release" value="1.0.3"/>
59
      <property name="web-base-url" 
60
                value="http://knb.ecoinformatics.org"/>
61

    
62
      <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
      <property name="server" value="dev.nceas.ucsb.edu"/>
68
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
69
      <property name="config-dir" value="${installdir}" />
70
      <property name="default-style" value="knb" />
71
      <property name="eml-module" value="eml" />
72
      <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
                value=":ext:berkley@cvs.ecoinformatics.org:/cvs" />
76

    
77

    
78
      <filter token="docrooturl" value="./" />
79
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
80
      <filter token="dbDriver" value="${dbDriver}"/>
81
      <filter token="dbAdapter" value="${dbAdapter}"/>
82
      <filter token="install-dir" value="${installdir}"/>
83
      <filter token="serverhost" value="${serverhost}"/>
84
      <filter token="server" value="${server}"/>
85
      <filter token="replication-log" value="${replication-log}"/>
86
      <filter token="release" value="${release}"/>
87
      <filter token="servlet-path" value="${servlet-path}"/>
88
      <filter token="html-path" value="${html-path}"/>
89
      <filter token="user" value="${user}"/>
90
      <filter token="password" value="${password}"/>
91
      <filter token="image-path" value="${image-path}"/>
92
      <filter token="style-path" value="${style-path}"/>
93
      <filter token="web-base-url" value="${web-base-url}"/>
94
      <filter token="replication-path" value="${replication-path}"/>
95
      <filter token="config-dir" value="${config-dir}"/>
96
      <filter token="default-style" value="${default-style}"/>
97
      <filter token="eml-version" value="${eml-version}"/>
98

    
99
      <property name="srcdir" value="./src" />
100
      <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
      <property name="build.docs" value="${build.dir}/docs"/>
104
      <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
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
108
      <property name="build.img" value="${installdir}/${image-path}"/>
109

    
110
      <property name="dist.dir" value="dist"/>
111
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
112
      <property name="ver.src" value="${ver.dir}/src"/>
113

    
114
      
115
      <property name="toolsdir" 
116
                value="/usr/local/devtools" />
117
      <property name="xmlp2" 
118
                value="${toolsdir}/xerces-1_1_3/xerces.jar" />
119
      <property name="jserv" 
120
                value="/usr/lib/apache/ApacheJServ.jar" />
121
      <property name="jsdk" 
122
                value="${toolsdir}/jakarta-tomcat/lib/common/servlet.jar" />
123
      <property name="srb" 
124
                value="lib/srbrmi" />
125
      <property name="cos" 
126
                value="lib/cos.jar" />
127
      <property name="xalan"
128
                value="lib/xalan/xalan.jar" />
129
      <property name="xalanxml-apis"
130
                value="lib/xalan/xml-apis.jar" />
131
      <property name="cpath" 
132
                value="${xmlp2}:${xalan}:${xalanxml-apis}:${jdbc}:${jserv}:${jsdk}:${srb}:${cos}"/>
133
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
134

    
135
   </target>
136
   
137
   <target name="prepare" depends="init">
138
      <mkdir dir="${build.dir}"/>
139
      <mkdir dir="${build.src}"/>
140
      <mkdir dir="${build.dest}"/>
141
      <mkdir dir="${build.javadocs}"/>
142

    
143
      <copy todir="${build.src}" filtering="yes">
144
        <fileset dir="${srcdir}">
145
          <include name="edu/**"/>
146
          <include name="com/**"/>
147
          <include name="**/*.sql"/>
148
          <exclude name="**/CVS*"/>
149
          <exclude name="**/.#*"/>
150
        </fileset>
151
      </copy>
152
   </target>
153

    
154
   <target name="compile" depends="prepare">
155
       <javac srcdir="${build.src}" 
156
              destdir="${build.dest}" 
157
              classpath="${cpath}" 
158
              excludes="**/*.sql" /> 
159
       <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
   </target> 
165

    
166
   <target name="jar" depends="compile">
167
       <delete file="${build.dir}/${name}.jar" />
168
       <copy todir="${build.dest}">
169
         <fileset dir="lib/srbrmi"/>
170
       </copy>
171
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
172
            excludes="**/protocols/" />
173
   </target> 
174
 
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

    
181
   <target name="getdtd" depends="prepare">
182
        <cvs cvsRoot="${cvsroot}"
183
             package="${eml-module}"
184
             tag="${eml-tag}"
185
             dest="${build.src}" />
186
       <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
   </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
   <target name="install" depends="jar">
207
       <mkdir dir="${installdir}/WEB-INF/lib" />
208
       <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
       <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
       <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
       <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
   </target> 
245

    
246
   <target name="clean" depends="init">
247
       <delete dir="${build.dir}" />
248
   </target>
249

    
250
   <target name="jdoc" depends="prepare">
251
       <javadoc packagenames="edu.ucsb.nceas.*"
252
           sourcepath="${build.src}"
253
           destdir="${build.javadocs}"
254
           author="true"
255
           version="true"
256
           use="true"
257
           windowtitle="${Name} API"
258
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
259
           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
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
264
      <mkdir dir="${dist.dir}"/>
265
      <delete dir="${ver.dir}" />
266
      <mkdir dir="${ver.dir}"/>
267
      <copy todir="${ver.dir}">
268
        <fileset dir="." 
269
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
270
      </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

    
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
      <copy todir="${ver.dir}/docs/dev">
282
        <fileset dir="${build.dir}/docs"/>
283
      </copy>
284
      <copy todir="${ver.dir}/src">
285
        <fileset dir="${build.dir}/src"/>
286
      </copy>
287

    
288
       
289
      <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
  </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
      <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
      <delete dir="${dist.dir}"/>
312
  </target> 
313

    
314
</project>
(4-4/4)