Project

General

Profile

metacat / build.xml @ 1574

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 10:25:25 -0700 (Thu, 17 Apr 2003) $'
11
  *    '$Revision: 1570 $'
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

    
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
      <property name="eml2namespace" value="eml://ecoinformatics.org/eml-2.0.0" />
128

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

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

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

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

    
180
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
181

    
182
   </target>
183

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

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

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

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

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

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

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

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

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

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

    
344
      <jar jarfile="${build.dir}/${name}-junittests.jar"
345
        basedir="${build.metacattest}"
346
                includes="**/*.class" />
347

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

    
355
        <formatter type="plain" />
356

    
357
        <batchtest fork="yes" todir="${build.dir}">
358
          <fileset dir="${build.metacattest}">
359
            <include name="**/*.class" />
360
          </fileset>
361
        </batchtest>
362
     </junit>
363
   </target>
364

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

    
375
      <jar jarfile="${build.dir}/${name}-junittests.jar"
376
        basedir="${build.metacattest}"
377
                includes="**/*.class" />
378

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

    
386
        <formatter type="plain" />
387

    
388
        <batchtest fork="yes" todir="${build.dir}">
389
          <fileset dir="${build.metacattest}">
390

    
391
            <include name="**/${testtorun}.class" />
392
          </fileset>
393
        </batchtest>
394
     </junit>
395
   </target>
396

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

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

    
418
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
419
                    basedir="${build.metacatnettest}"
420
                    includes="**/*.class" />
421

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

    
430
        <formatter type="plain" />
431

    
432
        <batchtest fork="yes" todir="${build.dir}">
433
          <fileset dir="${build.metacatnettest}">
434
            <include name="**/*.class" />
435
          </fileset>
436
        </batchtest>
437
     </junit>
438
   </target>
439

    
440
   <target name="servletclean" depends="clean">
441
     <delete dir="${installdir}" />
442
   </target>
443

    
444

    
445
   <target name="clean" depends="init">
446
       <delete dir="${build.dir}" />
447
   </target>
448

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

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

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

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

    
498
  <target name="distsrc" depends="dist">
499
      <mkdir dir="${ver.src}"/>
500
      <copy todir="${ver.src}">
501
        <fileset dir="./src"/>
502
      </copy>
503

    
504
      <delete file="./${name}-src-${release}.zip"/>
505
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
506
      <delete file="./${name}-src-${release}.tar.gz" />
507
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
508
      <gzip zipfile="./${name}-src-${release}.tar.gz"
509
                src="./${name}-src-${release}.tar"/>
510
      <delete file="./${name}-src-${release}.tar" />
511
      <delete dir="${dist.dir}"/>
512
  </target>
513

    
514
</project>