Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: daigle $'
10
  *    '$Date: 2009-02-27 10:42:37 -0800 (Fri, 27 Feb 2009) $'
11
  *    '$Revision: 4819 $'
12
  *
13
  * Build file for the Ant cross-platform build system for metacat
14
  * See http://jakarta.apache.org for details on Ant
15
  *
16
  * usage: ant [compile|jar|install|jdoc]
17
  *
18
  * This program is free software; you can redistribute it and/or modify
19
  * it under the terms of the GNU General Public License as published by
20
  * the Free Software Foundation; either version 2 of the License, or
21
  * (at your option) any later version.
22
  *
23
  * This program is distributed in the hope that it will be useful,
24
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
  * GNU General Public License for more details.
27
  *
28
  * You should have received a copy of the GNU General Public License
29
  * along with this program; if not, write to the Free Software
30
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir=".">
33
  <property environment="env"/>
34
  <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
35
	
36
  
37
	
38
  <!-- Determine if ecogrid should be installed-->
39
  <condition property="enable.ecogrid">
40
    <equals arg1="${install.ecogrid}" arg2="true" />
41
  </condition>
42
  
43
  <!-- Determine if perl should be built-->
44
  <condition property="build.perl">
45
    <equals arg1="${make.perl.code}" arg2="true" />
46
  </condition>
47

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

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

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

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

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

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

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

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

    
159
      <filter token="eml-version"          value="${eml-version}"/>
160
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
161
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
162
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
163
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
164
      <filter token="debugprefix"          value="${debugprefix}"/>
165

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

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

    
257
   </target>
258

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
503

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

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

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

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

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

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

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

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

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

    
567
    </target>
568

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

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

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

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

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

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

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

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

    
662

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
940
        <formatter type="plain" />
941

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

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

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

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

    
971
        <formatter type="plain" />
972

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

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

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

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

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

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

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

    
1052
        <formatter type="plain" />
1053

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

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

    
1067

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

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

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

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

    
1128
      <copy todir="${ver.dir}/docs" filtering="yes">
1129
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1130
      </copy>
1131
      <copy todir="${ver.dir}/docs" filtering="no">
1132
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1133
      </copy>
1134
      <copy todir="${ver.dir}/docs/dev">
1135
        <fileset dir="${build.dir}/docs"/>
1136
      </copy>
1137
      <copy todir="${ver.dir}/src">
1138
        <fileset dir="${build.dir}/src"/>
1139
      </copy>
1140
   	
1141
   	  <mkdir dir="${ver.dir}/tests/servertestfiles"/>
1142
	  <copy todir="${ver.dir}/test/servertestfiles">
1143
	    <fileset dir="./test/servertestfiles"/>
1144
	  </copy>
1145
  </target>
1146

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

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

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

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

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

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

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

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

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

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