Project

General

Profile

metacat / build.xml @ 4435

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

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

    
59
      <property name="debug"               value="on" />
60
      <!-- MCD BYE in metacat.properties property name="debuglevel"          value="55" / -->
61

    
62
      <property name="morphosourcedir"     value="../morpho" />
63
      <!-- MCD BYE in metacat.properties property name="defaultcontenttype"  value="application/octet-stream" / -->
64
      <property name="utilitiesdir"        value="../utilities" />
65
      <property name="installdir"        value="${dev.deploy.dir}/${metacat.context}" />
66

    
67
      <echo>*********** set jsdk to ${jsdk}</echo>
68
  </target>
69

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

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

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

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

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

    
160
      <filter token="eml-version"          value="${eml-version}"/>
161
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
162
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
163
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
164
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
165
      <!-- MCD BYE filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" / -->
166
      <!-- MCD BYE filter filter token="debuglevel"           value="${debuglevel}" / -->
167
      <!-- MCD BYE filter token="defaultcontenttype"   value="${defaultcontenttype}" / -->
168
      <filter token="debugprefix"          value="${debugprefix}"/>
169
      <filter token="indexPaths"           value="${indexPaths}"/>
170

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

    
228
      <property name="package.home"        value="edu/ucsb/nceas/metacat" />
229
      <condition property="utilities.required">
230
        <or>
231
          <not><available file="lib/httpclient.jar"/></not>
232
          <not><available file="lib/utilities.jar"/></not>
233
        </or>
234
      </condition>
235
      <condition property="eml.required">
236
        <or>
237
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
238
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
239
          <not><available file="lib/schema/eml-2.1.0/eml.xsd"/></not>
240
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
241
        </or>
242
      </condition>
243
             
244
      <condition property="ecogrid.required">
245
                 <or>
246
             <not><available file="${ecogrid-dir}/build.properties"/></not>
247
             <not><available file="${ecogrid-dir}/buildfiles/metacatImpl.xml"/></not>
248
           </or>
249
      </condition>
250

    
251
   </target>
252

    
253
   <target name="prepare" depends="init">
254
      <mkdir dir="${build.dir}"/>
255
      <mkdir dir="${build.src}"/>
256
      <mkdir dir="${build.dest}"/>
257
      <mkdir dir="${build.javadocs}"/>
258
      <mkdir dir="${build.tmp}"/>
259

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

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

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

    
287
   <target name="jar" depends="compile,geteml"
288
    description="Compiles and jars metacat java code to metacat.jar in build dir">
289

    
290
       <delete file="${build.dir}/${name}.jar" />
291
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
292
            excludes="**/protocols/ **/harvesterClient/" />
293
   </target>
294

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

    
302
   <target name="utilities" depends="config" if="utilities.required">
303
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
304
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
305
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
306
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
307
   </target>
308

    
309
   <target name="getutilities" depends="prepare"
310
   description="Checks utility out of cvs and copies it to your metacat cvs sandbox">
311
     <echo>Enter CVS password: </echo>
312
     <cvs cvsRoot="${cvsroot}"
313
          package="${util-module}"
314
          dest="${build.tmp}" />
315
   </target>
316

    
317
   <target name="client" depends="utilities, prepare"
318
    description="Compiles metacat-client java code to build dir">
319
       <javac srcdir="${build.src}"
320
              destdir="${build.dest}"
321
              includes="edu/ucsb/nceas/metacat/client/*">
322
          <classpath>
323
            <path refid="compile.classpath"/>
324
          </classpath>
325
        </javac>
326
   </target>
327

    
328
   <target name="clientjar" depends="client"
329
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
330
       <delete file="${build.dir}/${name}-client.jar" />
331
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
332
            includes="**/metacat/client/" />
333
   </target>
334

    
335
    <target name="advancedsearchjar" depends="compile"
336
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
337
        <delete file="${build.dir}/advancedsearch.jar" />
338
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
339
             includes="**/metacat/advancedsearch/" />
340
    </target>
341

    
342
   <target name="harvester" depends="client"
343
           description="Compiles harvester java code to build dir">
344
       <javac srcdir="${build.src}"
345
              destdir="${build.dest}"
346
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
347
          <classpath>
348
            <path refid="compile.classpath"/>
349
          </classpath>
350
        </javac>
351
   </target>
352

    
353
   <target name="harvesterjar" depends="harvester"
354
           description="Compiles and jars harvester java code to harvester.jar in build dir">
355
       <delete file="${build.dir}/harvester.jar" />
356
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
357
            includes="**/metacat/harvesterClient/" />
358
   </target>
359

    
360
   <target name="harvestListEditorDist" depends="harvesterjar"
361
           description="Prepares a distribution of the Harvest List Editor tool">
362
       <mkdir dir="${dist.dir.hle}"/>
363
       <delete dir="${ver.dir.hle}" />
364
       <mkdir dir="${ver.dir.hle}"/>
365
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
366
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
367
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
368
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
369
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
370
       <delete file="./harvest-list-editor-${release}.zip"/>
371
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
372
       <delete file="./harvest-list-editor-${release}.tar.gz" />
373
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
374
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
375
             src="./harvest-list-editor-${release}.tar"/>
376
       <delete file="./harvest-list-editor-${release}.tar" />
377
   </target>
378

    
379
   <target  name="geteml" depends="getemlpre2,geteml2+,getConversionXSL" if="eml.required"
380
            description="Calls getemlpre2 and geteml2+ targets" />
381

    
382
   <target name="getemlpre2" depends="prepare" if="eml.required"
383
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
384
     <echo>Enter CVS password: </echo>
385
     <cvs cvsRoot="${cvsroot}"
386
          package="${eml-module}"
387
          tag="${eml-tag}"
388
          dest="${build.tmp}/eml_${eml-tag}" />
389
     <mkdir dir="lib/dtd" />
390
     <copy todir="lib/dtd" filtering="yes">
391
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
392
         <include name="*.dtd"/>
393
       </fileset>
394
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
395
     </copy>
396

    
397
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
398
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
399
       <include name="**/*.xsl"/>
400
     </fileset>
401
     </copy>
402
   </target>
403

    
404
   <target name="geteml2+" depends="prepare" if="eml.required"
405
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
406
     <echo>Enter CVS password: </echo>
407
     <cvs cvsRoot="${cvsroot}"
408
          package="${eml-module}"
409
          tag="${eml2_0_0-tag}"
410
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
411
     <mkdir dir="lib/schema/eml-2.0.0" />
412
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
413
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
414
         <include name="*.xsd"/>
415
       </fileset>
416

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

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

    
423
     </copy>
424
     <!-- <antcall target="copyxsl">
425
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
426
        <param name="dirname" value="eml-2.0.0" />
427
     </antcall> -->
428
           
429
           <!-- Checkout eml201 for given schema tag-->
430
     <echo>Enter CVS password: </echo>
431
     <cvs cvsRoot="${cvsroot}"
432
          package="${eml-module}"
433
          tag="${eml2_0_1-schema-tag}"
434
          dest="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
435
     <mkdir dir="lib/schema/eml-2.0.1" />
436
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
437
       <fileset dir="${build.tmp}/eml_${eml2_0_1-schema-tag}/${eml-module}">
438
         <include name="*.xsd"/>
439
       </fileset>
440
     </copy>
441
           
442
           <!-- Checkout eml201 again for given style sheet tag-->
443
           <echo>Enter CVS password: </echo>
444
                <cvs cvsRoot="${cvsroot}"
445
                     package="${eml-module}"
446
                     tag="${eml2_0_1-style-tag}"
447
                     dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
448
     <antcall target="copyxsl">
449
        <param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
450
        <param name="dirname" value="eml-2.0.1" />
451
     </antcall>
452
        
453
           <!-- Checkout eml210 for given schema tag-->
454
     <echo>Enter CVS password: </echo>
455
     <cvs cvsRoot="${cvsroot}"
456
          package="${eml-module}"
457
          tag="${eml2_1_0-schema-tag}"
458
          dest="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
459
     <mkdir dir="lib/schema/eml-2.1.0" />
460
     <copy todir="lib/schema/eml-2.1.0" filtering="yes">
461
       <fileset dir="${build.tmp}/eml_${eml2_1_0-schema-tag}/${eml-module}">
462
         <include name="*.xsd"/>
463
       </fileset>
464
     </copy>
465
        
466
           <!-- Checkout eml210 for given style sheet tag-->
467
           <echo>Enter CVS password: </echo>
468
                <cvs cvsRoot="${cvsroot}"
469
                     package="${eml-module}"
470
                     tag="${eml2_1_0-style-tag}"
471
                     dest="${build.tmp}/eml_${eml2_1_0-style-tag}" />
472
     <antcall target="copyxsl">
473
        <param name="cvs.tagname" value="${eml2_1_0-style-tag}" />
474
        <param name="dirname" value="eml-2.1.0" />
475
     </antcall>
476
   </target>
477

    
478
   <target  name="copyxsl"
479
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
480

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

    
483
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
484
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
485
       <include name="**/*.xsl"/>
486
     </fileset>
487
     </copy>
488

    
489

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

    
495
   </target>
496
        
497
   <target name="correctEML201Docs" depends="jar"
498
                            description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
499
                   <copy todir="${build.dir}" file="lib/metacat.properties" filtering="yes"/>    
500
                    <java classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector" >
501
                         <classpath>
502
                          <path refid="compile.classpath"/>
503
                          <fileset dir="${build.dir}">
504
                            <include name="${name}.jar"/>
505
                          </fileset>
506
                        </classpath>
507
                      </java>
508
   </target>
509

    
510
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
511
           description="Installs spatial option for metacat">
512

    
513
      <property name="spatial.dir" value="./lib/spatial"/>
514
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
515
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
516

    
517
      <!-- Copy geoserver libs into ${war.lib} -->
518
      <copy todir="${war.lib}" filtering="no">
519
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
520
          <include name="**"/>
521
        </fileset>
522
      </copy>
523

    
524
      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
525
      <copy todir="${war.webinf}" filtering="no">
526
        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
527
          <exclude name="lib/**"/>
528
          <exclude name="web.xml"/>
529
        </fileset>
530
      </copy>
531

    
532
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
533
      <copy todir="${war.context}" filtering="no">
534
        <fileset dir="${spatial.geoserver.dir}">
535
          <exclude name="WEB-INF/**"/>
536
          <exclude name="index.jsp"/>
537
        </fileset>
538
      </copy>
539

    
540
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
541
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
542
          tofile="${war.context}/geoserver.jsp"
543
          overwrite="true"
544
          filtering="no"/>
545

    
546
      <!-- Copy the rest of the modified geoserver web-inf files
547
      <copy todir="${war.webinf}" filtering="no">
548
        <fileset dir="${spatial.webinf-mods}">
549
          <exclude name="web.xml.combined"/>
550
        </fileset>
551
      </copy> -->
552

    
553
    </target>
554

    
555
   <target name="dev-install" depends="clean, install-ecogrid" description="* Full Install For Development *">
556
     <copy file="${dist.dir}/${metacat.context}.war" todir="${dev.deploy.dir}"/>
557
            <delete dir="${dev.deploy.dir}/${metacat.context}" />
558
              <tstamp>
559
                       <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa"/>
560
              </tstamp>
561
            <echo>Dev install completed at ${NOW}</echo>                    
562
   </target>
563

    
564
<!--
565
   <target name="install" depends="install-ecogrid" description="* Full Install *">
566
       <mkdir dir="${datafilepath}" />
567
       <mkdir dir="${inlinedatafilepath}" />
568
       <chmod dir="${datafilepath}" perm="ug+w" />
569
       <mkdir dir="${temp-dir}"/>
570
       <chmod dir="${temp-dir}" perm="ug+w" />
571
       <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
572
              <echo>If you enable ecogrid installation, please run "ant deploy-ecogrid" when installation or upgrade is done</echo> 
573
   </target>
574
-->
575
        
576
   <target name="install-ecogrid" depends="war, get-ecogrid" if="enable.ecogrid"
577
                            description="Install Ecogrid Compentent">
578
             <ant antfile="build.xml" dir="${ecogrid-dir}" target ="clean" inheritall="false">
579
                    <property name="context" value="${metacat.context}"/>
580
                           <property name="target" value="${ecogrid-target-name}"/>
581
                           <!-- property name="metacat.dir" value="."/ -->
582
             </ant>
583
             <ant antfile="build.xml" dir="${ecogrid-dir}" target ="war" inheritall="false">
584
                <property name="context" value="${metacat.context}"/>
585
                <property name="target" value="${ecogrid-target-name}"/>
586
                <!-- property name="metacat.dir" value="."/ -->
587
             </ant>
588
             <war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
589
                <webinf dir="${ecogrid-dir}/lib">
590
                   <include name="server-config.wsdd"/>
591
                 </webinf>
592
             </war>
593
             <copy file="${ecogrid-dir}/build/${metacat.context}.war" todir="${dist.dir}" overwrite="true"/>
594
             
595
   
596
   </target>
597
   
598
   <target name="get-ecogrid" depends="init" if="ecogrid.required" description="Check out ecogrid module">
599
        <echo>Enter CVS password: </echo>
600
             <cvs cvsRoot="${cvsroot}"
601
                  package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
602
   </target>  
603
        
604
   <target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
605
            <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
606
                       <property name="context" value="${metacat.context}"/>
607
                       <property name="target" value="${ecogrid-target-name}"/>
608
                <property name="metacat.dir" value="."/>
609
                <property name="hostname" value="localhost"/>
610
                <property name="port" value="${config.port}"/>
611
            </ant>
612
   </target>
613
        
614
   <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
615
      <delete file="${dev.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
616
   </target>
617

    
618
   <!-- target name="install-registry" depends="init,getConversionXSL"
619
            description="Install Registry">
620

621
      <mkdir dir="${inst.cgi.dir}" />
622
      <copy file="${srcdir}/perl/register-dataset.cgi"
623
            todir="${inst.cgi.dir}"/>
624
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
625

626
      <! - - TODO SCW: set the permissions on this folder to be writable by the apache user - - >
627
      <mkdir dir="${temp-dir}" />
628
      <! - - TODO SCW: use relative paths to grab these instead of copying to tmp,
629
                     used in readDocumentFromMetacat - - >
630
      <copy todir="${temp-dir}" filtering="yes">
631
       <fileset dir="lib/style/common/emlb6toeml2">
632
         <include name="*.xsl"/>
633
         <include name="*.xml"/>
634
       </fileset>
635
      </copy>
636

637
      <echo message="Install Registry completed." />
638
   </target -->
639

    
640
   <!-- target name="install-ldap" depends="init"
641
            description="Install Metacat LDAP Access">
642

643
      <mkdir dir="${inst.cgi.dir}" />
644
      <copy file="${srcdir}/perl/ldapweb.cgi"
645
            todir="${inst.cgi.dir}" />
646
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
647
      <mkdir dir="${templates.dir}" />
648
      <copy todir="${templates.dir}">
649
        <fileset dir="lib/style/common/templates">
650
                        < ! - - SCW: Copy all files - - >
651
        </fileset>
652
      </copy>
653
      <echo message="ldapweb install complete." />
654
   </target -->
655

    
656

    
657
   <target name="install-skin" depends="init"
658
            description="Install a Skin">
659

    
660
      <input message="Please enter name of the skin"
661
             addproperty="skin-name"/>
662

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

    
705
      <echo message="Install Skin completed." />
706
   </target>
707

    
708
   <target name="war" depends="warPrepare,install-spatial"
709
            description="Create a web archive (WAR) for servlet deployment">
710
       <mkdir dir="${dist.dir}" />
711
       <war destfile="${dist.dir}/${metacat.context}.war"
712
            webxml="${build.war}/web.xml">
713
         <fileset dir="${war.context}"/>
714
         <lib dir="${war.lib}"/>
715
         <webinf dir="${war.webinf}"/>
716
       </war>
717
   </target>
718
        
719
   <target name="warPrepare" depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
720
            description="Prepare files for creating a web archive (WAR)">
721

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

    
861
   <target name="getConversionXSL" depends="prepare"
862
            unless="styles.not.needed"
863
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
864

    
865
     <echo>Enter CVS password: </echo>
866
     <cvs cvsRoot="${cvsroot}"
867
          package="${eml-module}"
868
          tag="${eml2_0_1-style-tag}"
869
          dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
870

    
871
     <mkdir dir="lib/style/common/emlb6toeml2" />
872
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
873
       <fileset dir="${build.tmp}/eml_${eml2_0_1-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
874
         <include name="*.xsl"/>
875
         <include name="*.xml"/>
876
       </fileset>
877
      </copy>
878
   </target>
879

    
880
   <target name="testprep" depends="jar,clientjar,harvesterjar">
881
      <mkdir dir="${build.tests}"/>
882
      <copy todir="${build.tests}" filtering="yes">
883
        <fileset dir="${testdir}">
884
          <include name="edu/**"/>
885
        </fileset>
886
      </copy>
887
             <copy todir="${build.tests}" file="${testdir}/test.properties" filtering="yes"/>
888

    
889
      <!-- copy and compile the tests into a jar file -->
890
      <javac srcdir="${build.tests}"
891
             destdir="${build.tests}"
892
             debug="on"
893
             includes="**/*.java">
894
        <classpath>
895
          <path refid="compile.classpath"/>
896
          <fileset dir="${build.dir}">
897
            <include name="${name}.jar"/>
898
            <include name="${name}-client.jar"/>
899
            <include name="harvester.jar"/>
900
          </fileset>
901
        </classpath>
902
      </javac>
903

    
904
      <jar jarfile="${build.dir}/${name}-junittests.jar"
905
        basedir="${build.tests}"
906
                includes="**/*.class" />
907
   </target>
908

    
909
   <target name="test" depends="testprep"
910
            description="Uses the ant junit task to run all JUnit tests">
911

    
912
      <!-- use the ant "junit" task to run JUnit tests. -->
913
      <junit printsummary="yes" haltonfailure="no" fork="yes"
914
             haltonerror="no">
915
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
916
        <classpath>
917
          <path refid="compile.classpath"/>
918
          <fileset dir="${build.dir}">
919
            <include name="${name}.jar"/>
920
            <include name="${name}-client.jar"/>
921
            <include name="harvester.jar"/>
922
            <include name="${name}-junittests.jar"/>
923
          </fileset>
924
        </classpath>
925

    
926
        <formatter type="plain" />
927

    
928
        <batchtest fork="yes" todir="${build.dir}">
929
          <fileset dir="${build.tests}">
930
            <include name="**/*.class"/>
931
                  <exclude name="**/MCTestCase.class" />
932
                  <exclude name="**/ClientViewHelperTest.class" />
933
          </fileset>
934
        </batchtest>
935
     </junit>
936
   </target>
937

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

    
941
              <echo>testtorun: ${testtorun}</echo>
942

    
943
      <!-- use the ant "junit" task to run JUnit tests. -->
944
      <junit printsummary="yes" haltonfailure="no" fork="yes"
945
             haltonerror="no" showoutput="yes">
946
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
947
        <classpath>
948
          <path refid="compile.classpath"/>
949
          <fileset dir="${build.dir}">
950
            <include name="${name}.jar"/>
951
            <include name="${name}-client.jar"/>
952
            <include name="harvester.jar"/>
953
            <include name="${name}-junittests.jar"/>
954
          </fileset>
955
        </classpath>
956

    
957
        <formatter type="plain" />
958

    
959
        <batchtest fork="yes" todir="${build.dir}">
960
          <fileset dir="${build.tests}">
961
            <include name="**/${testtorun}.class" />
962
          </fileset>
963
        </batchtest>
964
     </junit>
965
   </target>
966

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

    
992
  <target name="gethttpclient" depends="prepare"
993
            description="checks out and compiles morpho httpclient code">
994
  <!--mkdir dir="${morphosourcedir}" -->
995
        <cvs cvsRoot="${cvsroot}"
996
             package="morpho"
997
             dest="." />
998
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
999
   </target>
1000

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

    
1005
      <echo>***********************************
1006
      Please run ant gethttpclient first!
1007
      ***********************************
1008
      </echo>
1009
      <!-- copy and compile the tests into a jar file -->
1010
      <mkdir dir="${build.metacatnettest}"/>
1011
      <javac srcdir="${junitnettestsdir}"
1012
             destdir="${build.metacatnettest}"
1013
             includes="**/*.java">
1014
        <classpath>
1015
          <path refid="compile.classpath"/>
1016
          <fileset dir="${build.dir}">
1017
            <include name="${name}.jar"/>
1018
          </fileset>
1019
        </classpath>
1020
      </javac>
1021

    
1022
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1023
                    basedir="${build.metacatnettest}"
1024
                    includes="**/*.class" />
1025

    
1026
      <!-- use the ant "junit" task to run JUnit tests. -->
1027
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1028
             haltonerror="no">
1029
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1030
        <classpath>
1031
          <path refid="compile.classpath"/>
1032
          <fileset dir="${build.dir}">
1033
            <include name="${name}.jar"/>
1034
            <include name="${name}-junitnettests.jar"/>
1035
          </fileset>
1036
        </classpath>
1037

    
1038
        <formatter type="plain" />
1039

    
1040
        <batchtest fork="yes" todir="${build.dir}">
1041
          <fileset dir="${build.metacatnettest}">
1042
            <include name="**/*.class" />
1043
          </fileset>
1044
        </batchtest>
1045
     </junit>
1046
   </target>
1047

    
1048
   <target name="cleanweb" depends="clean"
1049
            description="deletes tomcat web context dir and all its contents">
1050
     <delete dir="${installdir}" />
1051
   </target>
1052

    
1053

    
1054
   <target name="clean" depends="init"
1055
            description="deletes build dir and files that can be regenerated form the release">
1056
       <delete dir="${build.dir}" />
1057
       <delete dir="${dist.dir}" />
1058
   </target>
1059

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

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

    
1101
   <target name="dist"
1102
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1103
            description="prepares a full release distribution">
1104
      <mkdir dir="${dist.dir}"/>
1105
      <delete dir="${ver.dir}" />
1106
      <mkdir dir="${ver.dir}"/>
1107
      <copy todir="${ver.dir}">
1108
        <fileset dir="."
1109
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1110
      </copy>
1111
      <copy todir="${ver.dir}" file="build.xml"/>
1112
      <copy todir="${ver.dir}" file="build.properties"/>
1113

    
1114
      <copy todir="${ver.dir}/docs" filtering="yes">
1115
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1116
      </copy>
1117
      <copy todir="${ver.dir}/docs" filtering="no">
1118
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1119
      </copy>
1120
      <copy todir="${ver.dir}/docs/dev">
1121
        <fileset dir="${build.dir}/docs"/>
1122
      </copy>
1123
      <copy todir="${ver.dir}/src">
1124
        <fileset dir="${build.dir}/src"/>
1125
      </copy>
1126
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1127
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/ -->
1128
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/ -->
1129
      <!--
1130
      <delete dir="./${ver.dir}/${build.dir}"/>
1131
      <delete dir="./${ver.dir}/dist"/>
1132
      -->
1133
      <delete file="./${name}-${release}.zip"/>
1134
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1135
      <delete file="./${name}-${release}.tar.gz" />
1136
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1137
      <gzip zipfile="./${name}-${release}.tar.gz"
1138
                src="./${name}-${release}.tar"/>
1139
      <delete file="./${name}-${release}.tar" />
1140
  </target>
1141

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

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

    
1177
      <delete file="./${name}-src-${release}.zip"/>
1178
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1179
      <delete file="./${name}-src-${release}.tar.gz" />
1180
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1181
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1182
                src="./${name}-src-${release}.tar"/>
1183
      <delete file="./${name}-src-${release}.tar" />
1184
      <delete dir="${dist.dir}"/> 
1185
  </target>
1186

    
1187
   <target name="stylesheettest">
1188
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1189
      <param name="displaymodule" expression="${displaymodule}"/>
1190
      <param name="docid" expression="${input}"/>
1191
      <param name="entitytype" expression="${entitytype}"/>
1192
      <param name="entityindex" expression="${entityindex}"/>
1193
      <outputproperty name="method" value="html"/>
1194
      <outputproperty name="standalone" value="yes"/>
1195
      <outputproperty name="encoding" value="iso8859_1"/>
1196
      <outputproperty name="indent" value="yes"/>
1197
    </xslt>
1198
  </target>
1199

    
1200
 
1201
  <target name="compilewebclient" depends="prepare">
1202
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1203
  </target>
1204

    
1205
  <target name="runwebclient" depends="compilewebclient">
1206
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1207
           dir="${build.dest}" fork="yes"
1208
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1209
         <arg value="${serviceUrl}"/>
1210
         <arg value="${docid}"/>
1211
     </java>
1212
  </target>
1213
  
1214
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1215

    
1216
    <echo message="Compiling the metatcat shapefile creator"/>
1217
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1218
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1219
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1220
    </exec>
1221
  
1222
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1223
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1224
    </exec>
1225
  </target>
1226

    
1227
    <!-- LSID Authority support -->
1228
    <patternset id="lsid.jars">
1229
        <include name="axis.jar" />
1230
        <include name="commons-discovery-0.2.jar" />
1231
        <include name="jaxrpc.jar" />
1232
        <include name="lsid-client-1.1.1.jar" />
1233
        <include name="lsid-server-1.1.1.jar" />
1234
        <include name="saaj.jar" />
1235
        <include name="wsdl4j-1.5.1.jar" />
1236
        <include name="activation.jar" />
1237
        <include name="castor-0.9.5.jar" />
1238
        <include name="dnsjava-1.3.2.jar" />
1239
        <include name="mail.jar" />
1240
        <include name="commons-logging-1.0.4.jar" />
1241
        <!-- These jars may be needed but seem to not actually be,
1242
             so leaving them out for now
1243
        <include name="axis-ant.jar" />
1244
        -->
1245
        <!--<include name="GenCastor.class" />-->
1246
    </patternset>
1247
    <patternset id="lib.jars">
1248
        <include name="httpclient.jar" />
1249
        <include name="log4j-1.2.12.jar" />
1250
        <include name="utilities.jar" />
1251
        <include name="xercesImpl.jar" />
1252
        <include name="xalan.jar" />
1253
        <include name="xml-apis.jar" />
1254
    </patternset>
1255

    
1256
    <path id="lsid.classpath">
1257
        <fileset dir="${lsid.lib.dir}">
1258
            <patternset refid="lsid.jars"/>
1259
        </fileset>
1260
        <fileset dir="${lib.dir}">
1261
            <patternset refid="lsid.jars"/>
1262
        </fileset>
1263
        <fileset dir="${lib.dir}">
1264
            <include name="xalan.jar" />
1265
            <include name="xml-apis.jar" />
1266
        </fileset>
1267
        <fileset dir="${build.dir}">
1268
            <include name="metacat-client.jar" />
1269
        </fileset>
1270
    </path>
1271

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