Project

General

Profile

metacat / build.xml @ 882

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: jones $'
10
  *      '$Date: 2001-12-18 12:27:52 -0800 (Tue, 18 Dec 2001) $'
11
  *  '$Revision: 882 $'
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="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
37
      <property name="installdir" value="/opt/tomcat/webapps/jones" />
38
      <property name="name" value="metacat"/>
39
      <property name="Name" value="MetaCat"/>
40
      <property name="release" value="1.0.1"/>
41
      <property name="web-base-url" 
42
                value="http://knb.ecoinformatics.org"/>
43
      <property name="replication-path" value="/jones/servlet/replication"/>
44
      <property name="servlet-path" value="/jones/servlet/metacat"/>
45
      <property name="html-path" value="/jones"/>
46
      <property name="image-path" value="/img/jones" />
47
      <property name="style-path" value="/jones/style"/>
48
      <property name="serverhost" value="dev.nceas.ucsb.edu"/>
49
      <property name="server" value="http://${serverhost}"/>
50
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
51
      <property name="user" value="jones"/>
52
      <property name="password" value="your-pw-goes-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:jones@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="/opt/httpd/html${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="instdtd">
180
       <mkdir dir="${installdir}/dtd" />
181
       <copy todir="${installdir}/dtd" filtering="yes">
182
         <fileset dir="lib/dtd">
183
           <include name="*.dtd"/>
184
         </fileset>
185
       </copy>
186
   </target> 
187

    
188
   <target name="dtdsql" depends="prepare">
189
     <echo/>
190
     <echo>Registering the DTDs with the new Metacat instance...</echo>
191
     <sql driver="${dbDriver}"
192
          classpath="${jdbc}"
193
          url="${jdbc-connect}"
194
          userid="${user}"
195
          password="${password}"
196
          src="${build.src}/loaddtd.sql" />
197
   </target>
198

    
199
   <target name="install" depends="jar">
200
       <mkdir dir="${installdir}/WEB-INF/lib" />
201
       <copy file="${build.dir}/${name}.jar" 
202
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
203
       <copy file="${xmlp2}" 
204
             tofile="${installdir}/WEB-INF/lib/xerces.jar" />
205
       <copy file="${xmlp}" 
206
             tofile="${installdir}/WEB-INF/lib/xmlparserv2.jar" />
207
       <copy file="${jdbc}" 
208
             tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
209
       <copy file="${cos}" 
210
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
211
       <copy file="lib/web.xml" 
212
             tofile="${installdir}/WEB-INF/web.xml" />
213
       <copy todir="${build.img}" filtering="no">
214
         <fileset dir="lib">
215
           <include name="**/*.jpg"/>
216
           <include name="**/*.png"/>
217
           <include name="**/*.gif"/>
218
         </fileset>
219
       </copy>
220
       <copy todir="${installdir}" filtering="yes">
221
         <fileset dir="lib">
222
           <exclude name="*.jar"/>
223
           <exclude name="*.properties"/>
224
           <exclude name="web.xml"/>
225
           <exclude name="**/srbrmi*"/>
226
         </fileset>
227
       </copy>
228
       <mkdir dir="${installdir}/dtd" />
229
       <echo>
230
             ***********************************************************
231
              Remember to copy the appropriate DTD
232
              files to the installation dtd directory. If you have cvs
233
              access this can be done using "ant instdtd".
234

    
235
              Remember to register the default DTDs by running the
236
              "${build.src}/loaddtd.sql script". This is most easily
237
              done by using the "ant dtdsql" which will run it for you.
238
             ***********************************************************
239
       </echo>
240
   </target> 
241

    
242
   <target name="clean" depends="init">
243
       <delete dir="${build.dir}" />
244
   </target>
245

    
246
   <target name="jdoc" depends="prepare">
247
       <javadoc packagenames="edu.ucsb.nceas.*"
248
           sourcepath="${build.src}"
249
           destdir="${build.javadocs}"
250
           author="true"
251
           version="true"
252
           use="true"
253
           windowtitle="${Name} API"
254
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
255
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
256
       />
257
   </target>
258

    
259
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
260
      <mkdir dir="${dist.dir}"/>
261
      <delete dir="${ver.dir}" />
262
      <mkdir dir="${ver.dir}"/>
263
      <copy todir="${ver.dir}">
264
        <fileset dir="." 
265
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
266
      </copy>
267
      <copy todir="${ver.dir}" file="build.xml"/>
268
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
269
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
270

    
271
      <copy todir="${ver.dir}/docs" filtering="yes">
272
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
273
      </copy>
274
      <copy todir="${ver.dir}/docs" filtering="no">
275
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
276
      </copy>
277
      <copy todir="${ver.dir}/docs/dev">
278
        <fileset dir="${build.dir}/docs"/>
279
      </copy>
280
       
281
      <delete file="./${name}-${release}.zip"/>
282
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}"/>
283
      <delete file="./${name}-${release}.tar.gz" />
284
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}"/>
285
      <gzip zipfile="./${name}-${release}.tar.gz" 
286
                src="./${name}-${release}.tar"/>
287
      <delete file="./${name}-${release}.tar" />
288
  </target> 
289

    
290
  <target name="distsrc" depends="dist">
291
      <mkdir dir="${ver.src}"/>
292
      <copy todir="${ver.src}">
293
        <fileset dir="./src"/>
294
      </copy>
295

    
296
      <delete file="./${name}-src-${release}.zip"/>
297
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
298
      <delete file="./${name}-src-${release}.tar.gz" />
299
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
300
      <gzip zipfile="./${name}-src-${release}.tar.gz" 
301
                src="./${name}-src-${release}.tar"/>
302
      <delete file="./${name}-src-${release}.tar" />
303
      <delete dir="${dist.dir}"/>
304
  </target> 
305

    
306
</project>