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-01-04 08:26:09 -0800 (Fri, 04 Jan 2002) $'
11
  *  '$Revision: 889 $'
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
      <property name="name" value="metacat"/>
39
      <property name="Name" value="MetaCat"/>
40
      <property name="release" value="1.0.2"/>
41
      <property name="web-base-url" 
42
                value="http://knb.ecoinformatics.org"/>
43

    
44
      <property name="replication-path" value="/servlet/replication"/>
45
      <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
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
51
      <property name="user" value="metacat_username"/>
52
      <property name="password" value="your_pw_here"/>
53
      <property name="config-dir" value="${installdir}" />
54
      <property name="default-style" value="knb" />
55
      <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
                value=":ext:berkley@cvs.nceas.ucsb.edu:/cvs/pbi" />
60

    
61

    
62
      <filter token="docrooturl" value="./" />
63
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
64
      <filter token="dbDriver" value="${dbDriver}"/>
65
      <filter token="install-dir" value="${installdir}"/>
66
      <filter token="serverhost" value="${serverhost}"/>
67
      <filter token="server" value="${server}"/>
68
      <filter token="replication-log" value="${replication-log}"/>
69
      <filter token="release" value="${release}"/>
70
      <filter token="servlet-path" value="${servlet-path}"/>
71
      <filter token="html-path" value="${html-path}"/>
72
      <filter token="user" value="${user}"/>
73
      <filter token="password" value="${password}"/>
74
      <filter token="image-path" value="${image-path}"/>
75
      <filter token="style-path" value="${style-path}"/>
76
      <filter token="web-base-url" value="${web-base-url}"/>
77
      <filter token="replication-path" value="${replication-path}"/>
78
      <filter token="config-dir" value="${config-dir}"/>
79
      <filter token="default-style" value="${default-style}"/>
80
      <filter token="eml-version" value="${eml-version}"/>
81

    
82
      <property name="srcdir" value="./src" />
83
      <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
      <property name="build.docs" value="${build.dir}/docs"/>
87
      <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
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
91
      <property name="build.img" value="${installdir}/${image-path}"/>
92

    
93
      <property name="dist.dir" value="dist"/>
94
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
95
      <property name="ver.src" value="${ver.dir}/src"/>
96

    
97
      <property name="oracle_home" 
98
                value="/oracle01/app/oracle/product/8.1.6" />
99
      <property name="toolsdir" 
100
                value="/usr/local/devtools" />
101
      <property name="xmlp" 
102
                value="${toolsdir}/OracleXSU111/lib/xmlparserv2.jar" />
103
      <property name="xmlp2" 
104
                value="${toolsdir}/xerces-1_1_3/xerces.jar" />
105
      <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
                value="${toolsdir}/jakarta-tomcat/lib/servlet.jar" />
111
      <property name="srb" 
112
                value="lib/srbrmi" />
113
      <property name="cos" 
114
                value="lib/cos.jar" />
115
      <property name="cpath" 
116
                value="${xmlp2}:${xmlp}:${jdbc}:${jserv}:${jsdk}:${srb}:${cos}"/>
117
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
118

    
119
   </target>
120
   
121
   <target name="prepare" depends="init">
122
      <mkdir dir="${build.dir}"/>
123
      <mkdir dir="${build.src}"/>
124
      <mkdir dir="${build.dest}"/>
125
      <mkdir dir="${build.javadocs}"/>
126

    
127
      <copy todir="${build.src}" filtering="yes">
128
        <fileset dir="${srcdir}">
129
          <include name="edu/**"/>
130
          <include name="com/**"/>
131
          <include name="**/*.sql"/>
132
          <exclude name="**/CVS*"/>
133
          <exclude name="**/.#*"/>
134
        </fileset>
135
      </copy>
136
   </target>
137

    
138
   <target name="compile" depends="prepare">
139
       <javac srcdir="${build.src}" 
140
              destdir="${build.dest}" 
141
              classpath="${cpath}" 
142
              excludes="**/*.sql" /> 
143
       <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
   </target> 
149

    
150
   <target name="jar" depends="compile">
151
       <delete file="${build.dir}/${name}.jar" />
152
       <copy todir="${build.dest}">
153
         <fileset dir="lib/srbrmi"/>
154
       </copy>
155
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
156
            excludes="**/protocols/" />
157
   </target> 
158
 
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

    
165
   <target name="getdtd" depends="prepare">
166
        <cvs cvsRoot="${cvsroot}"
167
             package="${eml-module}"
168
             tag="${eml-tag}"
169
             dest="${build.src}" />
170
       <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
   </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
   <target name="install" depends="jar">
191
       <mkdir dir="${installdir}/WEB-INF/lib" />
192
       <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
       <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
   </target> 
227

    
228
   <target name="clean" depends="init">
229
       <delete dir="${build.dir}" />
230
   </target>
231

    
232
   <target name="jdoc" depends="prepare">
233
       <javadoc packagenames="edu.ucsb.nceas.*"
234
           sourcepath="${build.src}"
235
           destdir="${build.javadocs}"
236
           author="true"
237
           version="true"
238
           use="true"
239
           windowtitle="${Name} API"
240
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
241
           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
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
246
      <mkdir dir="${dist.dir}"/>
247
      <delete dir="${ver.dir}" />
248
      <mkdir dir="${ver.dir}"/>
249
      <copy todir="${ver.dir}">
250
        <fileset dir="." 
251
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
252
      </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

    
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
      <copy todir="${ver.dir}/docs/dev">
264
        <fileset dir="${build.dir}/docs"/>
265
      </copy>
266
       
267
      <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
  </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
      <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
      <delete dir="${dist.dir}"/>
290
  </target> 
291

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