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-05 13:23:44 -0800 (Wed, 05 Nov 2008) $'
11
  *    '$Revision: 4515 $'
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
   <condition property="enable.testBuild">
44
      <equals arg1="${test.build}" arg2="true" />   	 
45
   </condition>
46

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

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

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

    
67
      <echo>*********** set jsdk to ${jsdk}</echo>
68
  </target>
69

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

    
84
        <!-- Include geoserver, geotools, et. al. -->
85
        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
86
          <include name="*.jar"/>
87
        </fileset>
88
        <pathelement location="lib/spatial/geoserver/WEB-INF/classes"/>
89

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

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

    
151
      <filter token="docrooturl"           value="./" />
152
      <filter token="mcuser"               value="${mcuser}"/>
153
      <filter token="mcpassword"           value="${mcpassword}"/>
154
      <filter token="mcanotheruser"        value="${mcanotheruser}"/>
155
      <filter token="mcanotherpassword"    value="${mcanotherpassword}"/>
156
      <filter token="eml-css"              value="${eml-css}"/>
157
      <filter token="style-skins-relpath"  value="${style-skins-relpath}"/>
158
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
159

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

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

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

    
259
   </target>
260

    
261
   <target name="prepare" depends="init">
262
      <mkdir dir="${build.dir}"/>
263
      <mkdir dir="${build.src}"/>
264
      <mkdir dir="${build.dest}"/>
265
      <mkdir dir="${build.javadocs}"/>
266
      <mkdir dir="${build.tmp}"/>
267

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

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

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

    
295
   <target name="jar" depends="compile,geteml"
296
    description="Compiles and jars metacat java code to metacat.jar in build dir ">
297

    
298
       <delete file="${build.dir}/${name}.jar" />
299
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
300
            excludes="**/protocols/ **/harvesterClient/" />
301
   </target>
302

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
494
   <target  name="copyxsl"
495
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
496

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

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

    
505

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

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

    
526
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
527
           description="Installs spatial option for metacat">
528

    
529
      <property name="spatial.dir" value="./lib/spatial"/>
530
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
531
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
532

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

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

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

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

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

    
569
    </target>
570

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

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

    
634
   <!-- target name="install-registry" depends="init,getConversionXSL"
635
            description="Install Registry">
636

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

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

    
653
      <echo message="Install Registry completed." />
654
   </target -->
655

    
656
   <!-- target name="install-ldap" depends="init"
657
            description="Install Metacat LDAP Access">
658

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

    
672

    
673
   <target name="install-skin" depends="init"
674
            description="Install a Skin">
675

    
676
      <input message="Please enter name of the skin"
677
             addproperty="skin-name"/>
678

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

    
721
      <echo message="Install Skin completed." />
722
   </target>
723

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

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

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

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

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

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

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

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

    
925
   <target name="test" depends="testprep"
926
            description="Uses the ant junit task to run all JUnit tests">
927

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

    
942
        <formatter type="plain" />
943

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

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

    
957
              <echo>testtorun: ${testtorun}</echo>
958

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

    
973
        <formatter type="plain" />
974

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

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

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

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

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

    
1038
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1039
                    basedir="${build.metacatnettest}"
1040
                    includes="**/*.class" />
1041

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

    
1054
        <formatter type="plain" />
1055

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

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

    
1069

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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