Project

General

Profile

metacat / build.xml @ 950

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: tao $'
10
  *      '$Date: 2002-02-22 14:46:11 -0800 (Fri, 22 Feb 2002) $'
11
  *  '$Revision: 939 $'
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

    
34
   <target name="oracle">
35
     <!-- Customize these properties if you are using oracle -->
36
     <property name="jdbc-connect"
37
               value="jdbc:oracle:thin:@dev.nceas.ucsb.edu:1521:exp"/>
38
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
39
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
40
     <property name="oracle_home" value="/oracle01/app/oracle/product/8.1.6" />
41
     <property name="jdbc" value="${oracle_home}/jdbc/lib/classes111.zip" />
42
   </target>
43
   
44
   <target name="postgresql">
45
     <!-- Customize these properties if you are using postgres -->
46
     <property name="jdbc-connect" 
47
               value="jdbc:postgresql://localhost/metacat"/>
48
     <property name="dbDriver" value="org.postgresql.Driver"/>
49
     <property name="dbAdapter" 
50
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
51
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
52
   </target>
53
   
54
   <target name="config" depends="oracle">
55
      <!-- Change the 'depends' attribute above to 'postgresql' to install 
56
           metacat with postgres instead of oracle -->
57

    
58
      <!-- Customize these properties for your system -->
59
      <property name="tomcat" value="/usr/local/devtools/jakarta-tomcat" />
60
      <property name="webapps" value="/opt/tomcat/webapps" />
61
      <property name="context" value="tao" />
62
      <property name="user" value="tao"/>
63
      <property name="password" value="tdataint"/>
64
      <property name="server" value="dev.nceas.ucsb.edu"/>
65
      <property name="web-base-url" 
66
                value="http://knb.ecoinformatics.org"/>
67
      <property name="default-style" value="knb" />
68

    
69
      <!-- Make sure these paths match the location of the jar files
70
           on your system, the defaults should usually work -->
71
      <property name="jsdk" 
72
                value="${tomcat}/lib/common/servlet.jar" />
73
      <property name="xmlp" 
74
                value="lib/xerces.jar" />
75
      <property name="srb" 
76
                value="lib/srbrmi" />
77
      <property name="cos" 
78
                value="lib/cos.jar" />
79
      <property name="morpho"
80
                value="lib/morpho.jar" />
81
      <property name="xalan"
82
                value="lib/xalan/xalan.jar" />
83
      <property name="apis"
84
                value="lib/xalan/xml-apis.jar" />
85
   </target>
86

    
87
   <target name="init" depends="config">
88
      <!-- It is less likely you'll need to make any changes from here down,
89
           but customization is possible -->
90
      <property name="installdir" value="${webapps}/${context}" />
91
      <property name="name" value="metacat"/>
92
      <property name="Name" value="MetaCat"/>
93
      <property name="release" value="1.0.3"/>
94
      <property name="replication-path" 
95
                value="/${context}/servlet/replication"/>
96
      <property name="servlet-path" value="/${context}/servlet/metacat"/>
97
      <property name="html-path" value="/${context}"/>
98
      <property name="image-path" value="/img/${context}" />
99
      <property name="style-path" value="/${context}/style"/>
100
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
101
      <property name="config-dir" value="${installdir}" />
102
      <property name="eml-module" value="eml" />
103
      <property name="eml-version" value="2.0.0beta6" />
104
      <property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6" />
105
      <property name="cvsroot" 
106
                value=":ext:tao@cvs.ecoinformatics.org:/cvs" />
107

    
108
      <property name="cpath" 
109
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}"/>
110

    
111
      <filter token="docrooturl" value="./" />
112
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
113
      <filter token="dbDriver" value="${dbDriver}"/>
114
      <filter token="dbAdapter" value="${dbAdapter}"/>
115
      <filter token="install-dir" value="${installdir}"/>
116
      <filter token="server" value="${server}"/>
117
      <filter token="replication-log" value="${replication-log}"/>
118
      <filter token="release" value="${release}"/>
119
      <filter token="servlet-path" value="${servlet-path}"/>
120
      <filter token="html-path" value="${html-path}"/>
121
      <filter token="user" value="${user}"/>
122
      <filter token="password" value="${password}"/>
123
      <filter token="image-path" value="${image-path}"/>
124
      <filter token="style-path" value="${style-path}"/>
125
      <filter token="web-base-url" value="${web-base-url}"/>
126
      <filter token="replication-path" value="${replication-path}"/>
127
      <filter token="config-dir" value="${config-dir}"/>
128
      <filter token="default-style" value="${default-style}"/>
129
      <filter token="eml-version" value="${eml-version}"/>
130

    
131
      <property name="srcdir" value="./src" />
132
      <property name="build.dir" value="./build"/>
133
      <property name="build.src" value="${build.dir}/src"/>
134
      <property name="build.dest" value="${build.dir}/classes"/>
135
      <property name="build.docs" value="${build.dir}/docs"/>
136
      <property name="build.samples" value="${build.dir}/samples"/>
137
      <property name="build.tests" value="${build.dir}/tests"/>
138
      <property name="build.data" value="${build.dir}/data"/>
139
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
140
      <property name="build.img" value="${installdir}/${image-path}"/>
141

    
142
      <property name="dist.dir" value="dist"/>
143
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
144
      <property name="ver.src" value="${ver.dir}/src"/>
145

    
146
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
147

    
148
   </target>
149
   
150
   <target name="prepare" depends="init">
151
      <mkdir dir="${build.dir}"/>
152
      <mkdir dir="${build.src}"/>
153
      <mkdir dir="${build.dest}"/>
154
      <mkdir dir="${build.javadocs}"/>
155

    
156
      <copy todir="${build.src}" filtering="yes">
157
        <fileset dir="${srcdir}">
158
          <include name="edu/**"/>
159
          <include name="com/**"/>
160
          <include name="**/*.sql"/>
161
          <exclude name="**/CVS*"/>
162
          <exclude name="**/.#*"/>
163
        </fileset>
164
      </copy>
165
   </target>
166

    
167
   <target name="compile" depends="prepare">
168
       <javac srcdir="${build.src}" 
169
              destdir="${build.dest}" 
170
              classpath="${cpath}" 
171
              excludes="**/*.sql" /> 
172
       <copy file="lib/metacat.properties" 
173
             tofile="${build.dest}/${package.home}/metacat.properties" 
174
             filtering="yes" />
175
       <copy file="lib/srbProps.properties" 
176
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
177
   </target> 
178

    
179
   <target name="jar" depends="compile">
180
       <delete file="${build.dir}/${name}.jar" />
181
       <copy todir="${build.dest}">
182
         <fileset dir="lib/srbrmi"/>
183
       </copy>
184
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
185
            excludes="**/protocols/" />
186
   </target> 
187
 
188
   <target name="protocol" depends="compile">
189
       <delete file="${build.dir}/protocol.jar" />
190
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
191
            includes="**/protocols/" />
192
   </target> 
193

    
194
   <target name="getdtd" depends="prepare">
195
        <cvs cvsRoot="${cvsroot}"
196
             package="${eml-module}"
197
             tag="${eml-tag}"
198
             dest="${build.src}" />
199
       <mkdir dir="lib/dtd" />
200
       <copy todir="lib/dtd" filtering="yes">
201
         <fileset dir="${build.src}/${eml-module}">
202
           <include name="*.dtd"/>
203
         </fileset>
204
         <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
205
       </copy>
206
   </target>
207

    
208
   <target name="dtdsql" depends="prepare">
209
     <echo/>
210
     <echo>Registering the DTDs with the new Metacat instance...</echo>
211
     <sql driver="${dbDriver}"
212
          classpath="${jdbc}"
213
          url="${jdbc-connect}"
214
          userid="${user}"
215
          password="${password}"
216
          src="${build.src}/loaddtd.sql" />
217
   </target>
218

    
219
   <target name="install" depends="jar">
220
       <mkdir dir="${installdir}/WEB-INF/lib" />
221
       <copy file="${build.dir}/${name}.jar" 
222
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
223
       <copy file="${xmlp}" 
224
             tofile="${installdir}/WEB-INF/lib/xerces.jar" />
225
       <copy file="${xalan}" 
226
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
227
       <copy file="${apis}" 
228
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
229
       <copy file="${jdbc}" 
230
             tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
231
       <copy file="${cos}" 
232
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
233
       <copy file="${morpho}"
234
             tofile="${installdir}/WEB-INF/lib/morpho.jar" />
235
       <copy file="lib/web.xml" 
236
             tofile="${installdir}/WEB-INF/web.xml" />
237
       <copy todir="${build.img}" filtering="no">
238
         <fileset dir="lib">
239
           <include name="**/*.jpg"/>
240
           <include name="**/*.png"/>
241
           <include name="**/*.gif"/>
242
         </fileset>
243
       </copy>
244
       <copy todir="${installdir}" filtering="yes">
245
         <fileset dir="lib">
246
           <exclude name="*.jar"/>
247
           <exclude name="*.properties"/>
248
           <exclude name="web.xml"/>
249
           <exclude name="**/srbrmi*"/>
250
         </fileset>
251
       </copy>
252
       <echo>
253
             ***********************************************************
254
              Remember to register the default DTDs by running the
255
              "${build.src}/loaddtd.sql script". This is most easily
256
              done by using the "ant dtdsql" which will run it for you.
257
             ***********************************************************
258
       </echo>
259
   </target> 
260

    
261
   <target name="clean" depends="init">
262
       <delete dir="${build.dir}" />
263
   </target>
264

    
265
   <target name="jdoc" depends="prepare">
266
       <javadoc packagenames="edu.ucsb.nceas.*"
267
           sourcepath="${build.src}"
268
           destdir="${build.javadocs}"
269
           author="true"
270
           version="true"
271
           use="true"
272
           windowtitle="${Name} API"
273
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
274
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
275
       />
276
   </target>
277

    
278
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
279
      <mkdir dir="${dist.dir}"/>
280
      <delete dir="${ver.dir}" />
281
      <mkdir dir="${ver.dir}"/>
282
      <copy todir="${ver.dir}">
283
        <fileset dir="." 
284
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
285
      </copy>
286
      <copy todir="${ver.dir}" file="build.xml"/>
287
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
288
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
289

    
290
      <copy todir="${ver.dir}/docs" filtering="yes">
291
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
292
      </copy>
293
      <copy todir="${ver.dir}/docs" filtering="no">
294
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
295
      </copy>
296
      <copy todir="${ver.dir}/docs/dev">
297
        <fileset dir="${build.dir}/docs"/>
298
      </copy>
299
      <copy todir="${ver.dir}/src">
300
        <fileset dir="${build.dir}/src"/>
301
      </copy>
302

    
303
       
304
      <delete file="./${name}-${release}.zip"/>
305
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}"/>
306
      <delete file="./${name}-${release}.tar.gz" />
307
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}"/>
308
      <gzip zipfile="./${name}-${release}.tar.gz" 
309
                src="./${name}-${release}.tar"/>
310
      <delete file="./${name}-${release}.tar" />
311
  </target> 
312

    
313
  <target name="distsrc" depends="dist">
314
      <mkdir dir="${ver.src}"/>
315
      <copy todir="${ver.src}">
316
        <fileset dir="./src"/>
317
      </copy>
318

    
319
      <delete file="./${name}-src-${release}.zip"/>
320
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
321
      <delete file="./${name}-src-${release}.tar.gz" />
322
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
323
      <gzip zipfile="./${name}-src-${release}.tar.gz" 
324
                src="./${name}-src-${release}.tar"/>
325
      <delete file="./${name}-src-${release}.tar" />
326
      <delete dir="${dist.dir}"/>
327
  </target> 
328

    
329
</project>