Project

General

Profile

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

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

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

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

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

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

    
88
        <!-- Include OAI-PMH -->
89
        <fileset dir="lib/oaipmh">
90
          <include name="*.jar"/>
91
        </fileset>
92

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

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

    
154
      <filter token="docrooturl"           value="./" />
155
      <filter token="mcuser"               value="${mcuser}"/>
156
      <filter token="mcpassword"           value="${mcpassword}"/>
157
      <filter token="mcanotheruser"        value="${mcanotheruser}"/>
158
      <filter token="mcanotherpassword"    value="${mcanotherpassword}"/>
159
      <filter token="eml-css"              value="${eml-css}"/>
160
      <filter token="style-skins-relpath"  value="${style-skins-relpath}"/>
161
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
162

    
163
      <filter token="eml-version"          value="${eml-version}"/>
164
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
165
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
166
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
167
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
168
      <filter token="debugprefix"          value="${debugprefix}"/>
169

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

    
230
      <property name="package.home"        value="edu/ucsb/nceas/metacat" />
231
      
232
      <!-- set up svn -->
233
   	  <property name="svnant.lib" value="lib" />
234
      <property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
235
      <property name="svnClientAdapter.jar" value="${svnant.lib}/svnClientAdapter.jar" />
236
      <property name="svnjavahl.jar" value="${svnant.lib}/svnjavahl.jar" />
237
   	  <property name="svn.utilitiesUrl" value="https://code.ecoinformatics.org/code/utilities/tags/${utilities-tag}" />
238
      <!--  property name="svn.utilitiesExportPath" value="${knbdir}" / -->  
239
      
240
      <!-- load the svn task -->
241
      <path id="svn.classpath">
242
        <pathelement location="${svnjavahl.jar}" />
243
        <pathelement location="${svnant.jar}" />
244
        <pathelement location="${svnClientAdapter.jar}" />
245
      </path>
246
      <taskdef resource="svntask.properties" classpathref="svn.classpath"/>  
247
      
248
      <condition property="utilities.required">
249
        <or>
250
          <not><available file="lib/httpclient.jar"/></not>
251
          <not><available file="lib/utilities.jar"/></not>
252
          <not><available file="${utilitiesdir}" type="dir"/></not>
253
        </or>
254
      </condition>
255
   	  <!-- peer.utilities.required is used when there is no utilities 
256
   	       directory at ${utilitiesdir} -->
257
      <condition property="peer.utilities.required">
258
        <or>
259
          <not><available file="${utilitiesdir}" type="dir"/></not>
260
        </or>
261
      </condition>
262
      <condition property="eml.required">
263
        <or>
264
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
265
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
266
          <not><available file="lib/schema/eml-2.1.0/eml.xsd"/></not>
267
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
268
        </or>
269
      </condition>
270
   	  
271
      <condition property="ecogrid.required">
272
      	   <or>
273
             <not><available file="${ecogrid-dir}/build.properties"/></not>
274
             <not><available file="${ecogrid-dir}/buildfiles/metacatImpl.xml"/></not>
275
           </or>
276
      </condition>
277

    
278
   </target>
279

    
280
   <target name="prepare" depends="init">
281
      <mkdir dir="${build.dir}"/>
282
      <mkdir dir="${build.src}"/>
283
      <mkdir dir="${build.dest}"/>
284
      <mkdir dir="${build.javadocs}"/>
285
      <mkdir dir="${build.tmp}"/>
286

    
287
      <copy todir="${build.src}" filtering="yes">
288
        <fileset dir="${srcdir}">
289
          <include name="edu/**"/>
290
          <include name="com/**"/>
291
          <include name="org/**"/>
292
          <include name="**/*.sql"/>
293
          <exclude name="**/CVS*"/>
294
          <exclude name="**/.#*"/>
295
        </fileset>
296
      </copy>
297
      <available file="lib/style/common/emlb6toeml2" type="dir"
298
                 property="styles.not.needed"/>
299
   </target>
300

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

    
304
       <javac srcdir="${build.src}"
305
              destdir="${build.dest}"
306
              debug="${debug}"
307
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
308
        <classpath>
309
          <path refid="compile.classpath"/>
310
        </classpath>
311
      </javac>
312
   </target>
313

    
314
   <target name="jar" depends="compile,geteml"
315
    description="Compiles and jars metacat java code to metacat.jar in build dir ">
316

    
317
       <delete file="${build.dir}/${name}.jar" />
318
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
319
            excludes="**/protocols/ **/harvesterClient/" />
320
   </target>
321

    
322
   <target name="protocol" depends="compile"
323
    description="Compiles and jars protocol java code to protocol.jar in build dir">
324
       <delete file="${build.dir}/protocol.jar" />
325
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
326
            includes="**/protocols/" />
327
   </target>
328

    
329
   <target name="utilities" depends="config,getpeerutilities" if="utilities.required">
330
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
331
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
332
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
333
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
334
   </target>
335
	
336
   <target name="getpeerutilities" depends="prepare" if="peer.utilities.required"
337
	description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
338
   	 <echo message="Exporting utiities files from svn repository:" />
339
   	 <!-- input message="Please enter svn repo username:" addproperty="svn.username" / -->
340
   	 <!-- input message="Please enter svn repo password:" addproperty="svn.password" / -->
341
   	 <!--  svn username="${svn.username}" password="${svn.password}" -->
342
   	 <svn>
343
   	   <export srcUrl="${svn.utilitiesUrl}" destPath="${utilitiesdir}" />
344
   	 </svn>
345

    
346
     <!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
347
   </target>
348

    
349
   <target name="getutilities" depends="prepare"
350
   description="Checks utility out of svn and copies it to your metacat cvs sandbox">
351
     <echo>Enter CVS password: </echo>
352
     <cvs cvsRoot="${cvsroot}"
353
          package="${util-module}"
354
     	  tag="${utilities-tag}"
355
          dest="${build.tmp}" />
356
   </target>
357

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

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

    
376
    <target name="advancedsearchjar" depends="compile"
377
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
378
        <delete file="${build.dir}/advancedsearch.jar" />
379
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
380
             includes="**/metacat/advancedsearch/" />
381
    </target>
382

    
383
   <target name="harvester" depends="client"
384
           description="Compiles harvester java code to build dir">
385
       <javac srcdir="${build.src}"
386
              destdir="${build.dest}"
387
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
388
          <classpath>
389
            <path refid="compile.classpath"/>
390
          </classpath>
391
        </javac>
392
   </target>
393

    
394
   <target name="harvesterjar" depends="harvester"
395
           description="Compiles and jars harvester java code to harvester.jar in build dir">
396
       <delete file="${build.dir}/harvester.jar" />
397
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
398
            includes="**/metacat/harvesterClient/" />
399
   </target>
400

    
401
   <target name="harvestListEditorDist" depends="harvesterjar"
402
           description="Prepares a distribution of the Harvest List Editor tool">
403
       <mkdir dir="${dist.dir.hle}"/>
404
       <delete dir="${ver.dir.hle}" />
405
       <mkdir dir="${ver.dir.hle}"/>
406
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
407
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
408
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
409
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
410
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
411
       <delete file="./harvest-list-editor-${release}.zip"/>
412
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
413
       <delete file="./harvest-list-editor-${release}.tar.gz" />
414
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
415
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
416
             src="./harvest-list-editor-${release}.tar"/>
417
       <delete file="./harvest-list-editor-${release}.tar" />
418
   </target>
419
	
420
   <target  name="geteml" depends="getemlpre2,geteml2+,getConversionXSL" if="eml.required"
421
            description="Calls getemlpre2 and geteml2+ targets" />
422

    
423
   <target name="getemlpre2" depends="prepare" if="eml.required"
424
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
425
     <echo>Enter CVS password: </echo>
426
     <cvs cvsRoot="${cvsroot}"
427
          package="${eml-module}"
428
          tag="${eml-beta-tag}"
429
          dest="${build.tmp}/eml_${eml-beta-tag}" />
430
     <mkdir dir="lib/dtd" />
431
     <copy todir="lib/dtd" filtering="yes">
432
       <fileset dir="${build.tmp}/eml_${eml-beta-tag}/${eml-module}">
433
         <include name="*.dtd"/>
434
       </fileset>
435
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
436
     </copy>
437

    
438
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
439
       <fileset dir="${build.tmp}/eml_${eml-beta-tag}/${eml-module}/style">
440
       <include name="**/*.xsl"/>
441
     </fileset>
442
     </copy>
443
   </target>
444

    
445
   <target name="geteml2+" depends="prepare" if="eml.required"
446
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
447
     <echo>Enter CVS password: </echo>
448
     <cvs cvsRoot="${cvsroot}"
449
          package="${eml-module}"
450
          tag="${eml2_0_0-schema-tag}"
451
          dest="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
452
     <mkdir dir="lib/schema/eml-2.0.0" />
453
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
454
       <fileset dir="${build.tmp}/eml_${eml2_0_0-schema-tag}/${eml-module}">
455
         <include name="*.xsd"/>
456
       </fileset>
457

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

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

    
464
     </copy>
465
     <!-- <antcall target="copyxsl">
466
        <param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
467
        <param name="dirname" value="eml-2.0.0" />
468
     </antcall> -->
469
   	
470
   	<!-- Checkout eml201 for given schema tag-->
471
     <echo>Enter CVS password: </echo>
472
     <cvs cvsRoot="${cvsroot}"
473
          package="${eml-module}"
474
          tag="${eml2_0_1-schema-tag}"
475
          dest="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
476
     <mkdir dir="lib/schema/eml-2.0.1" />
477
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
478
       <fileset dir="${build.tmp}/eml_${eml2_0_1-schema-tag}/${eml-module}">
479
         <include name="*.xsd"/>
480
       </fileset>
481
     </copy>
482
   	
483
   	<!-- Checkout eml201 again for given style sheet tag-->
484
   	<!-- echo>Enter CVS password: </echo>
485
   	     <cvs cvsRoot="${cvsroot}"
486
   	          package="${eml-module}"
487
   	          tag="${eml2_0_1-style-tag}"
488
   	          dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
489
     <antcall target="copyxsl">
490
        <param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
491
        <param name="dirname" value="eml-2.0.1" />
492
     </antcall -->
493
	
494
   	<!-- Checkout eml210 for given schema tag-->
495
     <echo>Enter CVS password: </echo>
496
     <cvs cvsRoot="${cvsroot}"
497
          package="${eml-module}"
498
          tag="${eml2_1_0-schema-tag}"
499
          dest="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
500
     <mkdir dir="lib/schema/eml-2.1.0" />
501
     <copy todir="lib/schema/eml-2.1.0" filtering="yes">
502
       <fileset dir="${build.tmp}/eml_${eml2_1_0-schema-tag}/${eml-module}">
503
         <include name="*.xsd"/>
504
       </fileset>
505
     </copy>
506
	
507
   	<!-- Checkout eml210 for given style sheet tag-->
508
   	<echo>Enter CVS password: </echo>
509
   	     <cvs cvsRoot="${cvsroot}"
510
   	          package="${eml-module}"
511
   	          tag="${eml2-style-tag}"
512
   	          dest="${build.tmp}/eml_${eml2-style-tag}" />
513
     <antcall target="copyxsl">
514
        <param name="cvs.tagname" value="${eml2-style-tag}" />
515
        <!-- param name="dirname" value="eml-2.1.0" / -->
516
        <param name="dirname" value="eml-2" />
517
     </antcall>
518
   </target>
519

    
520
   <target  name="copyxsl"
521
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
522

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

    
525
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
526
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
527
       <include name="**/*.xsl"/>
528
     </fileset>
529
     </copy>
530

    
531

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

    
537
   </target>
538
	
539
   <target name="correctEML201Docs" depends="jar"
540
		            description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
541
	   	<copy todir="${build.dir}" file="lib/metacat.properties" filtering="yes"/>    
542
	   	 <java classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector" >
543
		         <classpath>
544
		          <path refid="compile.classpath"/>
545
		          <fileset dir="${build.dir}">
546
		            <include name="${name}.jar"/>
547
		          </fileset>
548
		        </classpath>
549
		      </java>
550
   </target>
551

    
552
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
553
           description="Installs spatial option for metacat">
554

    
555
      <property name="spatial.dir" value="./lib/spatial"/>
556
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
557
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
558

    
559
      <!-- Copy geoserver libs into ${war.lib} -->
560
      <copy todir="${war.lib}" filtering="no">
561
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
562
          <include name="**"/>
563
        </fileset>
564
      </copy>
565

    
566
      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
567
      <copy todir="${war.webinf}" filtering="no">
568
        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
569
          <exclude name="lib/**"/>
570
          <exclude name="web.xml"/>
571
        </fileset>
572
      </copy>
573

    
574
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
575
      <copy todir="${war.context}" filtering="no">
576
        <fileset dir="${spatial.geoserver.dir}">
577
          <exclude name="WEB-INF/**"/>
578
          <exclude name="index.jsp"/>
579
        </fileset>
580
      </copy>
581

    
582
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
583
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
584
          tofile="${war.context}/geoserver.jsp"
585
          overwrite="true"
586
          filtering="no"/>
587

    
588
      <!-- Copy the rest of the modified geoserver web-inf files
589
      <copy todir="${war.webinf}" filtering="no">
590
        <fileset dir="${spatial.webinf-mods}">
591
          <exclude name="web.xml.combined"/>
592
        </fileset>
593
      </copy> -->
594

    
595
    </target>
596

    
597
   <target name="install" depends="build-metacat" description="* Full Install For Development *">
598
     <copy file="${dist.dir}/${metacat.context}.war" todir="${app.deploy.dir}"/>
599
   	 <delete dir="${app.deploy.dir}/${metacat.context}" />
600
   	   <tstamp>
601
   	   	 <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa"/>
602
   	   </tstamp>
603
   	 <echo>Dev install completed at ${NOW}</echo> 	   	
604
   </target>
605

    
606
   <target name="build-metacat" depends="install-ecogrid"
607
   	            description="Build Metacat">
608
   </target>
609
	
610
   <target name="install-ecogrid" depends="warPrepare, get-ecogrid" if="enable.ecogrid"
611
			    description="Install Ecogrid Compentent">
612
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="clean" inheritall="false">
613
   	         <property name="context" value="${metacat.context}"/>
614
   	   	     <property name="target" value="${ecogrid-target-name}"/>
615
   	   	     <!-- property name="metacat.dir" value="."/ -->
616
   	  </ant>
617
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="war" inheritall="false">
618
   	     <property name="context" value="${metacat.context}"/>
619
   	     <property name="target" value="${ecogrid-target-name}"/>
620
   	     <!-- property name="metacat.dir" value="."/ -->
621
   	  </ant>
622
   	  <!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
623
  	      <webinf dir="${ecogrid-dir}/lib">
624
   	        <include name="server-config.wsdd"/>
625
   	      </webinf>
626
   	  </war -->
627
   	  <copy file="${ecogrid-dir}/build/${metacat.context}.war" todir="${dist.dir}" overwrite="true"/>
628
   	  
629
   
630
   </target>
631
   
632
   <target name="get-ecogrid" depends="init" if="ecogrid.required" description="Check out ecogrid module">
633
	<echo>Enter CVS password: </echo>
634
	     <cvs cvsRoot="${cvsroot}"
635
	          package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
636
   </target>  
637
	
638
   <!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
639
   	 <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
640
   	   	 <property name="context" value="${metacat.context}"/>
641
   	   	 <property name="target" value="${ecogrid-target-name}"/>
642
   	     <property name="metacat.dir" value="."/>
643
   	     <property name="hostname" value="${ecogrid.hostname}"/>
644
   	     <property name="port" value="${config.port}"/>
645
   	 </ant>
646
   </target -->
647
	
648
   <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
649
      <delete file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
650
   </target>
651

    
652
   <!-- target name="install-registry" depends="init,getConversionXSL"
653
            description="Install Registry">
654

    
655
      <mkdir dir="${inst.cgi.dir}" />
656
      <copy file="${srcdir}/perl/register-dataset.cgi"
657
            todir="${inst.cgi.dir}"/>
658
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
659

    
660
      <! - - TODO SCW: set the permissions on this folder to be writable by the apache user - - >
661
      <mkdir dir="${temp-dir}" />
662
      <! - - TODO SCW: use relative paths to grab these instead of copying to tmp,
663
                     used in readDocumentFromMetacat - - >
664
      <copy todir="${temp-dir}" filtering="yes">
665
       <fileset dir="lib/style/common/emlb6toeml2">
666
         <include name="*.xsl"/>
667
         <include name="*.xml"/>
668
       </fileset>
669
      </copy>
670

    
671
      <echo message="Install Registry completed." />
672
   </target -->
673

    
674
   <!-- target name="install-ldap" depends="init"
675
            description="Install Metacat LDAP Access">
676

    
677
      <mkdir dir="${inst.cgi.dir}" />
678
      <copy file="${srcdir}/perl/ldapweb.cgi"
679
            todir="${inst.cgi.dir}" />
680
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
681
      <mkdir dir="${templates.dir}" />
682
      <copy todir="${templates.dir}">
683
        <fileset dir="lib/style/common/templates">
684
			< ! - - SCW: Copy all files - - >
685
        </fileset>
686
      </copy>
687
      <echo message="ldapweb install complete." />
688
   </target -->
689

    
690

    
691
   <target name="install-skin" depends="init"
692
            description="Install a Skin">
693

    
694
      <input message="Please enter name of the skin"
695
             addproperty="skin-name"/>
696

    
697
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
698
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
699
       <fileset dir="lib/style/skins/${skin-name}">
700
           <exclude name="**/*.png"/>
701
           <exclude name="**/*.gif"/>
702
           <exclude name="**/*.jpg"/>
703
           <exclude name="**/CVS*"/>
704
           <exclude name="**/.#*"/>
705
       </fileset>
706
      </copy>
707
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
708
       <fileset dir="lib/style/skins/${skin-name}">
709
           <include name="**/*.png"/>
710
           <include name="**/*.gif"/>
711
           <include name="**/*.jpg"/>
712
           <exclude name="**/CVS*"/>
713
           <exclude name="**/.#*"/>
714
       </fileset>
715
      </copy>
716
      <copy todir="${installdir}/style/common" filtering="yes">
717
       <fileset dir="lib/style/common">
718
           <include name="*.js"/>
719
           <include name="*.jsp"/>
720
           <include name="*.css"/>
721
           <exclude name="*.png"/>
722
           <exclude name="*.gif"/>
723
           <exclude name="*.jpg"/>
724
           <exclude name="**/CVS*"/>
725
           <exclude name="**/.#*"/>
726
       </fileset>
727
      </copy>
728
      <!--
729
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
730
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
731
       <fileset dir="lib/style/skins/${skin-name}/images">
732
           <include name="*.png"/>
733
           <include name="*.gif"/>
734
           <include name="*.jpg"/>
735
       </fileset>
736
      </copy>
737
      -->
738

    
739
      <echo message="Install Skin completed." />
740
   </target>
741

    
742
   <target name="war" depends="warPrepare,install-spatial"
743
            description="Create a web archive (WAR) for servlet deployment">
744
       <mkdir dir="${dist.dir}" />
745
       <war destfile="${dist.dir}/${metacat.context}.war"
746
            webxml="${build.war}/web.xml">
747
         <fileset dir="${war.context}"/>
748
         <lib dir="${war.lib}"/>
749
         <webinf dir="${war.webinf}"/>
750
       </war>
751
   </target>
752
	
753
   <target name="warPrepare" depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
754
            description="Prepare files for creating a web archive (WAR)">
755

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

    
910
   <target name="getConversionXSL" depends="prepare"
911
            unless="styles.not.needed"
912
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
913

    
914
     <echo>Enter CVS password: </echo>
915
     <cvs cvsRoot="${cvsroot}"
916
          package="${eml-module}"
917
          tag="${eml2-style-tag}"
918
          dest="${build.tmp}/eml_${eml2-style-tag}" />
919

    
920
     <mkdir dir="lib/style/common/emlb6toeml2" />
921
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
922
       <fileset dir="${build.tmp}/eml_${eml2-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
923
         <include name="*.xsl"/>
924
         <include name="*.xml"/>
925
       </fileset>
926
      </copy>
927
   </target>
928

    
929
   <target name="testprep" depends="jar,clientjar,harvesterjar">
930
      <mkdir dir="${build.tests}"/>
931
      <copy todir="${build.tests}" filtering="yes">
932
        <fileset dir="${testdir}">
933
          <include name="edu/**"/>
934
        </fileset>
935
      </copy>
936
   	  <copy todir="${build.tests}" file="${testdir}/test.properties" filtering="yes"/>
937

    
938
      <!-- copy and compile the tests into a jar file -->
939
      <javac srcdir="${build.tests}"
940
             destdir="${build.tests}"
941
             debug="on"
942
             includes="**/*.java">
943
        <classpath>
944
          <path refid="compile.classpath"/>
945
          <fileset dir="${build.dir}">
946
            <include name="${name}.jar"/>
947
            <include name="${name}-client.jar"/>
948
            <include name="harvester.jar"/>
949
          </fileset>
950
        </classpath>
951
      </javac>
952

    
953
      <jar jarfile="${build.dir}/${name}-junittests.jar"
954
        basedir="${build.tests}"
955
                includes="**/*.class" />
956
   </target>
957

    
958
   <target name="test" depends="testprep"
959
            description="Uses the ant junit task to run all JUnit tests">
960

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

    
975
        <formatter type="plain" />
976

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

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

    
990
              <echo>testtorun: ${testtorun}</echo>
991

    
992
      <!-- use the ant "junit" task to run JUnit tests. -->
993
      <junit printsummary="yes" haltonfailure="no" fork="yes"
994
             haltonerror="no" showoutput="yes">
995
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
996
        <classpath>
997
          <path refid="compile.classpath"/>
998
          <fileset dir="${build.dir}">
999
            <include name="${name}.jar"/>
1000
            <include name="${name}-client.jar"/>
1001
            <include name="harvester.jar"/>
1002
            <include name="${name}-junittests.jar"/>
1003
          </fileset>
1004
        </classpath>
1005

    
1006
        <formatter type="plain" />
1007

    
1008
        <batchtest fork="yes" todir="${build.dir}">
1009
          <fileset dir="${build.tests}">
1010
            <include name="**/${testtorun}.class" />
1011
          </fileset>
1012
        </batchtest>
1013
     </junit>
1014
   </target>
1015

    
1016
   <target name="testharvester"
1017
           depends="testprep"
1018
           description="Uses the ant junit task to test only the Harvester code">
1019
     <junit printsummary="yes"
1020
            haltonfailure="off"
1021
            fork="yes"
1022
            haltonerror="off">
1023
        <classpath>
1024
          <path refid="compile.classpath"/>
1025
          <fileset dir="${build.dir}">
1026
            <include name="${name}.jar"/>
1027
            <include name="${name}-client.jar"/>
1028
            <include name="harvester.jar"/>
1029
            <include name="${name}-junittests.jar"/>
1030
          </fileset>
1031
        </classpath>
1032
       <formatter type="plain" />
1033
       <batchtest fork="yes" todir="${build.dir}">
1034
         <fileset dir="${build.tests}">
1035
           <include name="**/harvesterClient/*.class" />
1036
         </fileset>
1037
       </batchtest>
1038
     </junit>
1039
   </target>
1040

    
1041
  <target name="gethttpclient" depends="prepare"
1042
            description="checks out and compiles morpho httpclient code">
1043
  <!--mkdir dir="${morphosourcedir}" -->
1044
        <cvs cvsRoot="${cvsroot}"
1045
             package="morpho"
1046
             dest="." />
1047
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1048
   </target>
1049

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

    
1054
      <echo>***********************************
1055
      Please run ant gethttpclient first!
1056
      ***********************************
1057
      </echo>
1058
      <!-- copy and compile the tests into a jar file -->
1059
      <mkdir dir="${build.metacatnettest}"/>
1060
      <javac srcdir="${junitnettestsdir}"
1061
             destdir="${build.metacatnettest}"
1062
             includes="**/*.java">
1063
        <classpath>
1064
          <path refid="compile.classpath"/>
1065
          <fileset dir="${build.dir}">
1066
            <include name="${name}.jar"/>
1067
          </fileset>
1068
        </classpath>
1069
      </javac>
1070

    
1071
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1072
                    basedir="${build.metacatnettest}"
1073
                    includes="**/*.class" />
1074

    
1075
      <!-- use the ant "junit" task to run JUnit tests. -->
1076
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1077
             haltonerror="no">
1078
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1079
        <classpath>
1080
          <path refid="compile.classpath"/>
1081
          <fileset dir="${build.dir}">
1082
            <include name="${name}.jar"/>
1083
            <include name="${name}-junitnettests.jar"/>
1084
          </fileset>
1085
        </classpath>
1086

    
1087
        <formatter type="plain" />
1088

    
1089
        <batchtest fork="yes" todir="${build.dir}">
1090
          <fileset dir="${build.metacatnettest}">
1091
            <include name="**/*.class" />
1092
          </fileset>
1093
        </batchtest>
1094
     </junit>
1095
   </target>
1096

    
1097
   <target name="cleanweb" depends="clean"
1098
            description="deletes tomcat web context dir and all its contents">
1099
     <delete dir="${installdir}" />
1100
   </target>
1101

    
1102

    
1103
   <target name="clean" depends="init"
1104
            description="deletes build dir and files that can be regenerated form the release">
1105
       <delete dir="${build.dir}" />
1106
       <delete dir="${dist.dir}" />
1107
   </target>
1108

    
1109
	<target name="localclean" depends="clean"
1110
	            description="deletes even jars that depend on external sources such as stylesheets and jars">
1111
	       <delete file="lib/httpclient.jar" />
1112
	       <delete file="lib/utilities.jar" />
1113
	</target>	
1114
	
1115
   <target name="fullclean" depends="localclean"
1116
            description="deletes code and eml">
1117
       <delete includeEmptyDirs="true" failonerror="false">
1118
         <fileset dir="${style-common-cvsrelpath}">
1119
           <include name="${eml-css}" />
1120
           <include name="eml-*/*.xsl" />
1121
           <include name="eml-*" />
1122
         </fileset>
1123
       	 <fileset dir="${schema-cvsrelpath}">
1124
       	   <include name="eml-*/*.xsd" />
1125
       	 </fileset>
1126
       	 <fileset dir="${ecogrid-dir}">
1127
       		<include name="build.properties" />
1128
       		<include name="buildfiles/metacatImpl.xml" />
1129
         </fileset>
1130
       </delete>
1131
   </target>
1132

    
1133
   <target name="jdoc" depends="prepare"
1134
            description="generates javadoc documentation">
1135
       <javadoc packagenames="edu.ucsb.nceas.*"
1136
           sourcepath="${build.src}"
1137
           destdir="${build.javadocs}"
1138
           author="true"
1139
           version="true"
1140
           use="true"
1141
           windowtitle="${Name} API"
1142
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1143
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1144
         <classpath>
1145
           <path refid="compile.classpath"/>
1146
         </classpath>
1147
       </javadoc>
1148
   </target>
1149

    
1150
   <target name="dist"
1151
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1152
            description="prepares a full release distribution">
1153
      <mkdir dir="${dist.dir}"/>
1154
      <delete dir="${ver.dir}" />
1155
      <mkdir dir="${ver.dir}"/>
1156
      <copy todir="${ver.dir}">
1157
        <fileset dir="."
1158
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip"/>
1159
      </copy>
1160
      <copy todir="${ver.dir}" file="build.xml"/>
1161
      <copy todir="${ver.dir}" file="build.properties"/>
1162

    
1163
      <copy todir="${ver.dir}/docs" filtering="yes">
1164
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1165
      </copy>
1166
      <copy todir="${ver.dir}/docs" filtering="no">
1167
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1168
      </copy>
1169
      <copy todir="${ver.dir}/docs/dev">
1170
        <fileset dir="${build.dir}/docs"/>
1171
      </copy>
1172
      <copy todir="${ver.dir}/src">
1173
        <fileset dir="${build.dir}/src"/>
1174
      </copy>
1175
   	
1176
   	  <mkdir dir="${ver.dir}/tests/servertestfiles"/>
1177
	  <copy todir="${ver.dir}/test/servertestfiles">
1178
	    <fileset dir="./test/servertestfiles"/>
1179
	  </copy>
1180
  </target>
1181

    
1182
	<target name="distbin" depends="build-metacat,war-lsid" description="prepares a binary distribution">
1183
		<copy todir="${dist.dir}">
1184
			<fileset dir="./src/scripts"  />
1185
		</copy>	
1186
		<delete file="./${name}-bin-${release}.zip" />
1187
		<zip zipfile="./${name}-bin-${release}.zip" 
1188
			basedir="${dist.dir}"
1189
			excludes="metacat-*/**"/>	
1190
		<delete file="./${name}-bin-${release}.tar.gz" />
1191
		<tar tarfile="./${name}-bin-${release}.tar" 
1192
			basedir="${dist.dir}" 
1193
			excludes="metacat-*/**"/>
1194
		<gzip zipfile="./${name}-bin-${release}.tar.gz" src="./${name}-bin-${release}.tar" />
1195
		<delete file="./${name}-bin-${release}.tar" />
1196
	</target>
1197
	
1198
  <target name="distsrc" depends="dist"
1199
            description="prepares a source distribution">
1200
      <mkdir dir="${ver.src}"/>
1201
      <copy todir="${ver.src}">
1202
        <fileset dir="./src"/>
1203
      </copy>
1204
      <mkdir dir="${util.dir}"/>
1205
      <copy todir="${util.dir}">
1206
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1207
      </copy>
1208
  	  
1209
  	  <mkdir dir="${ecogrid-dist-dir}"/>
1210
  	  <copy todir="${ecogrid-dist-dir}">
1211
  	        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1212
  	  </copy>
1213

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

    
1216
      <delete file="./${name}-src-${release}.zip"/>
1217
      <zip zipfile="./${name}-src-${release}.zip" 
1218
      	   basedir="${dist.dir}"
1219
      	   excludes="metacat*.tar.gz,metacat*.zip"/>
1220
      <delete file="./${name}-src-${release}.tar.gz" />
1221
      <tar tarfile="./${name}-src-${release}.tar" 
1222
      	   basedir="${dist.dir}"
1223
      	   excludes="metacat*.tar.gz,metacat*.zip"/>
1224
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1225
                src="./${name}-src-${release}.tar"/>
1226
      <delete file="./${name}-src-${release}.tar" />
1227
      <!--delete dir="${dist.dir}"/ --> 
1228
  </target>
1229
	
1230
  <target name="deb-package" depends="distbin"
1231
  	  description="create a debian installation package">
1232
  	<delete dir="${deb.pkg.dir}"/>
1233
    <mkdir dir="${deb.pkg.dir}/DEBIAN"/>
1234
  	<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1235
      <fileset dir="./src/scripts/debian"
1236
               includes="control postinst"/>
1237
    </copy>
1238
  	
1239
    <mkdir dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"/>
1240
  	<copy todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1241
  		  filtering="yes">
1242
      <fileset dir="./src/scripts/debian"
1243
               excludes="control postinst" />
1244
    </copy>
1245
  	<chmod file="${deb.pkg.dir}/DEBIAN/postinst" 
1246
  	       perm="755"/>
1247
  	
1248
  	<copy file="${dist.dir}/knb.war" 
1249
  		  todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"/>
1250
  	<copy file="./metacat-bin-${metacat.version}.tar.gz" 
1251
  		  tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1252
  	
1253
    <exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix" failonerror="true">
1254
      <arg line="--build debian" />   	
1255
    </exec>
1256
  	
1257
  	<move file="${pkg.dir}/debian.deb" 
1258
  		  tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb"/>
1259
  </target>
1260

    
1261
   <target name="stylesheettest">
1262
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1263
      <param name="displaymodule" expression="${displaymodule}"/>
1264
      <param name="docid" expression="${input}"/>
1265
      <param name="entitytype" expression="${entitytype}"/>
1266
      <param name="entityindex" expression="${entityindex}"/>
1267
      <outputproperty name="method" value="html"/>
1268
      <outputproperty name="standalone" value="yes"/>
1269
      <outputproperty name="encoding" value="iso8859_1"/>
1270
      <outputproperty name="indent" value="yes"/>
1271
    </xslt>
1272
  </target>
1273

    
1274
 
1275
  <target name="compilewebclient" depends="prepare">
1276
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1277
  </target>
1278

    
1279
  <target name="runwebclient" depends="compilewebclient">
1280
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1281
           dir="${build.dest}" fork="yes"
1282
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1283
         <arg value="${serviceUrl}"/>
1284
         <arg value="${docid}"/>
1285
     </java>
1286
  </target>
1287
  
1288
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1289

    
1290
    <echo message="Compiling the metatcat shapefile creator"/>
1291
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1292
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1293
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1294
    </exec>
1295
  
1296
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1297
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1298
    </exec>
1299
  </target>
1300

    
1301
    <!-- LSID Authority support -->
1302
    <patternset id="lsid.jars">
1303
        <include name="axis.jar" />
1304
        <include name="commons-discovery-0.2.jar" />
1305
        <include name="jaxrpc.jar" />
1306
        <include name="lsid-client-1.1.1.jar" />
1307
        <include name="lsid-server-1.1.1.jar" />
1308
        <include name="saaj.jar" />
1309
        <include name="wsdl4j-1.5.1.jar" />
1310
        <include name="activation.jar" />
1311
        <include name="castor-0.9.5.jar" />
1312
        <include name="dnsjava-1.3.2.jar" />
1313
        <include name="mail.jar" />
1314
        <include name="commons-logging-1.0.4.jar" />
1315
        <!-- These jars may be needed but seem to not actually be,
1316
             so leaving them out for now
1317
        <include name="axis-ant.jar" />
1318
        -->
1319
        <!--<include name="GenCastor.class" />-->
1320
    </patternset>
1321
    <patternset id="lib.jars">
1322
        <include name="httpclient.jar" />
1323
        <include name="log4j-1.2.12.jar" />
1324
        <include name="utilities.jar" />
1325
        <include name="xercesImpl.jar" />
1326
        <include name="xalan.jar" />
1327
        <include name="xml-apis.jar" />
1328
    </patternset>
1329

    
1330
    <path id="lsid.classpath">
1331
        <fileset dir="${lsid.lib.dir}">
1332
            <patternset refid="lsid.jars"/>
1333
        </fileset>
1334
        <fileset dir="${lib.dir}">
1335
            <patternset refid="lsid.jars"/>
1336
        </fileset>
1337
        <fileset dir="${lib.dir}">
1338
            <include name="xalan.jar" />
1339
            <include name="xml-apis.jar" />
1340
        </fileset>
1341
        <fileset dir="${build.dir}">
1342
            <include name="metacat-client.jar" />
1343
        </fileset>
1344
    </path>
1345

    
1346
    <filterset id="configFilters">
1347
        <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1348
                value="${config.hostname}" / -->
1349
        <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1350
                value="${config.port}" / -->
1351
        <!-- MCD BYE filter token="METADATA_LABELS"
1352
                value="${config.metadataLabelLsid}" / -->
1353
        <!-- MCD BYE filter token="METACAT_SERVER"
1354
                value="${config.metacatserver}" / -->
1355
        <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1356
                value="${config.lsidauthority}" / -->
1357
    </filterset>
1358
    
1359
    <target name="prepare-lsid"
1360
            depends="prepare,utilities,clientjar"
1361
            description="Configure files prior to compilation">
1362
        <mkdir dir="${lsid.build.dir}" />
1363
        <!-- Copy the properties file into the build -->
1364
        <copy file="${conf.dir}/metacat-lsid.properties"
1365
              tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1366
              overwrite="true">
1367
            <filterset refid="configFilters" />
1368
        </copy>
1369
        <copy file="${conf.dir}/log4j.properties"
1370
              tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1371
              overwrite="true">
1372
            <filterset refid="configFilters" />
1373
        </copy>
1374
        <!-- Copy config files into the build -->
1375
        <copy todir="${lsid.build.dir}/WEB-INF">
1376
            <fileset dir="${webinf.dir}"
1377
                     includes="**/*.wsdd" />
1378
        </copy>
1379
        <!-- Copy the metadata configuration files into the build -->
1380
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1381
        <copy todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1382
            <fileset dir="${conf.dir}"
1383
                     includes="**/*.xml" />
1384
            <fileset dir="${conf.dir}"
1385
                     includes="**/*.xslt" />
1386
            <filterset refid="configFilters" />
1387
        </copy>
1388
        <!-- Copy services files into the build -->
1389
        <mkdir dir="${lsid.build.dir}/services" />
1390
        <copy todir="${lsid.build.dir}/services">
1391
            <fileset dir="${services.dir}" />
1392
            <filterset refid="configFilters" />
1393
        </copy>
1394
        <!-- Copy axis files into the build -->
1395
        <mkdir dir="${lsid.build.dir}" />
1396
        <copy todir="${lsid.build.dir}">
1397
            <fileset dir="${conf.dir}/axis"
1398
                     excludes="*.properties"/>
1399
        </copy>
1400
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1401
        <copy todir="${lsid.build.dir}/WEB-INF/classes">
1402
            <fileset dir="${conf.dir}/axis"
1403
                     includes="*.properties"/>
1404
        </copy>
1405
    </target>
1406
    
1407
    <target name="compile-lsid"
1408
            depends="prepare-lsid"
1409
            description="Compile Java sources">
1410
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1411
        <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1412
               destdir="${lsid.build.dir}/WEB-INF/classes"
1413
               debug="${compile.debug}"
1414
               deprecation="${compile.deprecation}"
1415
               optimize="${compile.optimize}">
1416
            <classpath refid="lsid.classpath" />
1417
        </javac>
1418
    </target>
1419
    
1420
    <target name="war-lsid"
1421
            depends="compile-lsid"
1422
            description="Create a war file for the application">
1423
        <mkdir dir="${dist.dir}" />
1424
        <war destfile="${dist.dir}/${authority.context}.war"
1425
             webxml="${webinf.dir}/web.xml">
1426
            <fileset dir="${lsid.build.dir}" />
1427
            <lib dir="${lsid.lib.dir}">
1428
                <patternset refid="lsid.jars"/>
1429
            </lib>
1430
            <lib dir="${lib.dir}">
1431
                <patternset refid="lib.jars"/>
1432
            </lib>
1433
            <lib dir="${lib.dir}">
1434
                <include name="xalan.jar" />
1435
                <include name="xml-apis.jar" />
1436
            </lib>
1437
            <lib dir="${build.dir}">
1438
                <include name="metacat-client.jar" />
1439
            </lib>
1440
        </war>
1441
    </target>
1442
    
1443
    <target name="deploy-lsid"
1444
            depends="war-lsid"
1445
            description="Deploy LSID war to servlet container">
1446
        <delete dir="${app.deploy.dir}/${authority.context}" />
1447
        <delete file="${app.deploy.dir}/${authority.context}.war" />
1448
        <mkdir dir="${app.deploy.dir}" />
1449
        <copy todir="${app.deploy.dir}">
1450
            <fileset dir="${dist.dir}" />
1451
        </copy>
1452
    </target>
1453
</project>
(5-5/5)