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-17 23:09:20 -0700 (Thu, 17 Apr 2003) $'
11
  *    '$Revision: 1578 $'
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

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

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

    
131
      <property name="cpath"
132
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}:${emlparser}"/>
133

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

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

    
178
      <property name="dist.dir" value="dist"/>
179
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
180
      <property name="ver.src" value="${ver.dir}/src"/>
181

    
182
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
183

    
184
   </target>
185

    
186
   <target name="prepare" depends="init">
187
      <mkdir dir="${build.dir}"/>
188
      <mkdir dir="${build.src}"/>
189
      <mkdir dir="${build.dest}"/>
190
      <mkdir dir="${build.javadocs}"/>
191

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

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

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

    
224
   <target name="protocol" depends="compile">
225
       <delete file="${build.dir}/protocol.jar" />
226
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
227
            includes="**/protocols/" />
228
   </target>
229

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

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

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

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

    
340
   <target name="test" depends="install">
341
      <!-- copy and compile the tests into a jar file -->
342
      <mkdir dir="${build.metacattest}"/>
343
      <javac srcdir="${junittestsdir}"
344
             destdir="${build.metacattest}"
345
             classpath="${cpath}:${build.dir}/${name}.jar"
346
       includes="**/*.java" />
347

    
348
      <jar jarfile="${build.dir}/${name}-junittests.jar"
349
        basedir="${build.metacattest}"
350
                includes="**/*.class" />
351

    
352
      <!-- use the ant "junit" task to run JUnit tests. -->
353
      <junit printsummary="yes" haltonfailure="no" fork="no"
354
             haltonerror="no">
355
        <classpath>
356
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
357
        </classpath>
358

    
359
        <formatter type="plain" />
360

    
361
        <batchtest fork="yes" todir="${build.dir}">
362
          <fileset dir="${build.metacattest}">
363
            <include name="**/*.class" />
364
          </fileset>
365
        </batchtest>
366
     </junit>
367
   </target>
368

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

    
379
      <jar jarfile="${build.dir}/${name}-junittests.jar"
380
        basedir="${build.metacattest}"
381
                includes="**/*.class" />
382

    
383
      <!-- use the ant "junit" task to run JUnit tests. -->
384
      <junit printsummary="yes" haltonfailure="no" fork="no"
385
             haltonerror="no">
386
        <classpath>
387
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
388
        </classpath>
389

    
390
        <formatter type="plain" />
391

    
392
        <batchtest fork="yes" todir="${build.dir}">
393
          <fileset dir="${build.metacattest}">
394

    
395
            <include name="**/${testtorun}.class" />
396
          </fileset>
397
        </batchtest>
398
     </junit>
399
   </target>
400

    
401
  <target name="gethttpclient" depends="prepare">
402
  <!--mkdir dir="${morphosourcedir}" -->
403
        <cvs cvsRoot="${cvsroot}"
404
             package="morpho"
405
             dest="." />
406
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
407
   </target>
408

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

    
422
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
423
                    basedir="${build.metacatnettest}"
424
                    includes="**/*.class" />
425

    
426
      <!-- use the ant "junit" task to run JUnit tests. -->
427
      <junit printsummary="yes" haltonfailure="no" fork="yes"
428
             haltonerror="no">
429
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
430
        <classpath>
431
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itis}" />
432
        </classpath>
433

    
434
        <formatter type="plain" />
435

    
436
        <batchtest fork="yes" todir="${build.dir}">
437
          <fileset dir="${build.metacatnettest}">
438
            <include name="**/*.class" />
439
          </fileset>
440
        </batchtest>
441
     </junit>
442
   </target>
443

    
444
   <target name="servletclean" depends="clean">
445
     <delete dir="${installdir}" />
446
   </target>
447

    
448

    
449
   <target name="clean" depends="init">
450
       <delete dir="${build.dir}" />
451
   </target>
452

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

    
466
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
467
      <mkdir dir="${dist.dir}"/>
468
      <delete dir="${ver.dir}" />
469
      <mkdir dir="${ver.dir}"/>
470
      <copy todir="${ver.dir}">
471
        <fileset dir="."
472
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
473
      </copy>
474
      <copy todir="${ver.dir}" file="build.xml"/>
475
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
476
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
477

    
478
      <copy todir="${ver.dir}/docs" filtering="yes">
479
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
480
      </copy>
481
      <copy todir="${ver.dir}/docs" filtering="no">
482
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
483
      </copy>
484
      <copy todir="${ver.dir}/docs/dev">
485
        <fileset dir="${build.dir}/docs"/>
486
      </copy>
487
      <copy todir="${ver.dir}/src">
488
        <fileset dir="${build.dir}/src"/>
489
      </copy>
490

    
491
      <delete dir="./${ver.dir}/${build.dir}"/>
492
      <delete dir="./${ver.dir}/dist"/>
493
      <delete file="./${name}-${release}.zip"/>
494
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
495
      <delete file="./${name}-${release}.tar.gz" />
496
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
497
      <gzip zipfile="./${name}-${release}.tar.gz"
498
                src="./${name}-${release}.tar"/>
499
      <delete file="./${name}-${release}.tar" />
500
  </target>
501

    
502
  <target name="distsrc" depends="dist">
503
      <mkdir dir="${ver.src}"/>
504
      <copy todir="${ver.src}">
505
        <fileset dir="./src"/>
506
      </copy>
507

    
508
      <delete file="./${name}-src-${release}.zip"/>
509
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
510
      <delete file="./${name}-src-${release}.tar.gz" />
511
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
512
      <gzip zipfile="./${name}-src-${release}.tar.gz"
513
                src="./${name}-src-${release}.tar"/>
514
      <delete file="./${name}-src-${release}.tar" />
515
      <delete dir="${dist.dir}"/>
516
  </target>
517

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