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: 2003-04-22 09:58:06 -0700 (Tue, 22 Apr 2003) $'
11
  *    '$Revision: 1602 $'
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="/usr/share/pgsql/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="/usr/local/devtools/jakarta-tomcat" />
60
      <property name="webapps" value="/usr/local/devtools/jakarta-tomcat/webapps" />
61
      <property name="context" value="tao" />
62
      <property name="user" value="tao"/>
63
      <property name="password" value=""/>
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="inlinedatafilepath" value="/usr/local/devtools/jakarta-tomcat/data/tao/inlinedata" />
68
      <property name="debuglevel" value="45" />
69
      <property name="forcereplicationwaitingtime" value="30000"/>
70
      <property name="cvsroot"
71
                value=":ext:tao@cvs.ecoinformatics.org:/cvs" />
72
      <property name="web-base-url"
73
                value="http://knb.ecoinformatics.org"/>
74
      <property name="default-style" value="knb" />
75
      <property name="morphosourcedir" value="../morpho" />
76
      <property name="defaultcontenttype" value="application/octet-stream" />
77

    
78
      <!-- Make sure these paths match the location of the jar files
79
           on your system, the defaults should usually work -->
80
      <property name="jsdk"
81
                value="${tomcat}/lib/common/servlet.jar" />
82
      <property name="xmlp"
83
                value="lib/xercesImpl.jar" />
84
      <property name="srb"
85
                value="lib/srbrmi" />
86
      <property name="cos"
87
                value="lib/cos.jar" />
88
      <property name="morpho"
89
                value="lib/morpho.jar" />
90
      <property name="xalan"
91
                value="lib/xalan/xalan.jar" />
92
      <property name="apis"
93
                value="lib/xalan/xml-apis.jar" />
94
      <property name="httpclient"
95
                value="${morphosourcedir}/lib/httpclient.jar" />
96
      <property name="itis"
97
                value="${morphosourcedir}/lib/itislib.jar" />
98
      <property name="emlparser"
99
                value="lib/eml.jar" />
100
      <property name="configxml"
101
                value="lib/configxml.jar" />
102
      <property name="itislib"
103
                value="lib/itislib.jar" />
104
      <property name="httpclientjar"
105
                value="lib/httpclient.jar" />
106

    
107
      <property name="emlparser"
108
                value="lib/eml.jar" />
109
  </target>
110

    
111
   <target name="init" depends="config">
112
      <!-- It is less likely you'll need to make any changes from here down,
113
           but customization is possible -->
114
      <property name="installdir" value="${webapps}/${context}" />
115
      <property name="name" value="metacat"/>
116
      <property name="Name" value="MetaCat"/>
117
      <property name="debugprefix" value="${Name}:"/>
118
      <property name="release" value="1.2.1"/>
119
      <property name="replication-path"
120
                value="/${context}/servlet/replication"/>
121
      <property name="servlet-path" value="/${context}/servlet/metacat"/>
122
      <property name="html-path" value="/${context}"/>
123
      <property name="image-path" value="/${context}" />
124
      <property name="style-path" value="/${context}/style"/>
125
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
126
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
127
      <property name="config-dir" value="${installdir}" />
128
      <property name="eml-module" value="eml" />
129
      <property name="eml-version" value="2.0.0beta6" />
130
      <property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6_REV1" />
131
      <property name="eml2-tag" value="XALAN_STYLESHEET_CHANGES" />
132
      <property name="eml2namespace" value="eml://ecoinformatics.org/eml-2.0.0" />
133

    
134
      <property name="cpath"
135
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}:${emlparser}:${httpclientjar}"/>
136

    
137
      <filter token="docrooturl" value="./" />
138
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
139
      <filter token="dbDriver" value="${dbDriver}"/>
140
      <filter token="dbAdapter" value="${dbAdapter}"/>
141
      <filter token="install-dir" value="${installdir}"/>
142
      <filter token="server" value="${server}"/>
143
      <filter token="systemidserver" value="${systemidserver}"/>
144
      <filter token="replication-log" value="${replication-log}"/>
145
      <filter token="replicationerrorlog" value="${replicationerrorlog}"/>
146
      <filter token="release" value="${release}"/>
147
      <filter token="servlet-path" value="${servlet-path}"/>
148
      <filter token="html-path" value="${html-path}"/>
149
      <filter token="user" value="${user}"/>
150
      <filter token="password" value="${password}"/>
151
      <filter token="image-path" value="${image-path}"/>
152
      <filter token="style-path" value="${style-path}"/>
153
      <filter token="web-base-url" value="${web-base-url}"/>
154
      <filter token="replication-path" value="${replication-path}"/>
155
      <filter token="config-dir" value="${config-dir}"/>
156
      <filter token="default-style" value="${default-style}"/>
157
      <filter token="eml-version" value="${eml-version}"/>
158
      <filter token="eml2namespace" value="${eml2namespace}"/>
159
      <filter token="context" value="${context}"/>
160
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
161
      <filter token="debuglevel" value="${debuglevel}" />
162
      <filter token="datafilepath" value="${datafilepath}" />
163
      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
164
      <filter token="defaultcontenttype" value="${defaultcontenttype}" />
165
      <filter token="debugprefix" value="${debugprefix}"/>
166

    
167
      <property name="srcdir" value="./src" />
168
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
169
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
170
      <property name="build.dir" value="./build"/>
171
      <property name="build.src" value="${build.dir}/src"/>
172
      <property name="build.dest" value="${build.dir}/classes"/>
173
      <property name="build.docs" value="${build.dir}/docs"/>
174
      <property name="build.samples" value="${build.dir}/samples"/>
175
      <property name="build.tests" value="${build.dir}/tests"/>
176
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
177
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
178
      <property name="build.data" value="${build.dir}/data"/>
179
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
180
      <property name="build.img" value="${installdir}"/>
181

    
182
      <property name="dist.dir" value="dist"/>
183
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
184
      <property name="ver.src" value="${ver.dir}/src"/>
185

    
186
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
187

    
188
   </target>
189

    
190
   <target name="prepare" depends="init">
191
      <mkdir dir="${build.dir}"/>
192
      <mkdir dir="${build.src}"/>
193
      <mkdir dir="${build.dest}"/>
194
      <mkdir dir="${build.javadocs}"/>
195

    
196
      <copy todir="${build.src}" filtering="yes">
197
        <fileset dir="${srcdir}">
198
          <include name="edu/**"/>
199
          <include name="com/**"/>
200
          <include name="**/*.sql"/>
201
          <exclude name="**/CVS*"/>
202
          <exclude name="**/.#*"/>
203
        </fileset>
204
      </copy>
205
   </target>
206

    
207
   <target name="compile" depends="prepare">
208
       <javac srcdir="${build.src}"
209
              destdir="${build.dest}"
210
              classpath="${cpath}"
211
              excludes="**/*.sql" />
212
       <copy file="lib/metacat.properties"
213
             tofile="${build.dest}/${package.home}/metacat.properties"
214
             filtering="yes" />
215
       <copy file="lib/srbProps.properties"
216
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
217
   </target>
218

    
219
   <target name="jar" depends="compile">
220
       <delete file="${build.dir}/${name}.jar" />
221
       <copy todir="${build.dest}">
222
         <fileset dir="lib/srbrmi"/>
223
       </copy>
224
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
225
            excludes="**/protocols/" />
226
   </target>
227

    
228
   <target name="protocol" depends="compile">
229
       <delete file="${build.dir}/protocol.jar" />
230
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
231
            includes="**/protocols/" />
232
   </target>
233

    
234
   <target name="getdtd" depends="prepare">
235
     <echo>Enter CVS password: </echo>
236
     <cvs cvsRoot="${cvsroot}"
237
          package="${eml-module}"
238
          tag="${eml-tag}"
239
          dest="${build.src}" />
240
     <mkdir dir="lib/dtd" />
241
     <copy todir="lib/dtd" filtering="yes">
242
       <fileset dir="${build.src}/${eml-module}">
243
         <include name="*.dtd"/>
244
       </fileset>
245
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
246
     </copy>
247
   </target>
248

    
249
   <target name="getschema" depends="prepare">
250
     <echo>Enter CVS password: </echo>
251
     <cvs cvsRoot="${cvsroot}"
252
          package="${eml-module}"
253
          tag="${eml2-tag}"
254
          dest="${build.src}" />
255
     <mkdir dir="lib/schema" />
256
     <copy todir="lib/schema" filtering="yes">
257
       <fileset dir="${build.src}/${eml-module}">
258
         <include name="*.xsd"/>
259
       </fileset>
260
     </copy>
261
     <copy todir="lib/style">
262
       <fileset dir="${build.src}/${eml-module}/style">
263
       <include name="*.xsl"/>
264
     </fileset>
265
     </copy>
266
   </target>
267

    
268
   <target name="dtdschemasql" depends="prepare">
269
     <echo/>
270
     <echo>Registering the DTDs with the new Metacat instance...</echo>
271
     <sql driver="${dbDriver}"
272
          classpath="${jdbc}"
273
          url="${jdbc-connect}"
274
          userid="${user}"
275
          password="${password}"
276
          src="${build.src}/loaddtdschema.sql" />
277
   </target>
278
   
279
   <target name="schemasql" depends="prepare">
280
     <echo/>
281
     <echo>Registering the DTDs with the new Metacat instance...</echo>
282
     <sql driver="${dbDriver}"
283
          classpath="${jdbc}"
284
          url="${jdbc-connect}"
285
          userid="${user}"
286
          password="${password}"
287
          src="${build.src}/loadschema.sql" />
288
   </target>
289

    
290
   <target name="install" depends="jar">
291
       <mkdir dir="${datafilepath}" />
292
       <mkdir dir="${inlinedatafilepath}" />
293
       <chmod dir="${datafilepath}" perm="ug+w" />
294
       <mkdir dir="${installdir}/WEB-INF/lib" />
295
       <copy file="${build.dir}/${name}.jar"
296
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
297
       <copy file="${xmlp}"
298
             tofile="${installdir}/WEB-INF/lib/xercesImpl.jar" />
299
       <copy file="${xalan}"
300
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
301
       <copy file="${apis}"
302
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
303
       <copy file="${jdbc}"
304
             tofile="${installdir}/WEB-INF/lib/jdbc.jar" />
305
       <copy file="${cos}"
306
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
307
       <copy file="${morpho}"
308
             tofile="${installdir}/WEB-INF/lib/morpho.jar" />
309
       <copy file="${emlparser}"
310
             tofile="${installdir}/WEB-INF/lib/eml.jar" />
311
       <copy file="${configxml}"
312
             tofile="${installdir}/WEB-INF/lib/configxml.jar" />
313
       <copy file="${itislib}"
314
             tofile="${installdir}/WEB-INF/lib/itislib.jar" />
315
       <copy file="${httpclientjar}"
316
             tofile="${installdir}/WEB-INF/lib/httpclient.jar" />
317
       <copy file="lib/web.xml"
318
             tofile="${installdir}/WEB-INF/web.xml" />
319
       <copy todir="${build.img}" filtering="no">
320
         <fileset dir="lib">
321
           <include name="**/*.jpg"/>
322
           <include name="**/*.png"/>
323
           <include name="**/*.gif"/>
324
         </fileset>
325
       </copy>
326
       <copy todir="${installdir}" filtering="yes">
327
         <fileset dir="lib">
328
           <exclude name="*.jar"/>
329
           <exclude name="*.properties"/>
330
           <exclude name="web.xml"/>
331
           <exclude name="**/srbrmi*"/>
332
           <exclude name="**/*.jpg"/>
333
           <exclude name="**/*.png"/>
334
           <exclude name="**/*.gif"/>
335
         </fileset>
336
       </copy>
337
       <echo>
338
             ***********************************************************
339
              Remember to register the default DTDs by running the
340
              "${build.src}/loaddtd.sql script". This is most easily
341
              done by using the "ant dtdsql" which will run it for you.
342
             ***********************************************************
343
       </echo>
344
   </target>
345

    
346
   <target name="test" depends="install">
347
      <!-- copy and compile the tests into a jar file -->
348
      <mkdir dir="${build.metacattest}"/>
349
      <javac srcdir="${junittestsdir}"
350
             destdir="${build.metacattest}"
351
             classpath="${cpath}:${build.dir}/${name}.jar"
352
       includes="**/*.java" />
353

    
354
      <jar jarfile="${build.dir}/${name}-junittests.jar"
355
        basedir="${build.metacattest}"
356
                includes="**/*.class" />
357

    
358
      <!-- use the ant "junit" task to run JUnit tests. -->
359
      <junit printsummary="yes" haltonfailure="no" fork="no"
360
             haltonerror="no">
361
        <classpath>
362
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
363
        </classpath>
364

    
365
        <formatter type="plain" />
366

    
367
        <batchtest fork="yes" todir="${build.dir}">
368
          <fileset dir="${build.metacattest}">
369
            <include name="**/*.class" />
370
          </fileset>
371
        </batchtest>
372
     </junit>
373
   </target>
374

    
375
    <target name="runonetest" depends="install">
376
      <!-- copy and compile the tests into a jar file -->
377
      <!--<property name="testtorun" value="SubTreeTest"/> -->
378
      <echo>testtorun: ${testtorun}</echo>
379
      <mkdir dir="${build.metacattest}"/>
380
      <javac srcdir="${junittestsdir}"
381
             destdir="${build.metacattest}"
382
             classpath="${cpath}:${build.dir}/${name}.jar"
383
       includes="**/*.java" />
384

    
385
      <jar jarfile="${build.dir}/${name}-junittests.jar"
386
        basedir="${build.metacattest}"
387
                includes="**/*.class" />
388

    
389
      <!-- use the ant "junit" task to run JUnit tests. -->
390
      <junit printsummary="yes" haltonfailure="no" fork="no"
391
             haltonerror="no">
392
        <classpath>
393
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
394
        </classpath>
395

    
396
        <formatter type="plain" />
397

    
398
        <batchtest fork="yes" todir="${build.dir}">
399
          <fileset dir="${build.metacattest}">
400

    
401
            <include name="**/${testtorun}.class" />
402
          </fileset>
403
        </batchtest>
404
     </junit>
405
   </target>
406

    
407
  <target name="gethttpclient" depends="prepare">
408
  <!--mkdir dir="${morphosourcedir}" -->
409
        <cvs cvsRoot="${cvsroot}"
410
             package="morpho"
411
             dest="." />
412
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
413
   </target>
414

    
415
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
416
   <target name="nettest" depends="install">
417
      <echo>***********************************
418
      Please run ant gethttpclient first!
419
      ***********************************
420
      </echo>
421
      <!-- copy and compile the tests into a jar file -->
422
      <mkdir dir="${build.metacatnettest}"/>
423
      <javac srcdir="${junitnettestsdir}"
424
             destdir="${build.metacatnettest}"
425
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
426
             includes="**/*.java" />
427

    
428
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
429
                    basedir="${build.metacatnettest}"
430
                    includes="**/*.class" />
431

    
432
      <!-- use the ant "junit" task to run JUnit tests. -->
433
      <junit printsummary="yes" haltonfailure="no" fork="yes"
434
             haltonerror="no">
435
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
436
        <classpath>
437
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itis}" />
438
        </classpath>
439

    
440
        <formatter type="plain" />
441

    
442
        <batchtest fork="yes" todir="${build.dir}">
443
          <fileset dir="${build.metacatnettest}">
444
            <include name="**/*.class" />
445
          </fileset>
446
        </batchtest>
447
     </junit>
448
   </target>
449

    
450
   <target name="servletclean" depends="clean">
451
     <delete dir="${installdir}" />
452
   </target>
453

    
454

    
455
   <target name="clean" depends="init">
456
       <delete dir="${build.dir}" />
457
   </target>
458

    
459
   <target name="jdoc" depends="prepare">
460
       <javadoc packagenames="edu.ucsb.nceas.*"
461
           sourcepath="${build.src}"
462
           destdir="${build.javadocs}"
463
           author="true"
464
           version="true"
465
           use="true"
466
           windowtitle="${Name} API"
467
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
468
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
469
       />
470
   </target>
471

    
472
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
473
      <mkdir dir="${dist.dir}"/>
474
      <delete dir="${ver.dir}" />
475
      <mkdir dir="${ver.dir}"/>
476
      <copy todir="${ver.dir}">
477
        <fileset dir="."
478
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
479
      </copy>
480
      <copy todir="${ver.dir}" file="build.xml"/>
481
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
482
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
483

    
484
      <copy todir="${ver.dir}/docs" filtering="yes">
485
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
486
      </copy>
487
      <copy todir="${ver.dir}/docs" filtering="no">
488
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
489
      </copy>
490
      <copy todir="${ver.dir}/docs/dev">
491
        <fileset dir="${build.dir}/docs"/>
492
      </copy>
493
      <copy todir="${ver.dir}/src">
494
        <fileset dir="${build.dir}/src"/>
495
      </copy>
496

    
497
      <delete dir="./${ver.dir}/${build.dir}"/>
498
      <delete dir="./${ver.dir}/dist"/>
499
      <delete file="./${name}-${release}.zip"/>
500
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
501
      <delete file="./${name}-${release}.tar.gz" />
502
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
503
      <gzip zipfile="./${name}-${release}.tar.gz"
504
                src="./${name}-${release}.tar"/>
505
      <delete file="./${name}-${release}.tar" />
506
  </target>
507

    
508
  <target name="distsrc" depends="dist">
509
      <mkdir dir="${ver.src}"/>
510
      <copy todir="${ver.src}">
511
        <fileset dir="./src"/>
512
      </copy>
513

    
514
      <delete file="./${name}-src-${release}.zip"/>
515
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
516
      <delete file="./${name}-src-${release}.tar.gz" />
517
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
518
      <gzip zipfile="./${name}-src-${release}.tar.gz"
519
                src="./${name}-src-${release}.tar"/>
520
      <delete file="./${name}-src-${release}.tar" />
521
      <delete dir="${dist.dir}"/>
522
  </target>
523

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