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: tao $'
10
  *      '$Date: 2002-04-19 18:40:22 -0700 (Fri, 19 Apr 2002) $'
11
  *  '$Revision: 1018 $'
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/exp"/>
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="postgresql">
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="/home/tao/tomcat" />
60
      <property name="webapps" value="/home/tao/tomcat/webapps" />
61
      <property name="context" value="tao" />
62
      <property name="user" value="tao"/>
63
      <property name="password" value="your-pw-goes-here"/>
64
      <property name="server" value="epsilon.nceas.ucsb.edu:8443"/>
65
      <property name="systemidserver" value="http://epsilon.nceas.ucsb.edu:8080" />
66
      <property name="datadir" value="data" />
67
      <property name="replication" value="on" />
68
      <property name="replicationdata" value="off" />
69
      <property name="web-base-url" 
70
                value="http://knb.ecoinformatics.org"/>
71
      <property name="default-style" value="knb" />
72

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

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

    
112
      <property name="cpath" 
113
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}"/>
114

    
115
      <filter token="docrooturl" value="./" />
116
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
117
      <filter token="dbDriver" value="${dbDriver}"/>
118
      <filter token="dbAdapter" value="${dbAdapter}"/>
119
      <filter token="install-dir" value="${installdir}"/>
120
      <filter token="server" value="${server}"/>
121
      <filter token="systemidserver" value="${systemidserver}"/>
122
      <filter token="replication-log" value="${replication-log}"/>
123
      <filter token="release" value="${release}"/>
124
      <filter token="servlet-path" value="${servlet-path}"/>
125
      <filter token="html-path" value="${html-path}"/>
126
      <filter token="user" value="${user}"/>
127
      <filter token="password" value="${password}"/>
128
      <filter token="image-path" value="${image-path}"/>
129
      <filter token="style-path" value="${style-path}"/>
130
      <filter token="web-base-url" value="${web-base-url}"/>
131
      <filter token="replication-path" value="${replication-path}"/>
132
      <filter token="config-dir" value="${config-dir}"/>
133
      <filter token="default-style" value="${default-style}"/>
134
      <filter token="eml-version" value="${eml-version}"/>
135
      <filter token="context" value="${context}"/>
136
      <filter token="replication" value="${replication}" />
137
      <filter token="replicationdata" value="${replicationdata}" />
138
      <property name="srcdir" value="./src" />
139
      <property name="junittestsdir" value="./junittests" />
140
      <property name="build.dir" value="./build"/>
141
      <property name="build.src" value="${build.dir}/src"/>
142
      <property name="build.dest" value="${build.dir}/classes"/>
143
      <property name="build.docs" value="${build.dir}/docs"/>
144
      <property name="build.samples" value="${build.dir}/samples"/>
145
      <property name="build.tests" value="${build.dir}/tests"/>
146
      <property name="build.junittests" value="${build.dir}/junittests"/>
147
      <property name="build.data" value="${build.dir}/data"/>
148
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
149
      <property name="build.img" value="${installdir}/${image-path}"/>
150

    
151
      <property name="dist.dir" value="dist"/>
152
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
153
      <property name="ver.src" value="${ver.dir}/src"/>
154

    
155
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
156

    
157
   </target>
158
   
159
   <target name="prepare" depends="init">
160
      <mkdir dir="${build.dir}"/>
161
      <mkdir dir="${build.src}"/>
162
      <mkdir dir="${build.dest}"/>
163
      <mkdir dir="${build.javadocs}"/>
164

    
165
      <copy todir="${build.src}" filtering="yes">
166
        <fileset dir="${srcdir}">
167
          <include name="edu/**"/>
168
          <include name="com/**"/>
169
          <include name="**/*.sql"/>
170
          <exclude name="**/CVS*"/>
171
          <exclude name="**/.#*"/>
172
        </fileset>
173
      </copy>
174
   </target>
175

    
176
   <target name="compile" depends="prepare">
177
       <javac srcdir="${build.src}" 
178
              destdir="${build.dest}" 
179
              classpath="${cpath}" 
180
              excludes="**/*.sql" /> 
181
       <copy file="lib/metacat.properties" 
182
             tofile="${build.dest}/${package.home}/metacat.properties" 
183
             filtering="yes" />
184
       <copy file="lib/srbProps.properties" 
185
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
186
   </target> 
187

    
188
   <target name="jar" depends="compile">
189
       <delete file="${build.dir}/${name}.jar" />
190
       <copy todir="${build.dest}">
191
         <fileset dir="lib/srbrmi"/>
192
       </copy>
193
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
194
            excludes="**/protocols/" />
195
   </target> 
196
 
197
   <target name="protocol" depends="compile">
198
       <delete file="${build.dir}/protocol.jar" />
199
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
200
            includes="**/protocols/" />
201
   </target> 
202

    
203
   <target name="getdtd" depends="prepare">
204
        <cvs cvsRoot="${cvsroot}"
205
             package="${eml-module}"
206
             tag="${eml-tag}"
207
             dest="${build.src}" />
208
       <mkdir dir="lib/dtd" />
209
       <copy todir="lib/dtd" filtering="yes">
210
         <fileset dir="${build.src}/${eml-module}">
211
           <include name="*.dtd"/>
212
         </fileset>
213
         <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
214
       </copy>
215
   </target>
216

    
217
   <target name="dtdsql" depends="prepare">
218
     <echo/>
219
     <echo>Registering the DTDs with the new Metacat instance...</echo>
220
     <sql driver="${dbDriver}"
221
          classpath="${jdbc}"
222
          url="${jdbc-connect}"
223
          userid="${user}"
224
          password="${password}"
225
          src="${build.src}/loaddtd.sql" />
226
   </target>
227

    
228
   <target name="install" depends="jar">
229
       <mkdir dir="${installdir}/${datadir}" />
230
       <chmod dir="${installdir}/${datadir}" perm="ug+w" />
231
       <mkdir dir="${installdir}/WEB-INF/lib" />
232
       <copy file="${build.dir}/${name}.jar" 
233
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
234
       <copy file="${xmlp}" 
235
             tofile="${installdir}/WEB-INF/lib/xerces.jar" />
236
       <copy file="${xalan}" 
237
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
238
       <copy file="${apis}" 
239
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
240
       <copy file="${jdbc}" 
241
             tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
242
       <copy file="${cos}" 
243
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
244
       <copy file="${morpho}"
245
	     tofile="${installdir}/WEB-INF/lib/morpho.jar" />
246
       <copy file="lib/web.xml" 
247
             tofile="${installdir}/WEB-INF/web.xml" />
248
       <copy todir="${build.img}" filtering="no">
249
         <fileset dir="lib">
250
           <include name="**/*.jpg"/>
251
           <include name="**/*.png"/>
252
           <include name="**/*.gif"/>
253
         </fileset>
254
       </copy>
255
       <copy todir="${installdir}" filtering="yes">
256
         <fileset dir="lib">
257
           <exclude name="*.jar"/>
258
           <exclude name="*.properties"/>
259
           <exclude name="web.xml"/>
260
           <exclude name="**/srbrmi*"/>
261
         </fileset>
262
       </copy>
263
       <echo>
264
             ***********************************************************
265
              Remember to register the default DTDs by running the
266
              "${build.src}/loaddtd.sql script". This is most easily
267
              done by using the "ant dtdsql" which will run it for you.
268
             ***********************************************************
269
       </echo>
270
   </target> 
271
   
272
   <target name="test" depends="install">
273
      <!-- copy and compile the tests into a jar file -->
274
      <mkdir dir="${build.junittests}"/>
275
      <copy todir="${build.junittests}" filtering="yes">
276
        <fileset dir="${junittestsdir}">
277
          <exclude name="**/CVS*"/>
278
          <exclude name="**/.#*"/>
279
        </fileset>
280
      </copy>
281
      <javac srcdir="${build.junittests}"
282
             destdir="${build.dest}"
283
             classpath="${cpath}" />
284

    
285
      <jar jarfile="${build.dir}/${name}-junittests.jar" basedir="${build.dest}"
286
           includes="${package.home}/${name}junittests/**" />
287

    
288
      <!-- use the ant "junit" task to run JUnit tests. -->
289
      <junit printsummary="yes" haltonfailure="no" fork="no"
290
             haltonerror="no">
291
        <classpath>
292
          <pathelement path="${cpath}:${build.dir}/${name}-junittests.jar" />
293
        </classpath>
294

    
295
        <formatter type="plain" />
296

    
297
        <batchtest fork="yes" todir="${build.dir}">
298
          <fileset dir="${build.junittests}">
299
            <include name="**/*.java" />
300
          </fileset>
301
        </batchtest>
302
     </junit>
303
   </target>
304
   
305
   <target name="clean" depends="init">
306
       <delete dir="${build.dir}" />
307
   </target>
308

    
309
   <target name="jdoc" depends="prepare">
310
       <javadoc packagenames="edu.ucsb.nceas.*"
311
           sourcepath="${build.src}"
312
           destdir="${build.javadocs}"
313
           author="true"
314
           version="true"
315
           use="true"
316
           windowtitle="${Name} API"
317
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
318
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
319
       />
320
   </target>
321

    
322
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
323
      <mkdir dir="${dist.dir}"/>
324
      <delete dir="${ver.dir}" />
325
      <mkdir dir="${ver.dir}"/>
326
      <copy todir="${ver.dir}">
327
        <fileset dir="." 
328
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
329
      </copy>
330
      <copy todir="${ver.dir}" file="build.xml"/>
331
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
332
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
333

    
334
      <copy todir="${ver.dir}/docs" filtering="yes">
335
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
336
      </copy>
337
      <copy todir="${ver.dir}/docs" filtering="no">
338
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
339
      </copy>
340
      <copy todir="${ver.dir}/docs/dev">
341
        <fileset dir="${build.dir}/docs"/>
342
      </copy>
343
      <copy todir="${ver.dir}/src">
344
        <fileset dir="${build.dir}/src"/>
345
      </copy>
346

    
347
      <delete dir="./${ver.dir}/${build.dir}"/>
348
      <delete dir="./${ver.dir}/dist"/>
349
      <delete file="./${name}-${release}.zip"/>
350
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}"/>
351
      <delete file="./${name}-${release}.tar.gz" />
352
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}"/>
353
      <gzip zipfile="./${name}-${release}.tar.gz" 
354
                src="./${name}-${release}.tar"/>
355
      <delete file="./${name}-${release}.tar" />
356
  </target> 
357

    
358
  <target name="distsrc" depends="dist">
359
      <mkdir dir="${ver.src}"/>
360
      <copy todir="${ver.src}">
361
        <fileset dir="./src"/>
362
      </copy>
363

    
364
      <delete file="./${name}-src-${release}.zip"/>
365
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
366
      <delete file="./${name}-src-${release}.tar.gz" />
367
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
368
      <gzip zipfile="./${name}-src-${release}.tar.gz" 
369
                src="./${name}-src-${release}.tar"/>
370
      <delete file="./${name}-src-${release}.tar" />
371
      <delete dir="${dist.dir}"/>
372
  </target> 
373

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