Project

General

Profile

metacat / build.xml @ 4812

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

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

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

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

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

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

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

    
130
      <filter token="scope"                value="${scope}"/>
131
      <filter token="responseForm"         value="${responseForm}"/>
132
      <filter token="entryForm"            value="${entryForm}"/>
133
      <filter token="guide"                value="${guide}"/>
134
      <filter token="loginForm"            value="${loginForm}"/>
135
      <filter token="confirmData"          value="${confirmData}"/>
136
      <filter token="deleteData"           value="${deleteData}"/>
137
      <filter token="genericHeader"        value="${genericHeader}"/>
138
      <filter token="genericFooter"        value="${genericFooter}"/>
139
      <filter token="adminname"            value="${adminname}"/>
140
      <filter token="recipient"            value="${recipient}"/>
141
             <filter token="metacatVersion"       value="${metacat.version}"/>
142
           <filter token="metacatRC"            value="${metacat.releaseCandidate}"/>
143
           <filter token="build.context"        value="${metacat.context}"/>
144

    
145
      <filter token="docrooturl"           value="./" />
146
      <filter token="mcuser"               value="${mcuser}"/>
147
      <filter token="mcpassword"           value="${mcpassword}"/>
148
      <filter token="mcanotheruser"        value="${mcanotheruser}"/>
149
      <filter token="mcanotherpassword"    value="${mcanotherpassword}"/>
150
      <filter token="eml-css"              value="${eml-css}"/>
151
      <filter token="style-skins-relpath"  value="${style-skins-relpath}"/>
152
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
153

    
154
      <filter token="eml-version"          value="${eml-version}"/>
155
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
156
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
157
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
158
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
159
      <filter token="debugprefix"          value="${debugprefix}"/>
160

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

    
221
      <property name="package.home"        value="edu/ucsb/nceas/metacat" />
222
      <condition property="utilities.required">
223
        <or>
224
          <not><available file="lib/httpclient.jar"/></not>
225
          <not><available file="lib/utilities.jar"/></not>
226
          <not><available file="${utilitiesdir}" type="dir"/></not>
227
        </or>
228
      </condition>
229
             <!-- peer.utilities.required is used when there is no utilities 
230
                  directory at ${utilitiesdir} -->
231
      <condition property="peer.utilities.required">
232
        <or>
233
          <not><available file="${utilitiesdir}" type="dir"/></not>
234
        </or>
235
      </condition>
236
      <condition property="eml.required">
237
        <or>
238
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
239
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
240
          <not><available file="lib/schema/eml-2.1.0/eml.xsd"/></not>
241
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
242
        </or>
243
      </condition>
244
             
245
      <condition property="ecogrid.required">
246
                 <or>
247
             <not><available file="${ecogrid-dir}/build.properties"/></not>
248
             <not><available file="${ecogrid-dir}/buildfiles/metacatImpl.xml"/></not>
249
           </or>
250
      </condition>
251

    
252
   </target>
253

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

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

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

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

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

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

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

    
303
   <target name="utilities" depends="config,getpeerutilities" if="utilities.required">
304
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
305
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
306
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
307
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
308
   </target>
309
        
310
   <target name="getpeerutilities" depends="prepare" if="peer.utilities.required"
311
        description="Checks utilities out of cvs and copies it to your utilitiesdir if it does not already exist">
312
     <echo>Enter CVS password: </echo>
313
     <cvs cvsRoot="${cvsroot}"
314
         package="${util-module}"
315
              tag="${utilities-tag}"
316
         dest="${utilitiesdir}/.." />
317
   </target>
318

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

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

    
339
   <target name="clientjar" depends="client"
340
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
341
       <delete file="${build.dir}/${name}-client.jar" />
342
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
343
            includes="**/metacat/client/" />
344
   </target>
345

    
346
    <target name="advancedsearchjar" depends="compile"
347
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
348
        <delete file="${build.dir}/advancedsearch.jar" />
349
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
350
             includes="**/metacat/advancedsearch/" />
351
    </target>
352

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

    
364
   <target name="harvesterjar" depends="harvester"
365
           description="Compiles and jars harvester java code to harvester.jar in build dir">
366
       <delete file="${build.dir}/harvester.jar" />
367
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
368
            includes="**/metacat/harvesterClient/" />
369
   </target>
370

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

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

    
408
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
409
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
410
       <include name="**/*.xsl"/>
411
     </fileset>
412
     </copy>
413
   </target>
414

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

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

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

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

    
489
   <target  name="copyxsl"
490
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
491

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

    
494
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
495
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
496
       <include name="**/*.xsl"/>
497
     </fileset>
498
     </copy>
499

    
500

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

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

    
521
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
522
           description="Installs spatial option for metacat">
523

    
524
      <property name="spatial.dir" value="./lib/spatial"/>
525
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
526
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
527

    
528
      <!-- Copy geoserver libs into ${war.lib} -->
529
      <copy todir="${war.lib}" filtering="no">
530
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
531
          <include name="**"/>
532
        </fileset>
533
      </copy>
534

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

    
543
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
544
      <copy todir="${war.context}" filtering="no">
545
        <fileset dir="${spatial.geoserver.dir}">
546
          <exclude name="WEB-INF/**"/>
547
          <exclude name="index.jsp"/>
548
        </fileset>
549
      </copy>
550

    
551
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
552
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
553
          tofile="${war.context}/geoserver.jsp"
554
          overwrite="true"
555
          filtering="no"/>
556

    
557
      <!-- Copy the rest of the modified geoserver web-inf files
558
      <copy todir="${war.webinf}" filtering="no">
559
        <fileset dir="${spatial.webinf-mods}">
560
          <exclude name="web.xml.combined"/>
561
        </fileset>
562
      </copy> -->
563

    
564
    </target>
565

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

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

    
621
   <!-- target name="install-registry" depends="init,getConversionXSL"
622
            description="Install Registry">
623

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

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

640
      <echo message="Install Registry completed." />
641
   </target -->
642

    
643
   <!-- target name="install-ldap" depends="init"
644
            description="Install Metacat LDAP Access">
645

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

    
659

    
660
   <target name="install-skin" depends="init"
661
            description="Install a Skin">
662

    
663
      <input message="Please enter name of the skin"
664
             addproperty="skin-name"/>
665

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

    
708
      <echo message="Install Skin completed." />
709
   </target>
710

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

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

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

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

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

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

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

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

    
912
   <target name="test" depends="testprep"
913
            description="Uses the ant junit task to run all JUnit tests">
914

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

    
929
        <formatter type="plain" />
930

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

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

    
944
              <echo>testtorun: ${testtorun}</echo>
945

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

    
960
        <formatter type="plain" />
961

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

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

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

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

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

    
1025
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1026
                    basedir="${build.metacatnettest}"
1027
                    includes="**/*.class" />
1028

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

    
1041
        <formatter type="plain" />
1042

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

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

    
1056

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

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

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

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

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

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

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

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

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

    
1228
 
1229
  <target name="compilewebclient" depends="prepare">
1230
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1231
  </target>
1232

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

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

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

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

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