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: costa $'
10
  *    '$Date: 2009-05-11 08:39:50 -0700 (Mon, 11 May 2009) $'
11
  *    '$Revision: 4943 $'
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
        <!-- Include OAI-PMH -->
89
        <fileset dir="lib/oaipmh">
90
          <include name="*.jar"/>
91
        </fileset>
92

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

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

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

    
163
      <filter token="eml-version"          value="${eml-version}"/>
164
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
165
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
166
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
167
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
168
      <filter token="debugprefix"          value="${debugprefix}"/>
169

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

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

    
261
   </target>
262

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
497
   <target  name="copyxsl"
498
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
499

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

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

    
508

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

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

    
529
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
530
           description="Installs spatial option for metacat">
531

    
532
      <property name="spatial.dir" value="./lib/spatial"/>
533
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
534
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
535

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

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

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

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

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

    
572
    </target>
573

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

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

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

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

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

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

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

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

    
667

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

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

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

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

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

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

    
887
   <target name="getConversionXSL" depends="prepare"
888
            unless="styles.not.needed"
889
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
890

    
891
     <echo>Enter CVS password: </echo>
892
     <cvs cvsRoot="${cvsroot}"
893
          package="${eml-module}"
894
          tag="${eml2-style-tag}"
895
          dest="${build.tmp}/eml_${eml2-style-tag}" />
896

    
897
     <mkdir dir="lib/style/common/emlb6toeml2" />
898
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
899
       <fileset dir="${build.tmp}/eml_${eml2-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
900
         <include name="*.xsl"/>
901
         <include name="*.xml"/>
902
       </fileset>
903
      </copy>
904
   </target>
905

    
906
   <target name="testprep" depends="jar,clientjar,harvesterjar">
907
      <mkdir dir="${build.tests}"/>
908
      <copy todir="${build.tests}" filtering="yes">
909
        <fileset dir="${testdir}">
910
          <include name="edu/**"/>
911
        </fileset>
912
      </copy>
913
   	  <copy todir="${build.tests}" file="${testdir}/test.properties" filtering="yes"/>
914

    
915
      <!-- copy and compile the tests into a jar file -->
916
      <javac srcdir="${build.tests}"
917
             destdir="${build.tests}"
918
             debug="on"
919
             includes="**/*.java">
920
        <classpath>
921
          <path refid="compile.classpath"/>
922
          <fileset dir="${build.dir}">
923
            <include name="${name}.jar"/>
924
            <include name="${name}-client.jar"/>
925
            <include name="harvester.jar"/>
926
          </fileset>
927
        </classpath>
928
      </javac>
929

    
930
      <jar jarfile="${build.dir}/${name}-junittests.jar"
931
        basedir="${build.tests}"
932
                includes="**/*.class" />
933
   </target>
934

    
935
   <target name="test" depends="testprep"
936
            description="Uses the ant junit task to run all JUnit tests">
937

    
938
      <!-- use the ant "junit" task to run JUnit tests. -->
939
      <junit printsummary="yes" haltonfailure="no" fork="yes"
940
             haltonerror="no">
941
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
942
        <classpath>
943
          <path refid="compile.classpath"/>
944
          <fileset dir="${build.dir}">
945
            <include name="${name}.jar"/>
946
            <include name="${name}-client.jar"/>
947
            <include name="harvester.jar"/>
948
            <include name="${name}-junittests.jar"/>
949
          </fileset>
950
        </classpath>
951

    
952
        <formatter type="plain" />
953

    
954
        <batchtest fork="yes" todir="${build.dir}">
955
          <fileset dir="${build.tests}">
956
            <include name="**/*.class"/>
957
          	<exclude name="**/MCTestCase.class" />
958
          	<exclude name="**/ClientViewHelperTest.class" />
959
          </fileset>
960
        </batchtest>
961
     </junit>
962
   </target>
963

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

    
967
              <echo>testtorun: ${testtorun}</echo>
968

    
969
      <!-- use the ant "junit" task to run JUnit tests. -->
970
      <junit printsummary="yes" haltonfailure="no" fork="yes"
971
             haltonerror="no" showoutput="yes">
972
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
973
        <classpath>
974
          <path refid="compile.classpath"/>
975
          <fileset dir="${build.dir}">
976
            <include name="${name}.jar"/>
977
            <include name="${name}-client.jar"/>
978
            <include name="harvester.jar"/>
979
            <include name="${name}-junittests.jar"/>
980
          </fileset>
981
        </classpath>
982

    
983
        <formatter type="plain" />
984

    
985
        <batchtest fork="yes" todir="${build.dir}">
986
          <fileset dir="${build.tests}">
987
            <include name="**/${testtorun}.class" />
988
          </fileset>
989
        </batchtest>
990
     </junit>
991
   </target>
992

    
993
   <target name="testharvester"
994
           depends="testprep"
995
           description="Uses the ant junit task to test only the Harvester code">
996
     <junit printsummary="yes"
997
            haltonfailure="off"
998
            fork="yes"
999
            haltonerror="off">
1000
        <classpath>
1001
          <path refid="compile.classpath"/>
1002
          <fileset dir="${build.dir}">
1003
            <include name="${name}.jar"/>
1004
            <include name="${name}-client.jar"/>
1005
            <include name="harvester.jar"/>
1006
            <include name="${name}-junittests.jar"/>
1007
          </fileset>
1008
        </classpath>
1009
       <formatter type="plain" />
1010
       <batchtest fork="yes" todir="${build.dir}">
1011
         <fileset dir="${build.tests}">
1012
           <include name="**/harvesterClient/*.class" />
1013
         </fileset>
1014
       </batchtest>
1015
     </junit>
1016
   </target>
1017

    
1018
  <target name="gethttpclient" depends="prepare"
1019
            description="checks out and compiles morpho httpclient code">
1020
  <!--mkdir dir="${morphosourcedir}" -->
1021
        <cvs cvsRoot="${cvsroot}"
1022
             package="morpho"
1023
             dest="." />
1024
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1025
   </target>
1026

    
1027
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
1028
   <target name="nettest" depends="install"
1029
            description="compiles and runs the metacatnettest code">
1030

    
1031
      <echo>***********************************
1032
      Please run ant gethttpclient first!
1033
      ***********************************
1034
      </echo>
1035
      <!-- copy and compile the tests into a jar file -->
1036
      <mkdir dir="${build.metacatnettest}"/>
1037
      <javac srcdir="${junitnettestsdir}"
1038
             destdir="${build.metacatnettest}"
1039
             includes="**/*.java">
1040
        <classpath>
1041
          <path refid="compile.classpath"/>
1042
          <fileset dir="${build.dir}">
1043
            <include name="${name}.jar"/>
1044
          </fileset>
1045
        </classpath>
1046
      </javac>
1047

    
1048
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1049
                    basedir="${build.metacatnettest}"
1050
                    includes="**/*.class" />
1051

    
1052
      <!-- use the ant "junit" task to run JUnit tests. -->
1053
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1054
             haltonerror="no">
1055
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1056
        <classpath>
1057
          <path refid="compile.classpath"/>
1058
          <fileset dir="${build.dir}">
1059
            <include name="${name}.jar"/>
1060
            <include name="${name}-junitnettests.jar"/>
1061
          </fileset>
1062
        </classpath>
1063

    
1064
        <formatter type="plain" />
1065

    
1066
        <batchtest fork="yes" todir="${build.dir}">
1067
          <fileset dir="${build.metacatnettest}">
1068
            <include name="**/*.class" />
1069
          </fileset>
1070
        </batchtest>
1071
     </junit>
1072
   </target>
1073

    
1074
   <target name="cleanweb" depends="clean"
1075
            description="deletes tomcat web context dir and all its contents">
1076
     <delete dir="${installdir}" />
1077
   </target>
1078

    
1079

    
1080
   <target name="clean" depends="init"
1081
            description="deletes build dir and files that can be regenerated form the release">
1082
       <delete dir="${build.dir}" />
1083
       <delete dir="${dist.dir}" />
1084
   </target>
1085

    
1086
	<target name="localclean" depends="clean"
1087
	            description="deletes even jars that depend on external sources such as stylesheets and jars">
1088
	       <delete file="lib/httpclient.jar" />
1089
	       <delete file="lib/utilities.jar" />
1090
	</target>	
1091
	
1092
   <target name="fullclean" depends="localclean"
1093
            description="deletes code and eml">
1094
       <delete includeEmptyDirs="true" failonerror="false">
1095
         <fileset dir="${style-common-cvsrelpath}">
1096
           <include name="${eml-css}" />
1097
           <include name="eml-*/*.xsl" />
1098
           <include name="eml-*" />
1099
         </fileset>
1100
       	 <fileset dir="${schema-cvsrelpath}">
1101
       	   <include name="eml-*/*.xsd" />
1102
       	 </fileset>
1103
       	 <fileset dir="${ecogrid-dir}">
1104
       		<include name="build.properties" />
1105
       		<include name="buildfiles/metacatImpl.xml" />
1106
         </fileset>
1107
       </delete>
1108
   </target>
1109

    
1110
   <target name="jdoc" depends="prepare"
1111
            description="generates javadoc documentation">
1112
       <javadoc packagenames="edu.ucsb.nceas.*"
1113
           sourcepath="${build.src}"
1114
           destdir="${build.javadocs}"
1115
           author="true"
1116
           version="true"
1117
           use="true"
1118
           windowtitle="${Name} API"
1119
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1120
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1121
         <classpath>
1122
           <path refid="compile.classpath"/>
1123
         </classpath>
1124
       </javadoc>
1125
   </target>
1126

    
1127
   <target name="dist"
1128
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1129
            description="prepares a full release distribution">
1130
      <mkdir dir="${dist.dir}"/>
1131
      <delete dir="${ver.dir}" />
1132
      <mkdir dir="${ver.dir}"/>
1133
      <copy todir="${ver.dir}">
1134
        <fileset dir="."
1135
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip"/>
1136
      </copy>
1137
      <copy todir="${ver.dir}" file="build.xml"/>
1138
      <copy todir="${ver.dir}" file="build.properties"/>
1139

    
1140
      <copy todir="${ver.dir}/docs" filtering="yes">
1141
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1142
      </copy>
1143
      <copy todir="${ver.dir}/docs" filtering="no">
1144
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1145
      </copy>
1146
      <copy todir="${ver.dir}/docs/dev">
1147
        <fileset dir="${build.dir}/docs"/>
1148
      </copy>
1149
      <copy todir="${ver.dir}/src">
1150
        <fileset dir="${build.dir}/src"/>
1151
      </copy>
1152
   	
1153
   	  <mkdir dir="${ver.dir}/tests/servertestfiles"/>
1154
	  <copy todir="${ver.dir}/test/servertestfiles">
1155
	    <fileset dir="./test/servertestfiles"/>
1156
	  </copy>
1157
  </target>
1158

    
1159
	<target name="distbin" depends="build-metacat,war-lsid" description="prepares a binary distribution">
1160
		<copy todir="${dist.dir}">
1161
			<fileset dir="./src/scripts"  />
1162
		</copy>	
1163
		<delete file="./${name}-bin-${release}.zip" />
1164
		<zip zipfile="./${name}-bin-${release}.zip" 
1165
			basedir="${dist.dir}"
1166
			excludes="metacat-*/**"/>	
1167
		<delete file="./${name}-bin-${release}.tar.gz" />
1168
		<tar tarfile="./${name}-bin-${release}.tar" 
1169
			basedir="${dist.dir}" 
1170
			excludes="metacat-*/**"/>
1171
		<gzip zipfile="./${name}-bin-${release}.tar.gz" src="./${name}-bin-${release}.tar" />
1172
		<delete file="./${name}-bin-${release}.tar" />
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" 
1195
      	   basedir="${dist.dir}"
1196
      	   excludes="metacat*.tar.gz,metacat*.zip"/>
1197
      <delete file="./${name}-src-${release}.tar.gz" />
1198
      <tar tarfile="./${name}-src-${release}.tar" 
1199
      	   basedir="${dist.dir}"
1200
      	   excludes="metacat*.tar.gz,metacat*.zip"/>
1201
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1202
                src="./${name}-src-${release}.tar"/>
1203
      <delete file="./${name}-src-${release}.tar" />
1204
      <!--delete dir="${dist.dir}"/ --> 
1205
  </target>
1206
	
1207
  <target name="deb-package" depends="distbin"
1208
  	  description="create a debian installation package">
1209
  	<delete dir="${deb.pkg.dir}"/>
1210
    <mkdir dir="${deb.pkg.dir}/DEBIAN"/>
1211
  	<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1212
      <fileset dir="./src/scripts/debian"
1213
               includes="control postinst"/>
1214
    </copy>
1215
  	
1216
    <mkdir dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"/>
1217
  	<copy todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1218
  		  filtering="yes">
1219
      <fileset dir="./src/scripts/debian"
1220
               excludes="control postinst" />
1221
    </copy>
1222
  	<chmod file="${deb.pkg.dir}/DEBIAN/postinst" 
1223
  	       perm="755"/>
1224
  	
1225
  	<copy file="${dist.dir}/knb.war" 
1226
  		  todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"/>
1227
  	<copy file="./metacat-bin-${metacat.version}.tar.gz" 
1228
  		  tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1229
  	
1230
    <exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix" failonerror="true">
1231
      <arg line="--build debian" />   	
1232
    </exec>
1233
  	
1234
  	<move file="${pkg.dir}/debian.deb" 
1235
  		  tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb"/>
1236
  </target>
1237

    
1238
   <target name="stylesheettest">
1239
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1240
      <param name="displaymodule" expression="${displaymodule}"/>
1241
      <param name="docid" expression="${input}"/>
1242
      <param name="entitytype" expression="${entitytype}"/>
1243
      <param name="entityindex" expression="${entityindex}"/>
1244
      <outputproperty name="method" value="html"/>
1245
      <outputproperty name="standalone" value="yes"/>
1246
      <outputproperty name="encoding" value="iso8859_1"/>
1247
      <outputproperty name="indent" value="yes"/>
1248
    </xslt>
1249
  </target>
1250

    
1251
 
1252
  <target name="compilewebclient" depends="prepare">
1253
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1254
  </target>
1255

    
1256
  <target name="runwebclient" depends="compilewebclient">
1257
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1258
           dir="${build.dest}" fork="yes"
1259
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1260
         <arg value="${serviceUrl}"/>
1261
         <arg value="${docid}"/>
1262
     </java>
1263
  </target>
1264
  
1265
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1266

    
1267
    <echo message="Compiling the metatcat shapefile creator"/>
1268
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1269
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1270
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1271
    </exec>
1272
  
1273
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1274
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1275
    </exec>
1276
  </target>
1277

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

    
1307
    <path id="lsid.classpath">
1308
        <fileset dir="${lsid.lib.dir}">
1309
            <patternset refid="lsid.jars"/>
1310
        </fileset>
1311
        <fileset dir="${lib.dir}">
1312
            <patternset refid="lsid.jars"/>
1313
        </fileset>
1314
        <fileset dir="${lib.dir}">
1315
            <include name="xalan.jar" />
1316
            <include name="xml-apis.jar" />
1317
        </fileset>
1318
        <fileset dir="${build.dir}">
1319
            <include name="metacat-client.jar" />
1320
        </fileset>
1321
    </path>
1322

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