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: 2009-02-27 12:05:16 -0800 (Fri, 27 Feb 2009) $'
11
  *    '$Revision: 4820 $'
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 ecogrid should be installed-->
39
  <condition property="enable.ecogrid">
40
    <equals arg1="${install.ecogrid}" arg2="true" />
41
  </condition>
42
  
43
  <!-- Determine if perl should be built-->
44
  <condition property="build.perl">
45
    <equals arg1="${make.perl.code}" arg2="true" />
46
  </condition>
47

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

    
60
      <property name="debug"               value="on" />
61
      <property name="morphosourcedir"     value="../morpho" />
62
      <property name="utilitiesdir"        value="../utilities" />
63
      <property name="installdir"        value="${app.deploy.dir}/${metacat.context}" />
64

    
65
      <echo>*********** set jsdk to ${jsdk}</echo>
66
  </target>
67

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

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

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

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

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

    
159
      <filter token="eml-version"          value="${eml-version}"/>
160
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
161
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
162
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
163
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
164
      <filter token="debugprefix"          value="${debugprefix}"/>
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
      <property name="test.dir"            value="${dist.dir}/test"/>
214
	  <!-- directories for creating a Harvest List Editor distribution -->
215
      <property name="dist.dir.hle"        value="disthle"/>
216
      <property name="ver.dir.hle"         value="${dist.dir.hle}/harvest-list-editor-${release}"/>
217
   	  <property name="pkg.dir"             value="./package" />
218
   	  <property name="deb.pkg.dir"         value="${pkg.dir}/debian" />
219
	  
220
   	  <property name="ecogrid-target-name" value="metacatImpl"/>
221
   	  <property name="ecogrid-module-dest-dir" value =".."/>
222
   	  <property name="ecogrid-module"      value="seek/projects/ecogrid"/>
223
   	  <property name="ecogrid-dist-dir"    value="${dist.dir}/${ecogrid-module}"/>
224
   	  <property name="ecogrid-dir"         value="${ecogrid-module-dest-dir}/${ecogrid-module}"/>
225

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

    
257
   </target>
258

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
503

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

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

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

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

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

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

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

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

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

    
567
    </target>
568

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

    
578
   <target name="build-metacat" depends="install-ecogrid"
579
   	            description="Build Metacat">
580
   </target>
581
	
582
   <target name="install-ecogrid" depends="warPrepare, get-ecogrid" if="enable.ecogrid"
583
			    description="Install Ecogrid Compentent">
584
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="clean" inheritall="false">
585
   	         <property name="context" value="${metacat.context}"/>
586
   	   	     <property name="target" value="${ecogrid-target-name}"/>
587
   	   	     <!-- property name="metacat.dir" value="."/ -->
588
   	  </ant>
589
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="war" inheritall="false">
590
   	     <property name="context" value="${metacat.context}"/>
591
   	     <property name="target" value="${ecogrid-target-name}"/>
592
   	     <!-- property name="metacat.dir" value="."/ -->
593
   	  </ant>
594
   	  <!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
595
  	      <webinf dir="${ecogrid-dir}/lib">
596
   	        <include name="server-config.wsdd"/>
597
   	      </webinf>
598
   	  </war -->
599
   	  <copy file="${ecogrid-dir}/build/${metacat.context}.war" todir="${dist.dir}" overwrite="true"/>
600
   	  
601
   
602
   </target>
603
   
604
   <target name="get-ecogrid" depends="init" if="ecogrid.required" description="Check out ecogrid module">
605
	<echo>Enter CVS password: </echo>
606
	     <cvs cvsRoot="${cvsroot}"
607
	          package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
608
   </target>  
609
	
610
   <target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
611
   	 <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
612
   	   	 <property name="context" value="${metacat.context}"/>
613
   	   	 <property name="target" value="${ecogrid-target-name}"/>
614
   	     <property name="metacat.dir" value="."/>
615
   	     <property name="hostname" value="${ecogrid.hostname}"/>
616
   	     <property name="port" value="${config.port}"/>
617
   	 </ant>
618
   </target>
619
	
620
   <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
621
      <delete file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
622
   </target>
623

    
624
   <!-- target name="install-registry" depends="init,getConversionXSL"
625
            description="Install Registry">
626

    
627
      <mkdir dir="${inst.cgi.dir}" />
628
      <copy file="${srcdir}/perl/register-dataset.cgi"
629
            todir="${inst.cgi.dir}"/>
630
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
631

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

    
643
      <echo message="Install Registry completed." />
644
   </target -->
645

    
646
   <!-- target name="install-ldap" depends="init"
647
            description="Install Metacat LDAP Access">
648

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

    
662

    
663
   <target name="install-skin" depends="init"
664
            description="Install a Skin">
665

    
666
      <input message="Please enter name of the skin"
667
             addproperty="skin-name"/>
668

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

    
711
      <echo message="Install Skin completed." />
712
   </target>
713

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

    
728
       <property name="war.lib" value="${build.war}/lib" />
729
       <property name="war.webinf" value="${build.war}/WEB-INF" />
730
       <property name="war.context" value="${build.war}/${metacat.context}" />
731
   	   <property name="war.webinf.sql" value="${war.webinf}/sql" />
732
   	   <property name="war.webinf.scripts" value="${war.webinf}/scripts" />
733
	   <property name="war.context.cgi" value="${war.context}/cgi-bin" />
734
   	   <property name="war.context.docs" value="${war.context}/docs" />
735
   	   <property name="war.context.temp" value="${war.context}/temp" />
736
   	   <property name="war.context.templates" value="${war.context}${style-common-relpath}/templates" />
737
       <mkdir dir="${war.lib}" />
738
       <mkdir dir="${war.webinf}" />
739
       <mkdir dir="${war.context}" />
740
   	   <mkdir dir="${war.webinf.sql}" />
741
	   <mkdir dir="${war.context.cgi}" />
742
   	   <mkdir dir="${war.context.docs}" />
743
   	   <mkdir dir="${war.context.temp}" />
744
       <mkdir dir="${war.context.templates}" />
745
       
746
	   <!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
747
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
748
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
749
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
750
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
751
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
752
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
753
       <copy todir="${war.lib}" filtering="no">
754
         <fileset dir="lib">
755
<!--
756
         	<not>
757
               <filename name="${jdbc-jar-name}"/>
758
            </not>
759
-->
760
            <include name="*.jar"/>
761
         </fileset>
762
         <fileset dir="lib">
763
           <include name="xalan.jar"/>
764
           <include name="gwt*.jar"/>
765
         </fileset>
766
       </copy>
767
       <!-- MCD copy file="lib/web.xml.${tomcatversion}"
768
             tofile="${build.war}/web.xml" / -->
769
       <!-- MCD added next - Remove the tomcat5 reference-->
770
   	   <copy file="lib/web.xml.tomcat5"
771
   	             tofile="${build.war}/web.xml"/>
772
       <copy file="lib/metacat.properties" todir="${war.webinf}"
773
             filtering="yes" />
774
   	   <copy file="lib/metacat.properties.metadata.xml" todir="${war.webinf}"
775
   	             filtering="no" />
776
	   <copy file="lib/org.properties.metadata.xml" todir="${war.webinf}"
777
	             filtering="no" />
778
	   <copy file="lib/auth.properties.metadata.xml" todir="${war.webinf}"
779
	             filtering="no" />
780
       <copy todir="${war.webinf}" filtering="yes">
781
	   	  <fileset dir="lib">
782
           <include name="skin.configs/**"/>
783
		  </fileset>
784
	   </copy>
785
       <copy file="lib/log4j.properties" todir="${war.webinf}"
786
             filtering="yes" />
787
       <copy todir="${war.context}" filtering="no">
788
         <fileset dir="lib">
789
           <include name="**/*.jpg"/>
790
           <include name="**/*.png"/>
791
           <include name="**/*.gif"/>
792
           <include name="LiveMap_30/**"/>
793
         </fileset>
794
       </copy>
795
       <copy todir="${war.context}" filtering="yes">
796
         <fileset dir="lib">
797
           <exclude name="*.jar"/>
798
           <exclude name="*.properties"/>
799
         	<exclude name="*.metadata.xml"/>
800
           <exclude name="web.xml"/>
801
           <exclude name="**/*.jpg"/>
802
           <exclude name="**/*.png"/>
803
           <exclude name="**/*.gif"/>
804
           <exclude name="lsid_lib/**"/>
805
           <exclude name="lsid_conf/**"/>
806
           <exclude name="LiveMap_30/**"/>
807
           <exclude name="skin.configs/**"/>
808
           <exclude name="spatial/geoserver/**"/>
809
           <exclude name="spatial/WEB-INF/**"/>
810
         </fileset>
811
       </copy>
812
       <copy todir="${war.context.docs}" filtering="yes">
813
          <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
814
       </copy>
815
       <copy todir="${war.context.docs}" filtering="no">
816
          <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
817
       </copy>
818
	   <copy todir="${war.webinf.sql}" filtering="yes">
819
	         <fileset dir="src">
820
	           <include name="**/*.sql"/>
821
	         </fileset>
822
	   </copy>
823
	   <copy todir="${war.webinf.scripts}" filtering="yes">
824
	         <fileset dir="src/scripts"/>
825
	   </copy>
826
       <copy todir="${war.webinf.scripts}" 
827
             file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
828
             failonerror="false"/>
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" if="build.perl">	
856
		<exec dir="src/perl/Metacat/" executable="make" >
857
			<arg value="clean" />
858
		</exec>	
859
		<exec dir="src/perl/Metacat/" executable="perl" >
860
			<arg value="Makefile.PL" />
861
		</exec>
862
		<exec dir="src/perl/Metacat/" executable="make" />
863
	</target>
864
	
865
	<target name="testPrepare"
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="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}/** metacat*.tar.gz metacat*.tar metacat*.zip"/>
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
   	
1143
   	  <mkdir dir="${ver.dir}/tests/servertestfiles"/>
1144
	  <copy todir="${ver.dir}/test/servertestfiles">
1145
	    <fileset dir="./test/servertestfiles"/>
1146
	  </copy>
1147
  </target>
1148

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

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

    
1183
      <delete file="./${name}-src-${release}.zip"/>
1184
      <zip zipfile="./${name}-src-${release}.zip" 
1185
      	   basedir="${dist.dir}"
1186
      	   excludes="metacat*.tar.gz,metacat*.zip"/>
1187
      <delete file="./${name}-src-${release}.tar.gz" />
1188
      <tar tarfile="./${name}-src-${release}.tar" 
1189
      	   basedir="${dist.dir}"
1190
      	   excludes="metacat*.tar.gz,metacat*.zip"/>
1191
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1192
                src="./${name}-src-${release}.tar"/>
1193
      <delete file="./${name}-src-${release}.tar" />
1194
      <!--delete dir="${dist.dir}"/ --> 
1195
  </target>
1196
	
1197
  <target name="deb-package" depends="distbin"
1198
  	  description="create a debian installation package">
1199
  	<delete dir="${deb.pkg.dir}"/>
1200
    <mkdir dir="${deb.pkg.dir}/DEBIAN"/>
1201
  	<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1202
      <fileset dir="./src/scripts/debian"
1203
               includes="control postinst"/>
1204
    </copy>
1205
  	
1206
    <mkdir dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"/>
1207
  	<copy todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1208
  		  filtering="yes">
1209
      <fileset dir="./src/scripts/debian"
1210
               excludes="control postinst" />
1211
    </copy>
1212
  	<chmod file="${deb.pkg.dir}/DEBIAN/postinst" 
1213
  	       perm="755"/>
1214
  	
1215
  	<copy file="${dist.dir}/knb.war" 
1216
  		  todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"/>
1217
  	<copy file="./metacat-bin-${metacat.version}.tar.gz" 
1218
  		  tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1219
  	
1220
    <exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix" failonerror="true">
1221
      <arg line="--build debian" />   	
1222
    </exec>
1223
  	
1224
  	<move file="${pkg.dir}/debian.deb" 
1225
  		  tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb"/>
1226
  </target>
1227

    
1228
   <target name="stylesheettest">
1229
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1230
      <param name="displaymodule" expression="${displaymodule}"/>
1231
      <param name="docid" expression="${input}"/>
1232
      <param name="entitytype" expression="${entitytype}"/>
1233
      <param name="entityindex" expression="${entityindex}"/>
1234
      <outputproperty name="method" value="html"/>
1235
      <outputproperty name="standalone" value="yes"/>
1236
      <outputproperty name="encoding" value="iso8859_1"/>
1237
      <outputproperty name="indent" value="yes"/>
1238
    </xslt>
1239
  </target>
1240

    
1241
 
1242
  <target name="compilewebclient" depends="prepare">
1243
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1244
  </target>
1245

    
1246
  <target name="runwebclient" depends="compilewebclient">
1247
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1248
           dir="${build.dest}" fork="yes"
1249
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1250
         <arg value="${serviceUrl}"/>
1251
         <arg value="${docid}"/>
1252
     </java>
1253
  </target>
1254
  
1255
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1256

    
1257
    <echo message="Compiling the metatcat shapefile creator"/>
1258
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1259
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1260
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1261
    </exec>
1262
  
1263
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1264
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1265
    </exec>
1266
  </target>
1267

    
1268
    <!-- LSID Authority support -->
1269
    <patternset id="lsid.jars">
1270
        <include name="axis.jar" />
1271
        <include name="commons-discovery-0.2.jar" />
1272
        <include name="jaxrpc.jar" />
1273
        <include name="lsid-client-1.1.1.jar" />
1274
        <include name="lsid-server-1.1.1.jar" />
1275
        <include name="saaj.jar" />
1276
        <include name="wsdl4j-1.5.1.jar" />
1277
        <include name="activation.jar" />
1278
        <include name="castor-0.9.5.jar" />
1279
        <include name="dnsjava-1.3.2.jar" />
1280
        <include name="mail.jar" />
1281
        <include name="commons-logging-1.0.4.jar" />
1282
        <!-- These jars may be needed but seem to not actually be,
1283
             so leaving them out for now
1284
        <include name="axis-ant.jar" />
1285
        -->
1286
        <!--<include name="GenCastor.class" />-->
1287
    </patternset>
1288
    <patternset id="lib.jars">
1289
        <include name="httpclient.jar" />
1290
        <include name="log4j-1.2.12.jar" />
1291
        <include name="utilities.jar" />
1292
        <include name="xercesImpl.jar" />
1293
        <include name="xalan.jar" />
1294
        <include name="xml-apis.jar" />
1295
    </patternset>
1296

    
1297
    <path id="lsid.classpath">
1298
        <fileset dir="${lsid.lib.dir}">
1299
            <patternset refid="lsid.jars"/>
1300
        </fileset>
1301
        <fileset dir="${lib.dir}">
1302
            <patternset refid="lsid.jars"/>
1303
        </fileset>
1304
        <fileset dir="${lib.dir}">
1305
            <include name="xalan.jar" />
1306
            <include name="xml-apis.jar" />
1307
        </fileset>
1308
        <fileset dir="${build.dir}">
1309
            <include name="metacat-client.jar" />
1310
        </fileset>
1311
    </path>
1312

    
1313
    <filterset id="configFilters">
1314
        <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1315
                value="${config.hostname}" / -->
1316
        <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1317
                value="${config.port}" / -->
1318
        <!-- MCD BYE filter token="METADATA_LABELS"
1319
                value="${config.metadataLabelLsid}" / -->
1320
        <!-- MCD BYE filter token="METACAT_SERVER"
1321
                value="${config.metacatserver}" / -->
1322
        <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1323
                value="${config.lsidauthority}" / -->
1324
    </filterset>
1325
    
1326
    <target name="prepare-lsid"
1327
            depends="prepare,utilities,clientjar"
1328
            description="Configure files prior to compilation">
1329
        <mkdir dir="${lsid.build.dir}" />
1330
        <!-- Copy the properties file into the build -->
1331
        <copy file="${conf.dir}/metacat-lsid.properties"
1332
              tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1333
              overwrite="true">
1334
            <filterset refid="configFilters" />
1335
        </copy>
1336
        <copy file="${conf.dir}/log4j.properties"
1337
              tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1338
              overwrite="true">
1339
            <filterset refid="configFilters" />
1340
        </copy>
1341
        <!-- Copy config files into the build -->
1342
        <copy todir="${lsid.build.dir}/WEB-INF">
1343
            <fileset dir="${webinf.dir}"
1344
                     includes="**/*.wsdd" />
1345
        </copy>
1346
        <!-- Copy the metadata configuration files into the build -->
1347
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1348
        <copy todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1349
            <fileset dir="${conf.dir}"
1350
                     includes="**/*.xml" />
1351
            <fileset dir="${conf.dir}"
1352
                     includes="**/*.xslt" />
1353
            <filterset refid="configFilters" />
1354
        </copy>
1355
        <!-- Copy services files into the build -->
1356
        <mkdir dir="${lsid.build.dir}/services" />
1357
        <copy todir="${lsid.build.dir}/services">
1358
            <fileset dir="${services.dir}" />
1359
            <filterset refid="configFilters" />
1360
        </copy>
1361
        <!-- Copy axis files into the build -->
1362
        <mkdir dir="${lsid.build.dir}" />
1363
        <copy todir="${lsid.build.dir}">
1364
            <fileset dir="${conf.dir}/axis"
1365
                     excludes="*.properties"/>
1366
        </copy>
1367
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1368
        <copy todir="${lsid.build.dir}/WEB-INF/classes">
1369
            <fileset dir="${conf.dir}/axis"
1370
                     includes="*.properties"/>
1371
        </copy>
1372
    </target>
1373
    
1374
    <target name="compile-lsid"
1375
            depends="prepare-lsid"
1376
            description="Compile Java sources">
1377
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1378
        <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1379
               destdir="${lsid.build.dir}/WEB-INF/classes"
1380
               debug="${compile.debug}"
1381
               deprecation="${compile.deprecation}"
1382
               optimize="${compile.optimize}">
1383
            <classpath refid="lsid.classpath" />
1384
        </javac>
1385
    </target>
1386
    
1387
    <target name="war-lsid"
1388
            depends="compile-lsid"
1389
            description="Create a war file for the application">
1390
        <mkdir dir="${dist.dir}" />
1391
        <war destfile="${dist.dir}/${authority.context}.war"
1392
             webxml="${webinf.dir}/web.xml">
1393
            <fileset dir="${lsid.build.dir}" />
1394
            <lib dir="${lsid.lib.dir}">
1395
                <patternset refid="lsid.jars"/>
1396
            </lib>
1397
            <lib dir="${lib.dir}">
1398
                <patternset refid="lib.jars"/>
1399
            </lib>
1400
            <lib dir="${lib.dir}">
1401
                <include name="xalan.jar" />
1402
                <include name="xml-apis.jar" />
1403
            </lib>
1404
            <lib dir="${build.dir}">
1405
                <include name="metacat-client.jar" />
1406
            </lib>
1407
        </war>
1408
    </target>
1409
    
1410
    <target name="deploy-lsid"
1411
            depends="war-lsid"
1412
            description="Deploy LSID war to servlet container">
1413
        <delete dir="${app.deploy.dir}/${authority.context}" />
1414
        <delete file="${app.deploy.dir}/${authority.context}.war" />
1415
        <mkdir dir="${app.deploy.dir}" />
1416
        <copy todir="${app.deploy.dir}">
1417
            <fileset dir="${dist.dir}" />
1418
        </copy>
1419
    </target>
1420
</project>
(5-5/5)