Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: daigle $'
10
  *    '$Date: 2008-12-03 08:59:10 -0800 (Wed, 03 Dec 2008) $'
11
  *    '$Revision: 4648 $'
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="${dev.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_3" / -->
106
      <!-- property name="eml2_1_0-style-tag"  value="RELEASE_EML_2_1_0_RC_3" / -->  	
107
 	  <property name="eml2_1_0-schema-tag" value="" />
108
      <property name="eml2_1_0-style-tag"  value="" />
109
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
110
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
111
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
112
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
113
      <property name="eml-css"             value="eml_xsl.css"/>
114
      <property name="eml-module.default.css"
115
                                           value="default.css"/>
116
   	<property name="systemidserver"             value=""/>
117
   	<property name="html-path"             value=""/>
118
   	
119
   	  
120
      <!-- Config for registry variables -->
121
      <!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties --> 
122
      <property name="scope"               value="obfs"/>
123
      <property name="responseForm"        value="genericResponse.tmpl"/>
124
      <property name="entryForm"           value="entryForm.tmpl"/>
125
      <property name="guide"               value="genericGuide.tmpl"/>
126
      <property name="loginForm"           value="loginForm.tmpl"/>
127
      <property name="confirmData"         value="confirmData.tmpl"/>
128
      <property name="deleteData"          value="deleteData.tmpl"/>
129
      <property name="genericHeader"       value="genericHeader.tmpl"/>
130
      <property name="genericFooter"       value="genericFooter.tmpl"/>
131

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

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

    
155
      <filter token="eml-version"          value="${eml-version}"/>
156
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
157
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
158
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
159
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
160
      <!-- MCD BYE filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" / -->
161
      <!-- MCD BYE filter filter token="debuglevel"           value="${debuglevel}" / -->
162
      <!-- MCD BYE filter token="defaultcontenttype"   value="${defaultcontenttype}" / -->
163
      <filter token="debugprefix"          value="${debugprefix}"/>
164
      <filter token="indexPaths"           value="${indexPaths}"/>
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
	  
218
   	  <property name="ecogrid-target-name" value="metacatImpl"/>
219
   	  <property name="ecogrid-module-dest-dir" value =".."/>
220
   	  <property name="ecogrid-module"      value="seek/projects/ecogrid"/>
221
   	  <property name="ecogrid-dist-dir"    value="${dist.dir}/${ecogrid-module}"/>
222
   	  <property name="ecogrid-dir"         value="${ecogrid-module-dest-dir}/${ecogrid-module}"/>
223

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

    
255
   </target>
256

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

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

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

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

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

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

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

    
306
   <target name="utilities" depends="config,getpeerutilities" if="utilities.required">
307
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
308
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
309
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
310
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
311
   </target>
312
	
313
   <target name="getpeerutilities" depends="prepare" if="peer.utilities.required"
314
	description="Checks utilities out of cvs and copies it to your utilitiesdir if it does not already exist">
315
     <echo>Enter CVS password: </echo>
316
     <cvs cvsRoot="${cvsroot}"
317
         package="${util-module}"
318
     	 tag="${utilities-tag}"
319
         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="dev-install" depends="clean, build-metacat" description="* Full Install For Development *">
570
     <copy file="${dist.dir}/${metacat.context}.war" todir="${dev.deploy.dir}"/>
571
   	 <delete dir="${dev.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
<!--
579
   <target name="install" depends="install-ecogrid" description="* Full Install *">
580
       <mkdir dir="${datafilepath}" />
581
       <mkdir dir="${inlinedatafilepath}" />
582
       <chmod dir="${datafilepath}" perm="ug+w" />
583
       <mkdir dir="${temp-dir}"/>
584
       <chmod dir="${temp-dir}" perm="ug+w" />
585
       <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
586
   	   <echo>If you enable ecogrid installation, please run "ant deploy-ecogrid" when installation or upgrade is done</echo> 
587
   </target>
588
-->
589
   <target name="build-metacat" depends="install-ecogrid"
590
   	            description="Build Metacat">
591
   </target>
592
	
593
   <target name="install-ecogrid" depends="war, get-ecogrid" if="enable.ecogrid"
594
			    description="Install Ecogrid Compentent">
595
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="clean" inheritall="false">
596
   	         <property name="context" value="${metacat.context}"/>
597
   	   	     <property name="target" value="${ecogrid-target-name}"/>
598
   	   	     <!-- property name="metacat.dir" value="."/ -->
599
   	  </ant>
600
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="war" inheritall="false">
601
   	     <property name="context" value="${metacat.context}"/>
602
   	     <property name="target" value="${ecogrid-target-name}"/>
603
   	     <!-- property name="metacat.dir" value="."/ -->
604
   	  </ant>
605
   	  <war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
606
  	      <webinf dir="${ecogrid-dir}/lib">
607
   	        <include name="server-config.wsdd"/>
608
   	      </webinf>
609
   	  </war>
610
   	  <copy file="${ecogrid-dir}/build/${metacat.context}.war" todir="${dist.dir}" overwrite="true"/>
611
   	  
612
   
613
   </target>
614
   
615
   <target name="get-ecogrid" depends="init" if="ecogrid.required" description="Check out ecogrid module">
616
	<echo>Enter CVS password: </echo>
617
	     <cvs cvsRoot="${cvsroot}"
618
	          package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
619
   </target>  
620
	
621
   <target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
622
   	 <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
623
   	   	 <property name="context" value="${metacat.context}"/>
624
   	   	 <property name="target" value="${ecogrid-target-name}"/>
625
   	     <property name="metacat.dir" value="."/>
626
   	     <property name="hostname" value="localhost"/>
627
   	     <property name="port" value="${config.port}"/>
628
   	 </ant>
629
   </target>
630
	
631
   <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
632
      <delete file="${dev.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
633
   </target>
634

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

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

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

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

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

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

    
673

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
943
        <formatter type="plain" />
944

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

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

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

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

    
974
        <formatter type="plain" />
975

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

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

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

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

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

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

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

    
1055
        <formatter type="plain" />
1056

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

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

    
1070

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

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

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

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

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

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

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

    
1185
      <delete file="./${name}-src-${release}.zip"/>
1186
      <zip zipfile="./${name}-src-${release}.zip" 
1187
      	   basedir="${dist.dir}"
1188
      	   excludes="metacat*.tar.gz,metacat*.zip"/>
1189
      <delete file="./${name}-src-${release}.tar.gz" />
1190
      <tar tarfile="./${name}-src-${release}.tar" 
1191
      	   basedir="${dist.dir}"
1192
      	   excludes="metacat*.tar.gz,metacat*.zip"/>
1193
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1194
                src="./${name}-src-${release}.tar"/>
1195
      <!-- delete file="./${name}-src-${release}.tar" />
1196
      <delete dir="${dist.dir}"/ --> 
1197
  </target>
1198

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

    
1212
 
1213
  <target name="compilewebclient" depends="prepare">
1214
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1215
  </target>
1216

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

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

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

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

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