Project

General

Profile

metacat / build.xml @ 4593

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: daigle $'
10
  *    '$Date: 2008-11-19 15:28:54 -0800 (Wed, 19 Nov 2008) $'
11
  *    '$Revision: 4593 $'
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
  <property environment="env"/>
34
  <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
35
        
36
  
37
        
38
  <!-- Determine if installed ecogrid -->
39
  <condition property="enable.ecogrid">
40
    <equals arg1="${install.ecogrid}" arg2="true" />
41
  </condition>
42

    
43
   <target name="config">
44
             <property name="jsdk" value="${build.tomcat.dir}/common/lib/servlet-api.jar"/>
45
      <!-- usr for client testing, generally you don't need change-->
46
      <property name="mcuser"              value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org"/>
47
      <property name="mcpassword"          value="kepler"/>
48
      <property name="mcanotheruser"       value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org"/>
49
      <property name="mcanotherpassword"   value="yourpass"/>
50
             <property name="piscouser"           value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org"/>
51
             <property name="piscopassword"       value="yourpass"/>
52
             <property name="lteruser"            value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
53
             <property name="lterpassword"        value="yourpass"/>
54

    
55
      <property name="debug"               value="on" />
56
      <!-- MCD BYE in metacat.properties property name="debuglevel"          value="55" / -->
57

    
58
      <property name="morphosourcedir"     value="../morpho" />
59
      <!-- MCD BYE in metacat.properties property name="defaultcontenttype"  value="application/octet-stream" / -->
60
      <property name="utilitiesdir"        value="../utilities" />
61
      <property name="installdir"        value="${dev.deploy.dir}/${metacat.context}" />
62

    
63
      <echo>*********** set jsdk to ${jsdk}</echo>
64
  </target>
65

    
66
   <target name="init" depends="config">
67
      <path id="compile.classpath">
68
        <pathelement location="${jsdk}"/>
69
        <pathelement location="lib"/>
70
        <fileset dir="lib">
71
          <include name="*.jar"/>
72
        </fileset>
73
            <fileset dir="lib">
74
           <include name="xalan.jar"/>
75
         </fileset>
76
       <fileset dir="lib/lsid_lib">
77
         <include name="*.jar"/>
78
       </fileset>             
79

    
80
        <!-- Include geoserver, geotools, et. al. -->
81
        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
82
          <include name="*.jar"/>
83
        </fileset>
84
        <pathelement location="lib/spatial/geoserver/WEB-INF/classes"/>
85

    
86
      </path>
87
      
88
      <!-- It is less likely you'll need to make any changes from here down,
89
           but customization is possible -->
90
      <property name="name"                value="metacat"/>
91
      <property name="Name"                value="MetaCat"/>
92
      <property name="debugprefix"         value="${Name}:"/>
93
      <property name="release"             value="${metacat.version}"/>
94
      <property name="style-common-relpath" value="/style/common"/>
95
      <property name="style-shared-relpath" value="/style/shared"/>
96
      <property name="schema-relpath"      value="/schema"/>
97
      <property name="style-common-cvsrelpath" value="lib${style-common-relpath}"/>
98
             <property name="schema-cvsrelpath"   value="lib${schema-relpath}"/>
99
      <property name="style-skins-relpath" value="/style/skins"/>
100
      <property name="util-module"         value="utilities" />
101
      <property name="eml-module"          value="eml" />
102
      <property name="eml-version"         value="2.0.0beta6" />
103
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
104
      <property name="eml2_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
105
      <property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
106
      <property name="eml2_0_1-style-tag"  value="RELEASE_EML_2_0_1_UPDATE_7" />
107
             <!-- property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0_RC_3" / -->
108
      <!-- property name="eml2_1_0-style-tag"  value="RELEASE_EML_2_1_0_RC_3" / -->          
109
           <property name="eml2_1_0-schema-tag" value="" />
110
      <property name="eml2_1_0-style-tag"  value="" />
111
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
112
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
113
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
114
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
115
      <property name="eml-css"             value="eml_xsl.css"/>
116
      <property name="eml-module.default.css"
117
                                           value="default.css"/>
118
           <property name="systemidserver"             value=""/>
119
           <property name="html-path"             value=""/>
120
           
121
             
122
      <!-- Config for registry variables -->
123
      <!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties --> 
124
      <property name="scope"               value="obfs"/>
125
      <property name="responseForm"        value="genericResponse.tmpl"/>
126
      <property name="entryForm"           value="entryForm.tmpl"/>
127
      <property name="guide"               value="genericGuide.tmpl"/>
128
      <property name="loginForm"           value="loginForm.tmpl"/>
129
      <property name="confirmData"         value="confirmData.tmpl"/>
130
      <property name="deleteData"          value="deleteData.tmpl"/>
131
      <property name="genericHeader"       value="genericHeader.tmpl"/>
132
      <property name="genericFooter"       value="genericFooter.tmpl"/>
133

    
134
      <filter token="scope"                value="${scope}"/>
135
      <filter token="responseForm"         value="${responseForm}"/>
136
      <filter token="entryForm"            value="${entryForm}"/>
137
      <filter token="guide"                value="${guide}"/>
138
      <filter token="loginForm"            value="${loginForm}"/>
139
      <filter token="confirmData"          value="${confirmData}"/>
140
      <filter token="deleteData"           value="${deleteData}"/>
141
      <filter token="genericHeader"        value="${genericHeader}"/>
142
      <filter token="genericFooter"        value="${genericFooter}"/>
143
      <filter token="adminname"            value="${adminname}"/>
144
      <filter token="recipient"            value="${recipient}"/>
145
             <filter token="metacatVersion"       value="${metacat.version}"/>
146

    
147
      <filter token="docrooturl"           value="./" />
148
      <filter token="mcuser"               value="${mcuser}"/>
149
      <filter token="mcpassword"           value="${mcpassword}"/>
150
      <filter token="mcanotheruser"        value="${mcanotheruser}"/>
151
      <filter token="mcanotherpassword"    value="${mcanotherpassword}"/>
152
      <filter token="eml-css"              value="${eml-css}"/>
153
      <filter token="style-skins-relpath"  value="${style-skins-relpath}"/>
154
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
155

    
156
      <filter token="eml-version"          value="${eml-version}"/>
157
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
158
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
159
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
160
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
161
      <!-- MCD BYE filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" / -->
162
      <!-- MCD BYE filter filter token="debuglevel"           value="${debuglevel}" / -->
163
      <!-- MCD BYE filter token="defaultcontenttype"   value="${defaultcontenttype}" / -->
164
      <filter token="debugprefix"          value="${debugprefix}"/>
165
      <filter token="indexPaths"           value="${indexPaths}"/>
166

    
167
      <filter token="defaultStage"         value="${defaultStage}"/>
168
      <filter token="defaultHeader"        value="${defaultHeader}"/>
169
      <filter token="defaultFooter"        value="${defaultFooter}"/>
170
      <filter token="defaultChangePass"    value="${defaultChangePass}"/>
171
      <filter token="defaultResetPass"     value="${defaultResetPass}"/>
172
      <filter token="changePassSuccess"    value="${changePassSuccess}"/>
173
      <filter token="resetPassSuccess"     value="${resetPassSuccess}"/>
174
      <filter token="registerFailed"       value="${registerFailed}"/>
175
      <filter token="registerLter"         value="${registerLter}"/>
176
      <filter token="registerMatch"        value="${registerMatch}"/>
177
      <filter token="registerSuccess"      value="${registerSuccess}"/>
178
      <filter token="register"             value="${register}"/>
179
      <filter token="searchResults"        value="${searchResults}"/>
180
             <filter token="ldapMainServerFailure" value="${ldapMainServerFailure}"/>
181
             <filter token="lter-user"            value="${lteruser}"/>
182
             <filter token="lter-pass"            value="${lterpassword}"/>
183
      <filter token="pisco-user"           value="${piscouser}"/>
184
      <filter token="pisco-pass"           value="${piscopassword}"/>
185
              
186
       
187
             <!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
188
             <!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
189
             <!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
190
      
191
             <property name="srcdir"              value="./src" />
192
             <property name="lib.dir"             value="./lib" />
193
             <property name="docdir"              value="./docs" />
194
           <property name="cgidir"              value="./cgi-bin" />
195
      <property name="testdir"             value="./test" />
196
      <property name="testtorun"           value="BuildIndexTest" />
197
      <property name="junittestsdir"       value="./test/edu/ucsb/nceas/metacattest" />
198
      <property name="junitnettestsdir"    value="./test/edu/ucsb/nceas/metacatnettest" />
199
      <property name="build.dir"           value="./build"/>
200
      <property name="build.src"           value="${build.dir}/src"/>
201
      <property name="build.dest"          value="${build.dir}/classes"/>
202
      <property name="build.samples"       value="${build.dir}/samples"/>
203
      <property name="build.tests"         value="${build.dir}/tests"/>
204
      <property name="build.tmp"           value="${build.dir}/tmp"/>
205
      <property name="build.metacattest"   value="${build.tests}/metacattest"/>
206
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
207
      <property name="build.data"          value="${build.dir}/data"/>
208
      <property name="build.javadocs"      value="${build.dir}/docs/api"/>
209
      <property name="build.war"           value="${build.dir}/war"/>
210
      <property name="dist.dir"            value="dist"/>
211
      <property name="ver.dir"             value="${dist.dir}/${name}-${release}"/>
212
      <property name="ver.src"             value="${ver.dir}/src"/>
213
      <property name="util.dir"            value="${dist.dir}/${util-module}"/>
214
          <!-- directories for creating a Harvest List Editor distribution -->
215
      <property name="dist.dir.hle"        value="disthle"/>
216
      <property name="ver.dir.hle"         value="${dist.dir.hle}/harvest-list-editor-${release}"/>
217
          
218
             <property name="ecogrid-target-name" value="metacatImpl"/>
219
             <property name="ecogrid-module-dest-dir" value =".."/>
220
             <property name="ecogrid-module"      value="seek/projects/ecogrid"/>
221
             <property name="ecogrid-dist-dir"    value="${dist.dir}/${ecogrid-module}"/>
222
             <property name="ecogrid-dir"         value="${ecogrid-module-dest-dir}/${ecogrid-module}"/>
223

    
224
      <property name="package.home"        value="edu/ucsb/nceas/metacat" />
225
      <condition property="utilities.required">
226
        <or>
227
          <not><available file="lib/httpclient.jar"/></not>
228
          <not><available file="lib/utilities.jar"/></not>
229
          <not><available file="${utilitiesdir}" type="dir"/></not>
230
        </or>
231
      </condition>
232
             <!-- peer.utilities.required is used when there is no utilities 
233
                  directory at ${utilitiesdir} -->
234
      <condition property="peer.utilities.required">
235
        <or>
236
          <not><available file="${utilitiesdir}" type="dir"/></not>
237
        </or>
238
      </condition>
239
      <condition property="eml.required">
240
        <or>
241
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
242
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
243
          <not><available file="lib/schema/eml-2.1.0/eml.xsd"/></not>
244
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
245
        </or>
246
      </condition>
247
             
248
      <condition property="ecogrid.required">
249
                 <or>
250
             <not><available file="${ecogrid-dir}/build.properties"/></not>
251
             <not><available file="${ecogrid-dir}/buildfiles/metacatImpl.xml"/></not>
252
           </or>
253
      </condition>
254

    
255
   </target>
256

    
257
   <target name="prepare" depends="init">
258
      <mkdir dir="${build.dir}"/>
259
      <mkdir dir="${build.src}"/>
260
      <mkdir dir="${build.dest}"/>
261
      <mkdir dir="${build.javadocs}"/>
262
      <mkdir dir="${build.tmp}"/>
263

    
264
      <copy todir="${build.src}" filtering="yes">
265
        <fileset dir="${srcdir}">
266
          <include name="edu/**"/>
267
          <include name="com/**"/>
268
          <include name="org/**"/>
269
          <include name="**/*.sql"/>
270
          <exclude name="**/CVS*"/>
271
          <exclude name="**/.#*"/>
272
        </fileset>
273
      </copy>
274
      <available file="lib/style/common/emlb6toeml2" type="dir"
275
                 property="styles.not.needed"/>
276
   </target>
277

    
278
   <target name="compile" depends="prepare,utilities"
279
    description="Compiles java code to build dir, and copies metacat props files there">
280

    
281
       <javac srcdir="${build.src}"
282
              destdir="${build.dest}"
283
              debug="${debug}"
284
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
285
        <classpath>
286
          <path refid="compile.classpath"/>
287
        </classpath>
288
      </javac>
289
   </target>
290

    
291
   <target name="jar" depends="compile,geteml"
292
    description="Compiles and jars metacat java code to metacat.jar in build dir ">
293

    
294
       <delete file="${build.dir}/${name}.jar" />
295
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
296
            excludes="**/protocols/ **/harvesterClient/" />
297
   </target>
298

    
299
   <target name="protocol" depends="compile"
300
    description="Compiles and jars protocol java code to protocol.jar in build dir">
301
       <delete file="${build.dir}/protocol.jar" />
302
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
303
            includes="**/protocols/" />
304
   </target>
305

    
306
   <target name="utilities" depends="config,getpeerutilities" if="utilities.required">
307
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
308
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
309
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
310
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
311
   </target>
312
        
313
   <target name="getpeerutilities" depends="prepare" if="peer.utilities.required"
314
        description="Checks utilities out of cvs and copies it to your utilitiesdir if it does not already exist">
315
     <echo>Enter CVS password: </echo>
316
     <cvs cvsRoot="${cvsroot}"
317
         package="${util-module}"
318
         dest="${utilitiesdir}/.." />
319
   </target>
320

    
321
   <target name="getutilities" depends="prepare"
322
   description="Checks utility out of cvs and copies it to your metacat cvs sandbox">
323
     <echo>Enter CVS password: </echo>
324
     <cvs cvsRoot="${cvsroot}"
325
          package="${util-module}"
326
          dest="${build.tmp}" />
327
   </target>
328

    
329
   <target name="client" depends="utilities, prepare"
330
    description="Compiles metacat-client java code to build dir">
331
       <javac srcdir="${build.src}"
332
              destdir="${build.dest}"
333
              includes="edu/ucsb/nceas/metacat/client/*">
334
          <classpath>
335
            <path refid="compile.classpath"/>
336
          </classpath>
337
        </javac>
338
   </target>
339

    
340
   <target name="clientjar" depends="client"
341
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
342
       <delete file="${build.dir}/${name}-client.jar" />
343
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
344
            includes="**/metacat/client/" />
345
   </target>
346

    
347
    <target name="advancedsearchjar" depends="compile"
348
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
349
        <delete file="${build.dir}/advancedsearch.jar" />
350
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
351
             includes="**/metacat/advancedsearch/" />
352
    </target>
353

    
354
   <target name="harvester" depends="client"
355
           description="Compiles harvester java code to build dir">
356
       <javac srcdir="${build.src}"
357
              destdir="${build.dest}"
358
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
359
          <classpath>
360
            <path refid="compile.classpath"/>
361
          </classpath>
362
        </javac>
363
   </target>
364

    
365
   <target name="harvesterjar" depends="harvester"
366
           description="Compiles and jars harvester java code to harvester.jar in build dir">
367
       <delete file="${build.dir}/harvester.jar" />
368
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
369
            includes="**/metacat/harvesterClient/" />
370
   </target>
371

    
372
   <target name="harvestListEditorDist" depends="harvesterjar"
373
           description="Prepares a distribution of the Harvest List Editor tool">
374
       <mkdir dir="${dist.dir.hle}"/>
375
       <delete dir="${ver.dir.hle}" />
376
       <mkdir dir="${ver.dir.hle}"/>
377
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
378
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
379
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
380
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
381
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
382
       <delete file="./harvest-list-editor-${release}.zip"/>
383
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
384
       <delete file="./harvest-list-editor-${release}.tar.gz" />
385
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
386
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
387
             src="./harvest-list-editor-${release}.tar"/>
388
       <delete file="./harvest-list-editor-${release}.tar" />
389
   </target>
390
        
391
   <target  name="geteml" depends="getemlpre2,geteml2+,getConversionXSL" if="eml.required"
392
            description="Calls getemlpre2 and geteml2+ targets" />
393

    
394
   <target name="getemlpre2" depends="prepare" if="eml.required"
395
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
396
     <echo>Enter CVS password: </echo>
397
     <cvs cvsRoot="${cvsroot}"
398
          package="${eml-module}"
399
          tag="${eml-tag}"
400
          dest="${build.tmp}/eml_${eml-tag}" />
401
     <mkdir dir="lib/dtd" />
402
     <copy todir="lib/dtd" filtering="yes">
403
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
404
         <include name="*.dtd"/>
405
       </fileset>
406
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
407
     </copy>
408

    
409
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
410
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
411
       <include name="**/*.xsl"/>
412
     </fileset>
413
     </copy>
414
   </target>
415

    
416
   <target name="geteml2+" depends="prepare" if="eml.required"
417
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
418
     <echo>Enter CVS password: </echo>
419
     <cvs cvsRoot="${cvsroot}"
420
          package="${eml-module}"
421
          tag="${eml2_0_0-tag}"
422
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
423
     <mkdir dir="lib/schema/eml-2.0.0" />
424
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
425
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
426
         <include name="*.xsd"/>
427
       </fileset>
428

    
429
       <!-- shouldn't we have a mapper here like this??
430
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
431

432
       Jing's code didn't nave one - does it need to be added?
433
       NOTE that eml-version is set to beta 6, so this would need changing -->
434

    
435
     </copy>
436
     <!-- <antcall target="copyxsl">
437
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
438
        <param name="dirname" value="eml-2.0.0" />
439
     </antcall> -->
440
           
441
           <!-- Checkout eml201 for given schema tag-->
442
     <echo>Enter CVS password: </echo>
443
     <cvs cvsRoot="${cvsroot}"
444
          package="${eml-module}"
445
          tag="${eml2_0_1-schema-tag}"
446
          dest="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
447
     <mkdir dir="lib/schema/eml-2.0.1" />
448
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
449
       <fileset dir="${build.tmp}/eml_${eml2_0_1-schema-tag}/${eml-module}">
450
         <include name="*.xsd"/>
451
       </fileset>
452
     </copy>
453
           
454
           <!-- Checkout eml201 again for given style sheet tag-->
455
           <echo>Enter CVS password: </echo>
456
                <cvs cvsRoot="${cvsroot}"
457
                     package="${eml-module}"
458
                     tag="${eml2_0_1-style-tag}"
459
                     dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
460
     <antcall target="copyxsl">
461
        <param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
462
        <param name="dirname" value="eml-2.0.1" />
463
     </antcall>
464
        
465
           <!-- Checkout eml210 for given schema tag-->
466
     <echo>Enter CVS password: </echo>
467
     <cvs cvsRoot="${cvsroot}"
468
          package="${eml-module}"
469
          tag="${eml2_1_0-schema-tag}"
470
          dest="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
471
     <mkdir dir="lib/schema/eml-2.1.0" />
472
     <copy todir="lib/schema/eml-2.1.0" filtering="yes">
473
       <fileset dir="${build.tmp}/eml_${eml2_1_0-schema-tag}/${eml-module}">
474
         <include name="*.xsd"/>
475
       </fileset>
476
     </copy>
477
        
478
           <!-- Checkout eml210 for given style sheet tag-->
479
           <echo>Enter CVS password: </echo>
480
                <cvs cvsRoot="${cvsroot}"
481
                     package="${eml-module}"
482
                     tag="${eml2_1_0-style-tag}"
483
                     dest="${build.tmp}/eml_${eml2_1_0-style-tag}" />
484
     <antcall target="copyxsl">
485
        <param name="cvs.tagname" value="${eml2_1_0-style-tag}" />
486
        <param name="dirname" value="eml-2.1.0" />
487
     </antcall>
488
   </target>
489

    
490
   <target  name="copyxsl"
491
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
492

    
493
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
494

    
495
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
496
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
497
       <include name="**/*.xsl"/>
498
     </fileset>
499
     </copy>
500

    
501

    
502
     <!-- now copy default css from eml module and put it in style-common-path
503
          dir with a new name, so other skin-specific css can import it if reqd -->
504
     <copy file="${build.tmp}/eml_${cvs.tagname}/${eml-module}/${eml-module.default.css}"
505
           tofile="${style-common-cvsrelpath}/${eml-css}" />
506

    
507
   </target>
508
        
509
   <target name="correctEML201Docs" depends="jar"
510
                            description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
511
                   <copy todir="${build.dir}" file="lib/metacat.properties" filtering="yes"/>    
512
                    <java classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector" >
513
                         <classpath>
514
                          <path refid="compile.classpath"/>
515
                          <fileset dir="${build.dir}">
516
                            <include name="${name}.jar"/>
517
                          </fileset>
518
                        </classpath>
519
                      </java>
520
   </target>
521

    
522
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
523
           description="Installs spatial option for metacat">
524

    
525
      <property name="spatial.dir" value="./lib/spatial"/>
526
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
527
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
528

    
529
      <!-- Copy geoserver libs into ${war.lib} -->
530
      <copy todir="${war.lib}" filtering="no">
531
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
532
          <include name="**"/>
533
        </fileset>
534
      </copy>
535

    
536
      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
537
      <copy todir="${war.webinf}" filtering="no">
538
        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
539
          <exclude name="lib/**"/>
540
          <exclude name="web.xml"/>
541
        </fileset>
542
      </copy>
543

    
544
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
545
      <copy todir="${war.context}" filtering="no">
546
        <fileset dir="${spatial.geoserver.dir}">
547
          <exclude name="WEB-INF/**"/>
548
          <exclude name="index.jsp"/>
549
        </fileset>
550
      </copy>
551

    
552
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
553
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
554
          tofile="${war.context}/geoserver.jsp"
555
          overwrite="true"
556
          filtering="no"/>
557

    
558
      <!-- Copy the rest of the modified geoserver web-inf files
559
      <copy todir="${war.webinf}" filtering="no">
560
        <fileset dir="${spatial.webinf-mods}">
561
          <exclude name="web.xml.combined"/>
562
        </fileset>
563
      </copy> -->
564

    
565
    </target>
566

    
567
   <target name="dev-install" depends="clean, install-ecogrid" description="* Full Install For Development *">
568
     <copy file="${dist.dir}/${metacat.context}.war" todir="${dev.deploy.dir}"/>
569
            <delete dir="${dev.deploy.dir}/${metacat.context}" />
570
              <tstamp>
571
                       <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa"/>
572
              </tstamp>
573
            <echo>Dev install completed at ${NOW}</echo>                    
574
   </target>
575

    
576
<!--
577
   <target name="install" depends="install-ecogrid" description="* Full Install *">
578
       <mkdir dir="${datafilepath}" />
579
       <mkdir dir="${inlinedatafilepath}" />
580
       <chmod dir="${datafilepath}" perm="ug+w" />
581
       <mkdir dir="${temp-dir}"/>
582
       <chmod dir="${temp-dir}" perm="ug+w" />
583
       <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
584
              <echo>If you enable ecogrid installation, please run "ant deploy-ecogrid" when installation or upgrade is done</echo> 
585
   </target>
586
-->
587
        
588
   <target name="install-ecogrid" depends="war, get-ecogrid" if="enable.ecogrid"
589
                            description="Install Ecogrid Compentent">
590
             <ant antfile="build.xml" dir="${ecogrid-dir}" target ="clean" inheritall="false">
591
                    <property name="context" value="${metacat.context}"/>
592
                           <property name="target" value="${ecogrid-target-name}"/>
593
                           <!-- property name="metacat.dir" value="."/ -->
594
             </ant>
595
             <ant antfile="build.xml" dir="${ecogrid-dir}" target ="war" inheritall="false">
596
                <property name="context" value="${metacat.context}"/>
597
                <property name="target" value="${ecogrid-target-name}"/>
598
                <!-- property name="metacat.dir" value="."/ -->
599
             </ant>
600
             <war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
601
                <webinf dir="${ecogrid-dir}/lib">
602
                   <include name="server-config.wsdd"/>
603
                 </webinf>
604
             </war>
605
             <copy file="${ecogrid-dir}/build/${metacat.context}.war" todir="${dist.dir}" overwrite="true"/>
606
             
607
   
608
   </target>
609
   
610
   <target name="get-ecogrid" depends="init" if="ecogrid.required" description="Check out ecogrid module">
611
        <echo>Enter CVS password: </echo>
612
             <cvs cvsRoot="${cvsroot}"
613
                  package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
614
   </target>  
615
        
616
   <target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
617
            <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
618
                       <property name="context" value="${metacat.context}"/>
619
                       <property name="target" value="${ecogrid-target-name}"/>
620
                <property name="metacat.dir" value="."/>
621
                <property name="hostname" value="localhost"/>
622
                <property name="port" value="${config.port}"/>
623
            </ant>
624
   </target>
625
        
626
   <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
627
      <delete file="${dev.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
628
   </target>
629

    
630
   <!-- target name="install-registry" depends="init,getConversionXSL"
631
            description="Install Registry">
632

633
      <mkdir dir="${inst.cgi.dir}" />
634
      <copy file="${srcdir}/perl/register-dataset.cgi"
635
            todir="${inst.cgi.dir}"/>
636
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
637

638
      <! - - TODO SCW: set the permissions on this folder to be writable by the apache user - - >
639
      <mkdir dir="${temp-dir}" />
640
      <! - - TODO SCW: use relative paths to grab these instead of copying to tmp,
641
                     used in readDocumentFromMetacat - - >
642
      <copy todir="${temp-dir}" filtering="yes">
643
       <fileset dir="lib/style/common/emlb6toeml2">
644
         <include name="*.xsl"/>
645
         <include name="*.xml"/>
646
       </fileset>
647
      </copy>
648

649
      <echo message="Install Registry completed." />
650
   </target -->
651

    
652
   <!-- target name="install-ldap" depends="init"
653
            description="Install Metacat LDAP Access">
654

655
      <mkdir dir="${inst.cgi.dir}" />
656
      <copy file="${srcdir}/perl/ldapweb.cgi"
657
            todir="${inst.cgi.dir}" />
658
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
659
      <mkdir dir="${templates.dir}" />
660
      <copy todir="${templates.dir}">
661
        <fileset dir="lib/style/common/templates">
662
                        < ! - - SCW: Copy all files - - >
663
        </fileset>
664
      </copy>
665
      <echo message="ldapweb install complete." />
666
   </target -->
667

    
668

    
669
   <target name="install-skin" depends="init"
670
            description="Install a Skin">
671

    
672
      <input message="Please enter name of the skin"
673
             addproperty="skin-name"/>
674

    
675
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
676
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
677
       <fileset dir="lib/style/skins/${skin-name}">
678
           <exclude name="**/*.png"/>
679
           <exclude name="**/*.gif"/>
680
           <exclude name="**/*.jpg"/>
681
           <exclude name="**/CVS*"/>
682
           <exclude name="**/.#*"/>
683
       </fileset>
684
      </copy>
685
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
686
       <fileset dir="lib/style/skins/${skin-name}">
687
           <include name="**/*.png"/>
688
           <include name="**/*.gif"/>
689
           <include name="**/*.jpg"/>
690
           <exclude name="**/CVS*"/>
691
           <exclude name="**/.#*"/>
692
       </fileset>
693
      </copy>
694
      <copy todir="${installdir}/style/common" filtering="yes">
695
       <fileset dir="lib/style/common">
696
           <include name="*.js"/>
697
           <include name="*.jsp"/>
698
           <include name="*.css"/>
699
           <exclude name="*.png"/>
700
           <exclude name="*.gif"/>
701
           <exclude name="*.jpg"/>
702
           <exclude name="**/CVS*"/>
703
           <exclude name="**/.#*"/>
704
       </fileset>
705
      </copy>
706
      <!--
707
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
708
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
709
       <fileset dir="lib/style/skins/${skin-name}/images">
710
           <include name="*.png"/>
711
           <include name="*.gif"/>
712
           <include name="*.jpg"/>
713
       </fileset>
714
      </copy>
715
      -->
716

    
717
      <echo message="Install Skin completed." />
718
   </target>
719

    
720
   <target name="war" depends="warPrepare,install-spatial"
721
            description="Create a web archive (WAR) for servlet deployment">
722
       <mkdir dir="${dist.dir}" />
723
       <war destfile="${dist.dir}/${metacat.context}.war"
724
            webxml="${build.war}/web.xml">
725
         <fileset dir="${war.context}"/>
726
         <lib dir="${war.lib}"/>
727
         <webinf dir="${war.webinf}"/>
728
       </war>
729
   </target>
730
        
731
   <target name="warPrepare" depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
732
            description="Prepare files for creating a web archive (WAR)">
733

    
734
       <property name="war.lib" value="${build.war}/lib" />
735
       <property name="war.webinf" value="${build.war}/WEB-INF" />
736
       <property name="war.context" value="${build.war}/${metacat.context}" />
737
              <property name="war.webinf.sql" value="${war.webinf}/sql" />
738
           <property name="war.context.cgi" value="${war.context}/cgi-bin" />
739
              <property name="war.context.docs" value="${war.context}/docs" />
740
              <property name="war.context.temp" value="${war.context}/temp" />
741
              <property name="war.context.templates" value="${war.context}${style-common-relpath}/templates" />
742
       <mkdir dir="${war.lib}" />
743
       <mkdir dir="${war.webinf}" />
744
       <mkdir dir="${war.context}" />
745
              <mkdir dir="${war.webinf.sql}" />
746
           <mkdir dir="${war.context.cgi}" />
747
              <mkdir dir="${war.context.docs}" />
748
              <mkdir dir="${war.context.temp}" />
749
       <mkdir dir="${war.context.templates}" />
750
       
751
           <!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
752
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
753
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
754
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
755
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
756
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
757
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
758
       <copy todir="${war.lib}" filtering="no">
759
         <fileset dir="lib">
760
<!--
761
                 <not>
762
               <filename name="${jdbc-jar-name}"/>
763
            </not>
764
-->
765
            <include name="*.jar"/>
766
         </fileset>
767
         <fileset dir="lib">
768
           <include name="xalan.jar"/>
769
           <include name="gwt*.jar"/>
770
         </fileset>
771
       </copy>
772
       <!-- MCD copy file="lib/web.xml.${tomcatversion}"
773
             tofile="${build.war}/web.xml" / -->
774
       <!-- MCD added next - Remove the tomcat5 reference-->
775
              <copy file="lib/web.xml.tomcat5"
776
                        tofile="${build.war}/web.xml"/>
777
       <copy file="lib/metacat.properties" todir="${war.webinf}"
778
             filtering="yes" />
779
              <copy file="lib/metacat.properties.metadata.xml" todir="${war.webinf}"
780
                        filtering="no" />
781
           <copy file="lib/org.properties.metadata.xml" todir="${war.webinf}"
782
                     filtering="no" />
783
           <copy file="lib/auth.properties.metadata.xml" todir="${war.webinf}"
784
                     filtering="no" />
785
       <copy todir="${war.webinf}" filtering="yes">
786
                     <fileset dir="lib">
787
           <include name="skin.configs/**"/>
788
                  </fileset>
789
           </copy>
790
       <copy file="lib/log4j.properties" todir="${war.webinf}"
791
             filtering="yes" />
792
       <copy todir="${war.context}" filtering="no">
793
         <fileset dir="lib">
794
           <include name="**/*.jpg"/>
795
           <include name="**/*.png"/>
796
           <include name="**/*.gif"/>
797
           <include name="LiveMap_30/**"/>
798
         </fileset>
799
       </copy>
800
       <copy todir="${war.context}" filtering="yes">
801
         <fileset dir="lib">
802
           <exclude name="*.jar"/>
803
           <exclude name="*.properties"/>
804
                 <exclude name="*.metadata.xml"/>
805
           <exclude name="web.xml"/>
806
           <exclude name="**/*.jpg"/>
807
           <exclude name="**/*.png"/>
808
           <exclude name="**/*.gif"/>
809
           <exclude name="lsid_lib/**"/>
810
           <exclude name="lsid_conf/**"/>
811
           <exclude name="LiveMap_30/**"/>
812
           <exclude name="skin.configs/**"/>
813
           <exclude name="spatial/geoserver/**"/>
814
           <exclude name="spatial/WEB-INF/**"/>
815
         </fileset>
816
       </copy>
817
       <copy todir="${war.context.docs}" filtering="yes">
818
          <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
819
       </copy>
820
       <copy todir="${war.context.docs}" filtering="no">
821
          <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
822
       </copy>
823
           <copy todir="${war.webinf.sql}" filtering="yes">
824
                 <fileset dir="src">
825
                   <include name="**/*.sql"/>
826
                 </fileset>
827
           </copy>
828
           
829
              <copy file="src/perl/register-dataset.cgi" todir="${war.context.cgi}"/>
830
           <copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
831
           <copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
832
           
833
           <!-- registry cgi section -->
834
           <!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
835
                   used in readDocumentFromMetacat -->
836
           <!-- TODO MCD copy temp files to actual location using config util?? -->
837
           <copy todir="${war.context.temp}" filtering="yes">
838
                  <fileset dir="lib/style/common/emlb6toeml2">
839
                     <include name="*.xsl"/>
840
                        <include name="*.xml"/>
841
                  </fileset>
842
            </copy>
843
            <available file="lib/style/common/emlb6toeml2" type="dir"
844
                 property="styles.not.needed"/>
845
        
846
            <!-- ldap cgi section -->
847
            <copy todir="${war.context.templates}">
848
                    <fileset dir="lib/style/common/templates">
849
                            <!-- SCW: Copy all files -->
850
                    </fileset>
851
            </copy>
852
    </target>
853
        
854
        <target name="cgiPrepare">                
855
                <exec dir="src/perl/Metacat/" command="perl" >
856
                        <arg value="Makefile.PL" />
857
                </exec>
858
                <exec dir="src/perl/Metacat/" command="make" />
859
        </target>
860
        
861
        <target name="testPrepare"
862
                description="Copies test files into the war directories">
863
                <echo>in testPrepare</echo>
864
                <property name="war.context.test" value="${build.war}/${metacat.context}/test" />
865
                <mkdir dir="${war.context.test}" />
866
            <copy todir="${war.context.test}" filtering="yes">
867
                   <fileset dir="test/servertestfiles">
868
                  <include name="*/**"/>
869
                   </fileset>
870
                </copy>
871
        </target>
872

    
873
   <target name="getConversionXSL" depends="prepare"
874
            unless="styles.not.needed"
875
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
876

    
877
     <echo>Enter CVS password: </echo>
878
     <cvs cvsRoot="${cvsroot}"
879
          package="${eml-module}"
880
          tag="${eml2_0_1-style-tag}"
881
          dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
882

    
883
     <mkdir dir="lib/style/common/emlb6toeml2" />
884
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
885
       <fileset dir="${build.tmp}/eml_${eml2_0_1-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
886
         <include name="*.xsl"/>
887
         <include name="*.xml"/>
888
       </fileset>
889
      </copy>
890
   </target>
891

    
892
   <target name="testprep" depends="jar,clientjar,harvesterjar">
893
      <mkdir dir="${build.tests}"/>
894
      <copy todir="${build.tests}" filtering="yes">
895
        <fileset dir="${testdir}">
896
          <include name="edu/**"/>
897
        </fileset>
898
      </copy>
899
             <copy todir="${build.tests}" file="${testdir}/test.properties" filtering="yes"/>
900

    
901
      <!-- copy and compile the tests into a jar file -->
902
      <javac srcdir="${build.tests}"
903
             destdir="${build.tests}"
904
             debug="on"
905
             includes="**/*.java">
906
        <classpath>
907
          <path refid="compile.classpath"/>
908
          <fileset dir="${build.dir}">
909
            <include name="${name}.jar"/>
910
            <include name="${name}-client.jar"/>
911
            <include name="harvester.jar"/>
912
          </fileset>
913
        </classpath>
914
      </javac>
915

    
916
      <jar jarfile="${build.dir}/${name}-junittests.jar"
917
        basedir="${build.tests}"
918
                includes="**/*.class" />
919
   </target>
920

    
921
   <target name="test" depends="testprep"
922
            description="Uses the ant junit task to run all JUnit tests">
923

    
924
      <!-- use the ant "junit" task to run JUnit tests. -->
925
      <junit printsummary="yes" haltonfailure="no" fork="yes"
926
             haltonerror="no">
927
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
928
        <classpath>
929
          <path refid="compile.classpath"/>
930
          <fileset dir="${build.dir}">
931
            <include name="${name}.jar"/>
932
            <include name="${name}-client.jar"/>
933
            <include name="harvester.jar"/>
934
            <include name="${name}-junittests.jar"/>
935
          </fileset>
936
        </classpath>
937

    
938
        <formatter type="plain" />
939

    
940
        <batchtest fork="yes" todir="${build.dir}">
941
          <fileset dir="${build.tests}">
942
            <include name="**/*.class"/>
943
                  <exclude name="**/MCTestCase.class" />
944
                  <exclude name="**/ClientViewHelperTest.class" />
945
          </fileset>
946
        </batchtest>
947
     </junit>
948
   </target>
949

    
950
    <target name="runonetest" depends="testprep"
951
            description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
952

    
953
              <echo>testtorun: ${testtorun}</echo>
954

    
955
      <!-- use the ant "junit" task to run JUnit tests. -->
956
      <junit printsummary="yes" haltonfailure="no" fork="yes"
957
             haltonerror="no" showoutput="yes">
958
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
959
        <classpath>
960
          <path refid="compile.classpath"/>
961
          <fileset dir="${build.dir}">
962
            <include name="${name}.jar"/>
963
            <include name="${name}-client.jar"/>
964
            <include name="harvester.jar"/>
965
            <include name="${name}-junittests.jar"/>
966
          </fileset>
967
        </classpath>
968

    
969
        <formatter type="plain" />
970

    
971
        <batchtest fork="yes" todir="${build.dir}">
972
          <fileset dir="${build.tests}">
973
            <include name="**/${testtorun}.class" />
974
          </fileset>
975
        </batchtest>
976
     </junit>
977
   </target>
978

    
979
   <target name="testharvester"
980
           depends="testprep"
981
           description="Uses the ant junit task to test only the Harvester code">
982
     <junit printsummary="yes"
983
            haltonfailure="off"
984
            fork="yes"
985
            haltonerror="off">
986
        <classpath>
987
          <path refid="compile.classpath"/>
988
          <fileset dir="${build.dir}">
989
            <include name="${name}.jar"/>
990
            <include name="${name}-client.jar"/>
991
            <include name="harvester.jar"/>
992
            <include name="${name}-junittests.jar"/>
993
          </fileset>
994
        </classpath>
995
       <formatter type="plain" />
996
       <batchtest fork="yes" todir="${build.dir}">
997
         <fileset dir="${build.tests}">
998
           <include name="**/harvesterClient/*.class" />
999
         </fileset>
1000
       </batchtest>
1001
     </junit>
1002
   </target>
1003

    
1004
  <target name="gethttpclient" depends="prepare"
1005
            description="checks out and compiles morpho httpclient code">
1006
  <!--mkdir dir="${morphosourcedir}" -->
1007
        <cvs cvsRoot="${cvsroot}"
1008
             package="morpho"
1009
             dest="." />
1010
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1011
   </target>
1012

    
1013
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
1014
   <target name="nettest" depends="dev-install"
1015
            description="compiles and runs the metacatnettest code">
1016

    
1017
      <echo>***********************************
1018
      Please run ant gethttpclient first!
1019
      ***********************************
1020
      </echo>
1021
      <!-- copy and compile the tests into a jar file -->
1022
      <mkdir dir="${build.metacatnettest}"/>
1023
      <javac srcdir="${junitnettestsdir}"
1024
             destdir="${build.metacatnettest}"
1025
             includes="**/*.java">
1026
        <classpath>
1027
          <path refid="compile.classpath"/>
1028
          <fileset dir="${build.dir}">
1029
            <include name="${name}.jar"/>
1030
          </fileset>
1031
        </classpath>
1032
      </javac>
1033

    
1034
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1035
                    basedir="${build.metacatnettest}"
1036
                    includes="**/*.class" />
1037

    
1038
      <!-- use the ant "junit" task to run JUnit tests. -->
1039
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1040
             haltonerror="no">
1041
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1042
        <classpath>
1043
          <path refid="compile.classpath"/>
1044
          <fileset dir="${build.dir}">
1045
            <include name="${name}.jar"/>
1046
            <include name="${name}-junitnettests.jar"/>
1047
          </fileset>
1048
        </classpath>
1049

    
1050
        <formatter type="plain" />
1051

    
1052
        <batchtest fork="yes" todir="${build.dir}">
1053
          <fileset dir="${build.metacatnettest}">
1054
            <include name="**/*.class" />
1055
          </fileset>
1056
        </batchtest>
1057
     </junit>
1058
   </target>
1059

    
1060
   <target name="cleanweb" depends="clean"
1061
            description="deletes tomcat web context dir and all its contents">
1062
     <delete dir="${installdir}" />
1063
   </target>
1064

    
1065

    
1066
   <target name="clean" depends="init"
1067
            description="deletes build dir and files that can be regenerated form the release">
1068
       <delete dir="${build.dir}" />
1069
       <delete dir="${dist.dir}" />
1070
   </target>
1071

    
1072
        <target name="localclean" depends="clean"
1073
                    description="deletes even jars that depend on external sources such as stylesheets and jars">
1074
               <delete file="lib/httpclient.jar" />
1075
               <delete file="lib/utilities.jar" />
1076
        </target>        
1077
        
1078
   <target name="fullclean" depends="localclean"
1079
            description="deletes code and eml">
1080
       <delete includeEmptyDirs="true" failonerror="false">
1081
         <fileset dir="${style-common-cvsrelpath}">
1082
           <include name="${eml-css}" />
1083
           <include name="eml-*/*.xsl" />
1084
           <include name="eml-*" />
1085
         </fileset>
1086
                <fileset dir="${schema-cvsrelpath}">
1087
                  <include name="eml-*/*.xsd" />
1088
                </fileset>
1089
                <fileset dir="${ecogrid-dir}">
1090
                       <include name="build.properties" />
1091
                       <include name="buildfiles/metacatImpl.xml" />
1092
         </fileset>
1093
       </delete>
1094
   </target>
1095

    
1096
   <target name="jdoc" depends="prepare"
1097
            description="generates javadoc documentation">
1098
       <javadoc packagenames="edu.ucsb.nceas.*"
1099
           sourcepath="${build.src}"
1100
           destdir="${build.javadocs}"
1101
           author="true"
1102
           version="true"
1103
           use="true"
1104
           windowtitle="${Name} API"
1105
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1106
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1107
         <classpath>
1108
           <path refid="compile.classpath"/>
1109
         </classpath>
1110
       </javadoc>
1111
   </target>
1112

    
1113
   <target name="dist"
1114
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1115
            description="prepares a full release distribution">
1116
      <mkdir dir="${dist.dir}"/>
1117
      <delete dir="${ver.dir}" />
1118
      <mkdir dir="${ver.dir}"/>
1119
      <copy todir="${ver.dir}">
1120
        <fileset dir="."
1121
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1122
      </copy>
1123
      <copy todir="${ver.dir}" file="build.xml"/>
1124
      <copy todir="${ver.dir}" file="build.properties"/>
1125

    
1126
      <copy todir="${ver.dir}/docs" filtering="yes">
1127
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1128
      </copy>
1129
      <copy todir="${ver.dir}/docs" filtering="no">
1130
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1131
      </copy>
1132
      <copy todir="${ver.dir}/docs/dev">
1133
        <fileset dir="${build.dir}/docs"/>
1134
      </copy>
1135
      <copy todir="${ver.dir}/src">
1136
        <fileset dir="${build.dir}/src"/>
1137
      </copy>
1138
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1139
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/ -->
1140
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/ -->
1141
      <!--
1142
      <delete dir="./${ver.dir}/${build.dir}"/>
1143
      <delete dir="./${ver.dir}/dist"/>
1144
      -->
1145
      <!-- delete file="./${name}-${release}.zip"/>
1146
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1147
      <delete file="./${name}-${release}.tar.gz" />
1148
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1149
      <gzip zipfile="./${name}-${release}.tar.gz"
1150
                src="./${name}-${release}.tar"/>
1151
      <delete file="./${name}-${release}.tar" / -->
1152
  </target>
1153

    
1154
        <target name="distbin" depends="install-ecogrid,war-lsid,war" description="prepares a binary distribution">
1155
                <copy todir="${dist.dir}">
1156
                        <fileset dir="./bin/install"  />
1157
                </copy>        
1158
                <delete file="./${name}-bin-${release}.zip" />
1159
                <zip zipfile="./${name}-bin-${release}.zip" 
1160
                        basedir="${dist.dir}"
1161
                        excludes="metacat-*/**"/>        
1162
                <delete file="./${name}-bin-${release}.tar.gz" />
1163
                <tar tarfile="./${name}-bin-${release}.tar" 
1164
                        basedir="${dist.dir}" 
1165
                        excludes="metacat-*/**"/>
1166
                <gzip zipfile="./${name}-bin-${release}.tar.gz" src="./${name}-bin-${release}.tar" />
1167
                <delete file="./${name}-bin-${release}.tar" />
1168
                <delete dir="${dist.dir}" />
1169
        </target>
1170
        
1171
  <target name="distsrc" depends="dist"
1172
            description="prepares a source distribution">
1173
      <mkdir dir="${ver.src}"/>
1174
      <copy todir="${ver.src}">
1175
        <fileset dir="./src"/>
1176
      </copy>
1177
      <mkdir dir="${util.dir}"/>
1178
      <copy todir="${util.dir}">
1179
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1180
      </copy>
1181
            
1182
            <mkdir dir="${ecogrid-dist-dir}"/>
1183
            <copy todir="${ecogrid-dist-dir}">
1184
                  <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1185
            </copy>
1186

    
1187
      <delete file="${ver.dir}/lib/utilities.jar"/>
1188

    
1189
      <delete file="./${name}-src-${release}.zip"/>
1190
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1191
      <delete file="./${name}-src-${release}.tar.gz" />
1192
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1193
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1194
                src="./${name}-src-${release}.tar"/>
1195
      <delete file="./${name}-src-${release}.tar" />
1196
      <delete dir="${dist.dir}"/> 
1197
  </target>
1198

    
1199
   <target name="stylesheettest">
1200
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1201
      <param name="displaymodule" expression="${displaymodule}"/>
1202
      <param name="docid" expression="${input}"/>
1203
      <param name="entitytype" expression="${entitytype}"/>
1204
      <param name="entityindex" expression="${entityindex}"/>
1205
      <outputproperty name="method" value="html"/>
1206
      <outputproperty name="standalone" value="yes"/>
1207
      <outputproperty name="encoding" value="iso8859_1"/>
1208
      <outputproperty name="indent" value="yes"/>
1209
    </xslt>
1210
  </target>
1211

    
1212
 
1213
  <target name="compilewebclient" depends="prepare">
1214
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1215
  </target>
1216

    
1217
  <target name="runwebclient" depends="compilewebclient">
1218
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1219
           dir="${build.dest}" fork="yes"
1220
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1221
         <arg value="${serviceUrl}"/>
1222
         <arg value="${docid}"/>
1223
     </java>
1224
  </target>
1225
  
1226
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1227

    
1228
    <echo message="Compiling the metatcat shapefile creator"/>
1229
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1230
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1231
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1232
    </exec>
1233
  
1234
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1235
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1236
    </exec>
1237
  </target>
1238

    
1239
    <!-- LSID Authority support -->
1240
    <patternset id="lsid.jars">
1241
        <include name="axis.jar" />
1242
        <include name="commons-discovery-0.2.jar" />
1243
        <include name="jaxrpc.jar" />
1244
        <include name="lsid-client-1.1.1.jar" />
1245
        <include name="lsid-server-1.1.1.jar" />
1246
        <include name="saaj.jar" />
1247
        <include name="wsdl4j-1.5.1.jar" />
1248
        <include name="activation.jar" />
1249
        <include name="castor-0.9.5.jar" />
1250
        <include name="dnsjava-1.3.2.jar" />
1251
        <include name="mail.jar" />
1252
        <include name="commons-logging-1.0.4.jar" />
1253
        <!-- These jars may be needed but seem to not actually be,
1254
             so leaving them out for now
1255
        <include name="axis-ant.jar" />
1256
        -->
1257
        <!--<include name="GenCastor.class" />-->
1258
    </patternset>
1259
    <patternset id="lib.jars">
1260
        <include name="httpclient.jar" />
1261
        <include name="log4j-1.2.12.jar" />
1262
        <include name="utilities.jar" />
1263
        <include name="xercesImpl.jar" />
1264
        <include name="xalan.jar" />
1265
        <include name="xml-apis.jar" />
1266
    </patternset>
1267

    
1268
    <path id="lsid.classpath">
1269
        <fileset dir="${lsid.lib.dir}">
1270
            <patternset refid="lsid.jars"/>
1271
        </fileset>
1272
        <fileset dir="${lib.dir}">
1273
            <patternset refid="lsid.jars"/>
1274
        </fileset>
1275
        <fileset dir="${lib.dir}">
1276
            <include name="xalan.jar" />
1277
            <include name="xml-apis.jar" />
1278
        </fileset>
1279
        <fileset dir="${build.dir}">
1280
            <include name="metacat-client.jar" />
1281
        </fileset>
1282
    </path>
1283

    
1284
    <filterset id="configFilters">
1285
        <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1286
                value="${config.hostname}" / -->
1287
        <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1288
                value="${config.port}" / -->
1289
        <!-- MCD BYE filter token="METADATA_LABELS"
1290
                value="${config.metadataLabelLsid}" / -->
1291
        <!-- MCD BYE filter token="METACAT_SERVER"
1292
                value="${config.metacatserver}" / -->
1293
        <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1294
                value="${config.lsidauthority}" / -->
1295
    </filterset>
1296
    
1297
    <target name="prepare-lsid"
1298
            depends="prepare,utilities,clientjar"
1299
            description="Configure files prior to compilation">
1300
        <mkdir dir="${lsid.build.dir}" />
1301
        <!-- Copy the properties file into the build -->
1302
        <copy file="${conf.dir}/metacat-lsid.properties"
1303
              tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1304
              overwrite="true">
1305
            <filterset refid="configFilters" />
1306
        </copy>
1307
        <copy file="${conf.dir}/log4j.properties"
1308
              tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1309
              overwrite="true">
1310
            <filterset refid="configFilters" />
1311
        </copy>
1312
        <!-- Copy config files into the build -->
1313
        <copy todir="${lsid.build.dir}/WEB-INF">
1314
            <fileset dir="${webinf.dir}"
1315
                     includes="**/*.wsdd" />
1316
        </copy>
1317
        <!-- Copy the metadata configuration files into the build -->
1318
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1319
        <copy todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1320
            <fileset dir="${conf.dir}"
1321
                     includes="**/*.xml" />
1322
            <fileset dir="${conf.dir}"
1323
                     includes="**/*.xslt" />
1324
            <filterset refid="configFilters" />
1325
        </copy>
1326
        <!-- Copy services files into the build -->
1327
        <mkdir dir="${lsid.build.dir}/services" />
1328
        <copy todir="${lsid.build.dir}/services">
1329
            <fileset dir="${services.dir}" />
1330
            <filterset refid="configFilters" />
1331
        </copy>
1332
        <!-- Copy axis files into the build -->
1333
        <mkdir dir="${lsid.build.dir}" />
1334
        <copy todir="${lsid.build.dir}">
1335
            <fileset dir="${conf.dir}/axis"
1336
                     excludes="*.properties"/>
1337
        </copy>
1338
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1339
        <copy todir="${lsid.build.dir}/WEB-INF/classes">
1340
            <fileset dir="${conf.dir}/axis"
1341
                     includes="*.properties"/>
1342
        </copy>
1343
    </target>
1344
    
1345
    <target name="compile-lsid"
1346
            depends="prepare-lsid"
1347
            description="Compile Java sources">
1348
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1349
        <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1350
               destdir="${lsid.build.dir}/WEB-INF/classes"
1351
               debug="${compile.debug}"
1352
               deprecation="${compile.deprecation}"
1353
               optimize="${compile.optimize}">
1354
            <classpath refid="lsid.classpath" />
1355
        </javac>
1356
    </target>
1357
    
1358
    <target name="war-lsid"
1359
            depends="compile-lsid"
1360
            description="Create a war file for the application">
1361
        <mkdir dir="${dist.dir}" />
1362
        <war destfile="${dist.dir}/${authority.context}.war"
1363
             webxml="${webinf.dir}/web.xml">
1364
            <fileset dir="${lsid.build.dir}" />
1365
            <lib dir="${lsid.lib.dir}">
1366
                <patternset refid="lsid.jars"/>
1367
            </lib>
1368
            <lib dir="${lib.dir}">
1369
                <patternset refid="lib.jars"/>
1370
            </lib>
1371
            <lib dir="${lib.dir}">
1372
                <include name="xalan.jar" />
1373
                <include name="xml-apis.jar" />
1374
            </lib>
1375
            <lib dir="${build.dir}">
1376
                <include name="metacat-client.jar" />
1377
            </lib>
1378
        </war>
1379
    </target>
1380
    
1381
    <target name="deploy-lsid"
1382
            depends="war-lsid"
1383
            description="Deploy LSID war to servlet container">
1384
        <delete dir="${dev.deploy.dir}/${authority.context}" />
1385
        <delete file="${dev.deploy.dir}/${authority.context}.war" />
1386
        <mkdir dir="${dev.deploy.dir}" />
1387
        <copy todir="${dev.deploy.dir}">
1388
            <fileset dir="${dist.dir}" />
1389
        </copy>
1390
    </target>
1391
</project>