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: berkley $'
10
  *    '$Date: 2003-04-10 10:00:31 -0700 (Thu, 10 Apr 2003) $'
11
  *    '$Revision: 1538 $'
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="/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="/opt/tomcat/webapps" />
61
      <property name="context" value="metacat" />
62
      <property name="user" value="berkley"/>
63
      <property name="password" value=""/>
64
      <property name="server" value="trestles.nceas.ucsb.edu:8080"/>
65
      <property name="systemidserver" value="http://trestles.nceas.ucsb.edu:8080" />
66
      <property name="datafilepath" value="/opt/tomcat/data/metacat/data" />
67
      <property name="inlinedatafilepath" value="/opt/tomcat/data/metacat/inlinedata" />
68
      <property name="debuglevel" value="45" />
69
      <property name="forcereplicationwaitingtime" value="30000"/>
70
      <property name="cvsroot"
71
                value=":ext:berkley@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="text/plain" />
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}/common/lib/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

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

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

    
128
      <property name="cpath"
129
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}:${emlparser}"/>
130

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

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

    
174
      <property name="dist.dir" value="dist"/>
175
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
176
      <property name="ver.src" value="${ver.dir}/src"/>
177

    
178
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
179

    
180
   </target>
181

    
182
   <target name="prepare" depends="init">
183
      <mkdir dir="${build.dir}"/>
184
      <mkdir dir="${build.src}"/>
185
      <mkdir dir="${build.dest}"/>
186
      <mkdir dir="${build.javadocs}"/>
187

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

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

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

    
220
   <target name="protocol" depends="compile">
221
       <delete file="${build.dir}/protocol.jar" />
222
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
223
            includes="**/protocols/" />
224
   </target>
225

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

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

    
260
   <target name="dtdsql" depends="prepare">
261
     <echo/>
262
     <echo>Registering the DTDs with the new Metacat instance...</echo>
263
     <sql driver="${dbDriver}"
264
          classpath="${jdbc}"
265
          url="${jdbc-connect}"
266
          userid="${user}"
267
          password="${password}"
268
          src="${build.src}/loaddtd.sql" />
269
   </target>
270

    
271
   <target name="install" depends="jar">
272
       <mkdir dir="${datafilepath}" />
273
       <mkdir dir="${inlinedatafilepath}" />
274
       <chmod dir="${datafilepath}" perm="ug+w" />
275
       <mkdir dir="${installdir}/WEB-INF/lib" />
276
       <copy file="${build.dir}/${name}.jar"
277
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
278
       <copy file="${xmlp}"
279
             tofile="${installdir}/WEB-INF/lib/xercesImpl.jar" />
280
       <copy file="${xalan}"
281
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
282
       <copy file="${apis}"
283
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
284
       <copy file="${jdbc}"
285
             tofile="${installdir}/WEB-INF/lib/jdbc.jar" />
286
       <copy file="${cos}"
287
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
288
       <copy file="${morpho}"
289
             tofile="${installdir}/WEB-INF/lib/morpho.jar" />
290
       <copy file="${emlparser}"
291
             tofile="${installdir}/WEB-INF/lib/eml.jar" />
292
       <copy file="${configxml}"
293
             tofile="${installdir}/WEB-INF/lib/configxml.jar" />
294
       <copy file="lib/web.xml"
295
             tofile="${installdir}/WEB-INF/web.xml" />
296
       <copy todir="${build.img}" filtering="no">
297
         <fileset dir="lib">
298
           <include name="**/*.jpg"/>
299
           <include name="**/*.png"/>
300
           <include name="**/*.gif"/>
301
         </fileset>
302
       </copy>
303
       <copy todir="${installdir}" filtering="yes">
304
         <fileset dir="lib">
305
           <exclude name="*.jar"/>
306
           <exclude name="*.properties"/>
307
           <exclude name="web.xml"/>
308
           <exclude name="**/srbrmi*"/>
309
           <exclude name="**/*.jpg"/>
310
           <exclude name="**/*.png"/>
311
           <exclude name="**/*.gif"/>
312
         </fileset>
313
       </copy>
314
       <echo>
315
             ***********************************************************
316
              Remember to register the default DTDs by running the
317
              "${build.src}/loaddtd.sql script". This is most easily
318
              done by using the "ant dtdsql" which will run it for you.
319
             ***********************************************************
320
       </echo>
321
   </target>
322

    
323
   <target name="test" depends="install">
324
      <!-- copy and compile the tests into a jar file -->
325
      <mkdir dir="${build.metacattest}"/>
326
      <javac srcdir="${junittestsdir}"
327
             destdir="${build.metacattest}"
328
             classpath="${cpath}:${build.dir}/${name}.jar"
329
       includes="**/*.java" />
330

    
331
      <jar jarfile="${build.dir}/${name}-junittests.jar"
332
        basedir="${build.metacattest}"
333
                includes="**/*.class" />
334

    
335
      <!-- use the ant "junit" task to run JUnit tests. -->
336
      <junit printsummary="yes" haltonfailure="no" fork="no"
337
             haltonerror="no">
338
        <classpath>
339
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
340
        </classpath>
341

    
342
        <formatter type="plain" />
343

    
344
        <batchtest fork="yes" todir="${build.dir}">
345
          <fileset dir="${build.metacattest}">
346
            <include name="**/*.class" />
347
          </fileset>
348
        </batchtest>
349
     </junit>
350
   </target>
351

    
352
    <target name="runonetest" depends="install">
353
      <!-- copy and compile the tests into a jar file -->
354
      <!--<property name="testtorun" value="SubTreeTest"/> -->
355
      <echo>testtorun: ${testtorun}</echo>
356
      <mkdir dir="${build.metacattest}"/>
357
      <javac srcdir="${junittestsdir}"
358
             destdir="${build.metacattest}"
359
             classpath="${cpath}:${build.dir}/${name}.jar"
360
       includes="**/*.java" />
361

    
362
      <jar jarfile="${build.dir}/${name}-junittests.jar"
363
        basedir="${build.metacattest}"
364
                includes="**/*.class" />
365

    
366
      <!-- use the ant "junit" task to run JUnit tests. -->
367
      <junit printsummary="yes" haltonfailure="no" fork="no"
368
             haltonerror="no">
369
        <classpath>
370
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
371
        </classpath>
372

    
373
        <formatter type="plain" />
374

    
375
        <batchtest fork="yes" todir="${build.dir}">
376
          <fileset dir="${build.metacattest}">
377

    
378
            <include name="**/${testtorun}.class" />
379
          </fileset>
380
        </batchtest>
381
     </junit>
382
   </target>
383

    
384
  <target name="gethttpclient" depends="prepare">
385
  <!--mkdir dir="${morphosourcedir}" -->
386
        <cvs cvsRoot="${cvsroot}"
387
             package="morpho"
388
             dest="." />
389
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
390
   </target>
391

    
392
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
393
   <target name="nettest" depends="install">
394
      <echo>***********************************
395
      Please run ant gethttpclient first!
396
      ***********************************
397
      </echo>
398
      <!-- copy and compile the tests into a jar file -->
399
      <mkdir dir="${build.metacatnettest}"/>
400
      <javac srcdir="${junitnettestsdir}"
401
             destdir="${build.metacatnettest}"
402
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
403
             includes="**/*.java" />
404

    
405
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
406
                    basedir="${build.metacatnettest}"
407
                    includes="**/*.class" />
408

    
409
      <!-- use the ant "junit" task to run JUnit tests. -->
410
      <junit printsummary="yes" haltonfailure="no" fork="yes"
411
             haltonerror="no">
412
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
413
        <classpath>
414
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itis}" />
415
        </classpath>
416

    
417
        <formatter type="plain" />
418

    
419
        <batchtest fork="yes" todir="${build.dir}">
420
          <fileset dir="${build.metacatnettest}">
421
            <include name="**/*.class" />
422
          </fileset>
423
        </batchtest>
424
     </junit>
425
   </target>
426

    
427
   <target name="servletclean" depends="clean">
428
     <delete dir="${installdir}" />
429
   </target>
430

    
431

    
432
   <target name="clean" depends="init">
433
       <delete dir="${build.dir}" />
434
   </target>
435

    
436
   <target name="jdoc" depends="prepare">
437
       <javadoc packagenames="edu.ucsb.nceas.*"
438
           sourcepath="${build.src}"
439
           destdir="${build.javadocs}"
440
           author="true"
441
           version="true"
442
           use="true"
443
           windowtitle="${Name} API"
444
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
445
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
446
       />
447
   </target>
448

    
449
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
450
      <mkdir dir="${dist.dir}"/>
451
      <delete dir="${ver.dir}" />
452
      <mkdir dir="${ver.dir}"/>
453
      <copy todir="${ver.dir}">
454
        <fileset dir="."
455
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
456
      </copy>
457
      <copy todir="${ver.dir}" file="build.xml"/>
458
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
459
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
460

    
461
      <copy todir="${ver.dir}/docs" filtering="yes">
462
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
463
      </copy>
464
      <copy todir="${ver.dir}/docs" filtering="no">
465
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
466
      </copy>
467
      <copy todir="${ver.dir}/docs/dev">
468
        <fileset dir="${build.dir}/docs"/>
469
      </copy>
470
      <copy todir="${ver.dir}/src">
471
        <fileset dir="${build.dir}/src"/>
472
      </copy>
473

    
474
      <delete dir="./${ver.dir}/${build.dir}"/>
475
      <delete dir="./${ver.dir}/dist"/>
476
      <delete file="./${name}-${release}.zip"/>
477
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
478
      <delete file="./${name}-${release}.tar.gz" />
479
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
480
      <gzip zipfile="./${name}-${release}.tar.gz"
481
                src="./${name}-${release}.tar"/>
482
      <delete file="./${name}-${release}.tar" />
483
  </target>
484

    
485
  <target name="distsrc" depends="dist">
486
      <mkdir dir="${ver.src}"/>
487
      <copy todir="${ver.src}">
488
        <fileset dir="./src"/>
489
      </copy>
490

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

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