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

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

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

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

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

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

    
83
      </path>
84
      
85
      <!-- It is less likely you'll need to make any changes from here down,
86
           but customization is possible -->
87
      <property name="name"                value="metacat"/>
88
      <property name="Name"                value="MetaCat"/>
89
      <property name="debugprefix"         value="${Name}:"/>
90
      <property name="release"             value="${metacat.version}"/>
91
      <property name="style-common-relpath" value="/style/common"/>
92
      <property name="style-shared-relpath" value="/style/shared"/>
93
      <property name="schema-relpath"      value="/schema"/>
94
      <property name="style-common-cvsrelpath" value="lib${style-common-relpath}"/>
95
   	  <property name="schema-cvsrelpath"   value="lib${schema-relpath}"/>
96
      <property name="style-skins-relpath" value="/style/skins"/>
97
      <property name="util-module"         value="utilities" />
98
   	  <property name="utilities-tag"       value="UTILITIES_1_0_0" />
99
      <property name="eml-module"          value="eml" />
100
      <property name="eml-version"         value="2.0.0beta6" />
101
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
102
      <property name="eml2_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
103
      <property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
104
      <property name="eml2_0_1-style-tag"  value="RELEASE_EML_2_0_1_UPDATE_7" />
105
   	  <!-- property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0_RC_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="metacatRC"       value="${metacat.releaseCandidate}"/>
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
   	  <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}"
319
         package="${util-module}"
320
     	 tag="${utilities-tag}"
321
         dest="${utilitiesdir}/.." />
322
   </target>
323

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
505

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

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

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

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

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

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

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

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

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

    
569
    </target>
570

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

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

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

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

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

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

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

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

    
664

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
934
        <formatter type="plain" />
935

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

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

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

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

    
965
        <formatter type="plain" />
966

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

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

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

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

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

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

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

    
1046
        <formatter type="plain" />
1047

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

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

    
1061

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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