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-08 10:40:36 -0800 (Mon, 08 Dec 2008) $'
11
  *    '$Revision: 4658 $'
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="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="dev-install" depends="clean, build-metacat" description="* Full Install For Development *">
572
     <copy file="${dist.dir}/${metacat.context}.war" todir="${dev.deploy.dir}"/>
573
   	 <delete dir="${dev.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
<!--
581
   <target name="install" depends="install-ecogrid" description="* Full Install *">
582
       <mkdir dir="${datafilepath}" />
583
       <mkdir dir="${inlinedatafilepath}" />
584
       <chmod dir="${datafilepath}" perm="ug+w" />
585
       <mkdir dir="${temp-dir}"/>
586
       <chmod dir="${temp-dir}" perm="ug+w" />
587
       <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
588
   	   <echo>If you enable ecogrid installation, please run "ant deploy-ecogrid" when installation or upgrade is done</echo> 
589
   </target>
590
-->
591
   <target name="build-metacat" depends="install-ecogrid"
592
   	            description="Build Metacat">
593
   </target>
594
	
595
   <target name="install-ecogrid" depends="war, get-ecogrid" if="enable.ecogrid"
596
			    description="Install Ecogrid Compentent">
597
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="clean" inheritall="false">
598
   	         <property name="context" value="${metacat.context}"/>
599
   	   	     <property name="target" value="${ecogrid-target-name}"/>
600
   	   	     <!-- property name="metacat.dir" value="."/ -->
601
   	  </ant>
602
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="war" inheritall="false">
603
   	     <property name="context" value="${metacat.context}"/>
604
   	     <property name="target" value="${ecogrid-target-name}"/>
605
   	     <!-- property name="metacat.dir" value="."/ -->
606
   	  </ant>
607
   	  <war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
608
  	      <webinf dir="${ecogrid-dir}/lib">
609
   	        <include name="server-config.wsdd"/>
610
   	      </webinf>
611
   	  </war>
612
   	  <copy file="${ecogrid-dir}/build/${metacat.context}.war" todir="${dist.dir}" overwrite="true"/>
613
   	  
614
   
615
   </target>
616
   
617
   <target name="get-ecogrid" depends="init" if="ecogrid.required" description="Check out ecogrid module">
618
	<echo>Enter CVS password: </echo>
619
	     <cvs cvsRoot="${cvsroot}"
620
	          package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
621
   </target>  
622
	
623
   <target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
624
   	 <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
625
   	   	 <property name="context" value="${metacat.context}"/>
626
   	   	 <property name="target" value="${ecogrid-target-name}"/>
627
   	     <property name="metacat.dir" value="."/>
628
   	     <property name="hostname" value="localhost"/>
629
   	     <property name="port" value="${config.port}"/>
630
   	 </ant>
631
   </target>
632
	
633
   <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
634
      <delete file="${dev.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
635
   </target>
636

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

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

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

    
656
      <echo message="Install Registry completed." />
657
   </target -->
658

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

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

    
675

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

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

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

    
724
      <echo message="Install Skin completed." />
725
   </target>
726

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

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

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

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

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

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

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

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

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

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

    
945
        <formatter type="plain" />
946

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

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

    
960
              <echo>testtorun: ${testtorun}</echo>
961

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

    
976
        <formatter type="plain" />
977

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

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

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

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

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

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

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

    
1057
        <formatter type="plain" />
1058

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

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

    
1072

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

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

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

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

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

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

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

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

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

    
1244
 
1245
  <target name="compilewebclient" depends="prepare">
1246
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1247
  </target>
1248

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

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

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

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

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