Project

General

Profile

metacat / build.xml @ 4960

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: walbridge $'
10
  *    '$Date: 2009-06-18 17:48:10 -0700 (Thu, 18 Jun 2009) $'
11
  *    '$Revision: 4960 $'
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.ecogridUrl" value="https://code.ecoinformatics.org/code/seek/trunk/projects/ecogrid/" />
239
      <!--  property name="svn.utilitiesExportPath" value="${knbdir}" / -->  
240
      
241
      <!-- load the svn task -->
242
      <path id="svn.classpath">
243
        <pathelement location="${svnjavahl.jar}" />
244
        <pathelement location="${svnant.jar}" />
245
        <pathelement location="${svnClientAdapter.jar}" />
246
      </path>
247
      <taskdef resource="svntask.properties" classpathref="svn.classpath"/>  
248
      
249
      <condition property="utilities.required">
250
        <or>
251
          <not><available file="lib/httpclient.jar"/></not>
252
          <not><available file="lib/utilities.jar"/></not>
253
          <not><available file="${utilitiesdir}" type="dir"/></not>
254
        </or>
255
      </condition>
256
             <!-- peer.utilities.required is used when there is no utilities 
257
                  directory at ${utilitiesdir} -->
258
      <condition property="peer.utilities.required">
259
        <or>
260
          <not><available file="${utilitiesdir}" type="dir"/></not>
261
        </or>
262
      </condition>
263
      <condition property="eml.required">
264
        <or>
265
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
266
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
267
          <not><available file="lib/schema/eml-2.1.0/eml.xsd"/></not>
268
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
269
        </or>
270
      </condition>
271
             
272
      <condition property="ecogrid.required">
273
                 <or>
274
             <not><available file="${ecogrid-dir}/build.properties"/></not>
275
             <not><available file="${ecogrid-dir}/buildfiles/metacatImpl.xml"/></not>
276
           </or>
277
      </condition>
278

    
279
   </target>
280

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
532

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

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

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

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

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

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

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

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

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

    
596
    </target>
597

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

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

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

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

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

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

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

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

    
691

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

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

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

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

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

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

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

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

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

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

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

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

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

    
962
      <!-- use the ant "junit" task to run JUnit tests. -->
963
      <junit printsummary="yes" haltonfailure="no" fork="yes"
964
             haltonerror="no">
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="**/*.class"/>
981
                  <exclude name="**/MCTestCase.class" />
982
                  <exclude name="**/ClientViewHelperTest.class" />
983
          </fileset>
984
        </batchtest>
985
     </junit>
986
   </target>
987

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

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

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

    
1007
        <formatter type="plain" />
1008

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

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

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

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

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

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

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

    
1088
        <formatter type="plain" />
1089

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

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

    
1103

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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