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-09 15:01:15 -0800 (Mon, 09 Feb 2009) $'
11
  *    '$Revision: 4797 $'
12
  *
13
  * Build file for the Ant cross-platform build system for metacat
14
  * See http://jakarta.apache.org for details on Ant
15
  *
16
  * usage: ant [compile|jar|install|jdoc]
17
  *
18
  * This program is free software; you can redistribute it and/or modify
19
  * it under the terms of the GNU General Public License as published by
20
  * the Free Software Foundation; either version 2 of the License, or
21
  * (at your option) any later version.
22
  *
23
  * This program is distributed in the hope that it will be useful,
24
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
  * GNU General Public License for more details.
27
  *
28
  * You should have received a copy of the GNU General Public License
29
  * along with this program; if not, write to the Free Software
30
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir=".">
33
  <property environment="env"/>
34
  <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
35
	
36
  
37
	
38
  <!-- Determine if installed ecogrid -->
39
  <condition property="enable.ecogrid">
40
    <equals arg1="${install.ecogrid}" arg2="true" />
41
  </condition>
42

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

    
55
      <property name="debug"               value="on" />
56
      <property name="morphosourcedir"     value="../morpho" />
57
      <property name="utilitiesdir"        value="../utilities" />
58
      <property name="installdir"        value="${app.deploy.dir}/${metacat.context}" />
59

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

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

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

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

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

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

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

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

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

    
256
   </target>
257

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
504

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

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

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

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

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

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

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

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

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

    
568
    </target>
569

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

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

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

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

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

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

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

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

    
663

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

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

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

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

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

    
729
       <property name="war.lib" value="${build.war}/lib" />
730
       <property name="war.webinf" value="${build.war}/WEB-INF" />
731
       <property name="war.context" value="${build.war}/${metacat.context}" />
732
   	   <property name="war.webinf.sql" value="${war.webinf}/sql" />
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
   	
824
   	   <copy file="src/perl/register-dataset.cgi" todir="${war.context.cgi}"/>
825
	   <copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
826
	   <copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
827
   	
828
	   <!-- registry cgi section -->
829
	   <!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
830
                   used in readDocumentFromMetacat -->
831
	   <!-- TODO MCD copy temp files to actual location using config util?? -->
832
	   <copy todir="${war.context.temp}" filtering="yes">
833
		  <fileset dir="lib/style/common/emlb6toeml2">
834
 		    <include name="*.xsl"/>
835
			<include name="*.xml"/>
836
		  </fileset>
837
	    </copy>
838
	    <available file="lib/style/common/emlb6toeml2" type="dir"
839
                 property="styles.not.needed"/>
840
	
841
	    <!-- ldap cgi section -->
842
	    <copy todir="${war.context.templates}">
843
		    <fileset dir="lib/style/common/templates">
844
			    <!-- SCW: Copy all files -->
845
		    </fileset>
846
	    </copy>
847
    </target>
848
	
849
	<target name="cgiPrepare">		
850
		<exec dir="src/perl/Metacat/" command="perl" >
851
			<arg value="Makefile.PL" />
852
		</exec>
853
		<exec dir="src/perl/Metacat/" command="make" />
854
	</target>
855
	
856
	<target name="testPrepare"
857
		description="Copies test files into the war directories">
858
		<echo>in testPrepare</echo>
859
		<property name="war.context.test" value="${build.war}/${metacat.context}/test" />
860
		<mkdir dir="${war.context.test}" />
861
	    <copy todir="${war.context.test}" filtering="yes">
862
		   <fileset dir="test/servertestfiles">
863
	          <include name="*/**"/>
864
		   </fileset>
865
		</copy>
866
	</target>
867

    
868
   <target name="getConversionXSL" depends="prepare"
869
            unless="styles.not.needed"
870
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
871

    
872
     <echo>Enter CVS password: </echo>
873
     <cvs cvsRoot="${cvsroot}"
874
          package="${eml-module}"
875
          tag="${eml2_0_1-style-tag}"
876
          dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
877

    
878
     <mkdir dir="lib/style/common/emlb6toeml2" />
879
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
880
       <fileset dir="${build.tmp}/eml_${eml2_0_1-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
881
         <include name="*.xsl"/>
882
         <include name="*.xml"/>
883
       </fileset>
884
      </copy>
885
   </target>
886

    
887
   <target name="testprep" depends="jar,clientjar,harvesterjar">
888
      <mkdir dir="${build.tests}"/>
889
      <copy todir="${build.tests}" filtering="yes">
890
        <fileset dir="${testdir}">
891
          <include name="edu/**"/>
892
        </fileset>
893
      </copy>
894
   	  <copy todir="${build.tests}" file="${testdir}/test.properties" filtering="yes"/>
895

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

    
911
      <jar jarfile="${build.dir}/${name}-junittests.jar"
912
        basedir="${build.tests}"
913
                includes="**/*.class" />
914
   </target>
915

    
916
   <target name="test" depends="testprep"
917
            description="Uses the ant junit task to run all JUnit tests">
918

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

    
933
        <formatter type="plain" />
934

    
935
        <batchtest fork="yes" todir="${build.dir}">
936
          <fileset dir="${build.tests}">
937
            <include name="**/*.class"/>
938
          	<exclude name="**/MCTestCase.class" />
939
          	<exclude name="**/ClientViewHelperTest.class" />
940
          </fileset>
941
        </batchtest>
942
     </junit>
943
   </target>
944

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

    
948
              <echo>testtorun: ${testtorun}</echo>
949

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

    
964
        <formatter type="plain" />
965

    
966
        <batchtest fork="yes" todir="${build.dir}">
967
          <fileset dir="${build.tests}">
968
            <include name="**/${testtorun}.class" />
969
          </fileset>
970
        </batchtest>
971
     </junit>
972
   </target>
973

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

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

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

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

    
1029
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1030
                    basedir="${build.metacatnettest}"
1031
                    includes="**/*.class" />
1032

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

    
1045
        <formatter type="plain" />
1046

    
1047
        <batchtest fork="yes" todir="${build.dir}">
1048
          <fileset dir="${build.metacatnettest}">
1049
            <include name="**/*.class" />
1050
          </fileset>
1051
        </batchtest>
1052
     </junit>
1053
   </target>
1054

    
1055
   <target name="cleanweb" depends="clean"
1056
            description="deletes tomcat web context dir and all its contents">
1057
     <delete dir="${installdir}" />
1058
   </target>
1059

    
1060

    
1061
   <target name="clean" depends="init"
1062
            description="deletes build dir and files that can be regenerated form the release">
1063
       <delete dir="${build.dir}" />
1064
       <delete dir="${dist.dir}" />
1065
   </target>
1066

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

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

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

    
1121
      <copy todir="${ver.dir}/docs" filtering="yes">
1122
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1123
      </copy>
1124
      <copy todir="${ver.dir}/docs" filtering="no">
1125
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1126
      </copy>
1127
      <copy todir="${ver.dir}/docs/dev">
1128
        <fileset dir="${build.dir}/docs"/>
1129
      </copy>
1130
      <copy todir="${ver.dir}/src">
1131
        <fileset dir="${build.dir}/src"/>
1132
      </copy>
1133
   	
1134
   	  <mkdir dir="${ver.dir}/tests/servertestfiles"/>
1135
	  <copy todir="${ver.dir}/test/servertestfiles">
1136
	    <fileset dir="./test/servertestfiles"/>
1137
	  </copy>
1138
  </target>
1139

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

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

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

    
1219
   <target name="stylesheettest">
1220
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1221
      <param name="displaymodule" expression="${displaymodule}"/>
1222
      <param name="docid" expression="${input}"/>
1223
      <param name="entitytype" expression="${entitytype}"/>
1224
      <param name="entityindex" expression="${entityindex}"/>
1225
      <outputproperty name="method" value="html"/>
1226
      <outputproperty name="standalone" value="yes"/>
1227
      <outputproperty name="encoding" value="iso8859_1"/>
1228
      <outputproperty name="indent" value="yes"/>
1229
    </xslt>
1230
  </target>
1231

    
1232
 
1233
  <target name="compilewebclient" depends="prepare">
1234
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1235
  </target>
1236

    
1237
  <target name="runwebclient" depends="compilewebclient">
1238
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1239
           dir="${build.dest}" fork="yes"
1240
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1241
         <arg value="${serviceUrl}"/>
1242
         <arg value="${docid}"/>
1243
     </java>
1244
  </target>
1245
  
1246
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1247

    
1248
    <echo message="Compiling the metatcat shapefile creator"/>
1249
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1250
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1251
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1252
    </exec>
1253
  
1254
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1255
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1256
    </exec>
1257
  </target>
1258

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

    
1288
    <path id="lsid.classpath">
1289
        <fileset dir="${lsid.lib.dir}">
1290
            <patternset refid="lsid.jars"/>
1291
        </fileset>
1292
        <fileset dir="${lib.dir}">
1293
            <patternset refid="lsid.jars"/>
1294
        </fileset>
1295
        <fileset dir="${lib.dir}">
1296
            <include name="xalan.jar" />
1297
            <include name="xml-apis.jar" />
1298
        </fileset>
1299
        <fileset dir="${build.dir}">
1300
            <include name="metacat-client.jar" />
1301
        </fileset>
1302
    </path>
1303

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