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-08-16 08:54:27 -0700 (Fri, 16 Aug 2002) $'
11
  *    '$Revision: 1296 $'
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="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="your-pw-goes-here"/>
64
      <property name="server" value="pine.nceas.ucsb.edu:8443"/>
65
      <property name="systemidserver" value="http://pine.nceas.ucsb.edu:8080" />
66
      <property name="datafilepath" value="/usr/local/devtools/jakarta-tomcat/data/tao/data" />
67
      <property name="debuglevel" value="50" />
68
      <property name="forcereplicationwaitingtime" value="30000"/>
69
      <property name="web-base-url" 
70
                value="http://knb.ecoinformatics.org"/>
71
      <property name="default-style" value="knb" />
72
      <property name="morphosourcedir" value="morpho" />
73

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

    
95
  </target>
96

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

    
118
      <property name="cpath" 
119
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}"/>
120

    
121
      <filter token="docrooturl" value="./" />
122
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
123
      <filter token="dbDriver" value="${dbDriver}"/>
124
      <filter token="dbAdapter" value="${dbAdapter}"/>
125
      <filter token="install-dir" value="${installdir}"/>
126
      <filter token="server" value="${server}"/>
127
      <filter token="systemidserver" value="${systemidserver}"/>
128
      <filter token="replication-log" value="${replication-log}"/>
129
      <filter token="release" value="${release}"/>
130
      <filter token="servlet-path" value="${servlet-path}"/>
131
      <filter token="html-path" value="${html-path}"/>
132
      <filter token="user" value="${user}"/>
133
      <filter token="password" value="${password}"/>
134
      <filter token="image-path" value="${image-path}"/>
135
      <filter token="style-path" value="${style-path}"/>
136
      <filter token="web-base-url" value="${web-base-url}"/>
137
      <filter token="replication-path" value="${replication-path}"/>
138
      <filter token="config-dir" value="${config-dir}"/>
139
      <filter token="default-style" value="${default-style}"/>
140
      <filter token="eml-version" value="${eml-version}"/>
141
      <filter token="context" value="${context}"/>
142
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
143
      <filter token="debuglevel" value="${debuglevel}" />
144
      <filter token="datafilepath" value="${datafilepath}" />
145
      <property name="srcdir" value="./src" />
146
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
147
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
148
      <property name="build.dir" value="./build"/>
149
      <property name="build.src" value="${build.dir}/src"/>
150
      <property name="build.dest" value="${build.dir}/classes"/>
151
      <property name="build.docs" value="${build.dir}/docs"/>
152
      <property name="build.samples" value="${build.dir}/samples"/>
153
      <property name="build.tests" value="${build.dir}/tests"/>
154
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
155
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
156
      <property name="build.data" value="${build.dir}/data"/>
157
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
158
      <property name="build.img" value="${installdir}/${image-path}"/>
159

    
160
      <property name="dist.dir" value="dist"/>
161
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
162
      <property name="ver.src" value="${ver.dir}/src"/>
163

    
164
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
165

    
166
   </target>
167
   
168
   <target name="prepare" depends="init">
169
      <mkdir dir="${build.dir}"/>
170
      <mkdir dir="${build.src}"/>
171
      <mkdir dir="${build.dest}"/>
172
      <mkdir dir="${build.javadocs}"/>
173

    
174
      <copy todir="${build.src}" filtering="yes">
175
        <fileset dir="${srcdir}">
176
          <include name="edu/**"/>
177
          <include name="com/**"/>
178
          <include name="**/*.sql"/>
179
          <exclude name="**/CVS*"/>
180
          <exclude name="**/.#*"/>
181
        </fileset>
182
      </copy>
183
   </target>
184

    
185
   <target name="compile" depends="prepare">
186
       <javac srcdir="${build.src}" 
187
              destdir="${build.dest}" 
188
              classpath="${cpath}" 
189
              excludes="**/*.sql" /> 
190
       <copy file="lib/metacat.properties" 
191
             tofile="${build.dest}/${package.home}/metacat.properties" 
192
             filtering="yes" />
193
       <copy file="lib/srbProps.properties" 
194
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
195
   </target> 
196

    
197
   <target name="jar" depends="compile">
198
       <delete file="${build.dir}/${name}.jar" />
199
       <copy todir="${build.dest}">
200
         <fileset dir="lib/srbrmi"/>
201
       </copy>
202
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
203
            excludes="**/protocols/" />
204
   </target> 
205
 
206
   <target name="protocol" depends="compile">
207
       <delete file="${build.dir}/protocol.jar" />
208
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
209
            includes="**/protocols/" />
210
   </target> 
211

    
212
   <target name="getdtd" depends="prepare">
213
        <cvs cvsRoot="${cvsroot}"
214
             package="${eml-module}"
215
             tag="${eml-tag}"
216
             dest="${build.src}" />
217
       <mkdir dir="lib/dtd" />
218
       <copy todir="lib/dtd" filtering="yes">
219
         <fileset dir="${build.src}/${eml-module}">
220
           <include name="*.dtd"/>
221
         </fileset>
222
         <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
223
       </copy>
224
       <copy todir="lib/style" filtering="yes">
225
         <fileset dir="${build.src}/${eml-module}/style">
226
	    <include name="*.xsl"/>
227
	 </fileset>
228
       </copy>
229
   </target>
230

    
231
   <target name="dtdsql" depends="prepare">
232
     <echo/>
233
     <echo>Registering the DTDs with the new Metacat instance...</echo>
234
     <sql driver="${dbDriver}"
235
          classpath="${jdbc}"
236
          url="${jdbc-connect}"
237
          userid="${user}"
238
          password="${password}"
239
          src="${build.src}/loaddtd.sql" />
240
   </target>
241

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

    
294
      <jar jarfile="${build.dir}/${name}-junittests.jar" 
295
		    basedir="${build.metacattest}"
296
          	    includes="**/*.class" />
297

    
298
      <!-- use the ant "junit" task to run JUnit tests. -->
299
      <junit printsummary="yes" haltonfailure="no" fork="no"
300
             haltonerror="no">
301
        <classpath>
302
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
303
        </classpath>
304

    
305
        <formatter type="plain" />
306

    
307
        <batchtest fork="yes" todir="${build.dir}">
308
          <fileset dir="${build.metacattest}">
309
            <include name="**/*.class" />
310
          </fileset>
311
        </batchtest>
312
     </junit>
313
   </target>
314

    
315
  <target name="gethttpclient" depends="prepare">
316
	<!--mkdir dir="${morphosourcedir}" -->
317
        <cvs cvsRoot=":ext:tao@cvs.ecoinformatics.org:/cvs"
318
             package="morpho"
319
             dest="." />
320
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
321
   </target>
322

    
323
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
324
   <target name="nettest" depends="install">
325
      <echo>***********************************
326
	    Please run ant gethttpclient first!
327
	    ***********************************
328
      </echo>
329
      <!-- copy and compile the tests into a jar file -->
330
      <mkdir dir="${build.metacatnettest}"/>
331
      <javac srcdir="${junitnettestsdir}"
332
             destdir="${build.metacatnettest}"
333
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
334
             includes="**/*.java" />
335

    
336
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
337
                    basedir="${build.metacatnettest}"
338
                    includes="**/*.class" />
339

    
340
      <!-- use the ant "junit" task to run JUnit tests. -->
341
      <junit printsummary="yes" haltonfailure="no" fork="yes"
342
             haltonerror="no">
343
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
344
        <classpath>
345
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itis}" />
346
        </classpath>
347

    
348
        <formatter type="plain" />
349

    
350
        <batchtest fork="yes" todir="${build.dir}">
351
          <fileset dir="${build.metacatnettest}">
352
            <include name="**/*.class" />
353
          </fileset>
354
        </batchtest>
355
     </junit>
356
   </target>   
357

    
358
   <target name="clean" depends="init">
359
       <delete dir="${build.dir}" />
360
   </target>
361

    
362
   <target name="jdoc" depends="prepare">
363
       <javadoc packagenames="edu.ucsb.nceas.*"
364
           sourcepath="${build.src}"
365
           destdir="${build.javadocs}"
366
           author="true"
367
           version="true"
368
           use="true"
369
           windowtitle="${Name} API"
370
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
371
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
372
       />
373
   </target>
374

    
375
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
376
      <mkdir dir="${dist.dir}"/>
377
      <delete dir="${ver.dir}" />
378
      <mkdir dir="${ver.dir}"/>
379
      <copy todir="${ver.dir}">
380
        <fileset dir="." 
381
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
382
      </copy>
383
      <copy todir="${ver.dir}" file="build.xml"/>
384
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
385
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
386

    
387
      <copy todir="${ver.dir}/docs" filtering="yes">
388
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
389
      </copy>
390
      <copy todir="${ver.dir}/docs" filtering="no">
391
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
392
      </copy>
393
      <copy todir="${ver.dir}/docs/dev">
394
        <fileset dir="${build.dir}/docs"/>
395
      </copy>
396
      <copy todir="${ver.dir}/src">
397
        <fileset dir="${build.dir}/src"/>
398
      </copy>
399

    
400
      <delete dir="./${ver.dir}/${build.dir}"/>
401
      <delete dir="./${ver.dir}/dist"/>
402
      <delete file="./${name}-${release}.zip"/>
403
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}"/>
404
      <delete file="./${name}-${release}.tar.gz" />
405
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}"/>
406
      <gzip zipfile="./${name}-${release}.tar.gz" 
407
                src="./${name}-${release}.tar"/>
408
      <delete file="./${name}-${release}.tar" />
409
  </target> 
410

    
411
  <target name="distsrc" depends="dist">
412
      <mkdir dir="${ver.src}"/>
413
      <copy todir="${ver.src}">
414
        <fileset dir="./src"/>
415
      </copy>
416

    
417
      <delete file="./${name}-src-${release}.zip"/>
418
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
419
      <delete file="./${name}-src-${release}.tar.gz" />
420
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
421
      <gzip zipfile="./${name}-src-${release}.tar.gz" 
422
                src="./${name}-src-${release}.tar"/>
423
      <delete file="./${name}-src-${release}.tar" />
424
      <delete dir="${dist.dir}"/>
425
  </target> 
426

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