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: daigle $'
10
  *    '$Date: 2008-11-24 11:51:33 -0800 (Mon, 24 Nov 2008) $'
11
  *    '$Revision: 4619 $'
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
      <property name="morphosourcedir"     value="../morpho" />
57
      <property name="utilitiesdir"        value="../utilities" />
58
      <property name="installdir"        value="${dev.deploy.dir}/${metacat.context}" />
59

    
60
      <echo>*********** set jsdk to ${jsdk}</echo>
61
  </target>
62

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

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

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

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

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

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

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

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

    
254
   </target>
255

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
502

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

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

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

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

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

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

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

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

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

    
566
    </target>
567

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

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

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

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

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

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

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

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

    
669

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
939
        <formatter type="plain" />
940

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

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

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

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

    
970
        <formatter type="plain" />
971

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

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

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

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

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

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

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

    
1051
        <formatter type="plain" />
1052

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

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

    
1066

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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