Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *   '$RCSfile$'
4
  *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
  *   Copyright: 2000 Regents of the University of California and the
6
  *              National Center for Ecological Analysis and Synthesis
7
  * For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *    '$Author: daigle $'
10
  *    '$Date: 2009-01-20 10:05:26 -0800 (Tue, 20 Jan 2009) $'
11
  *    '$Revision: 4765 $'
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

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

    
153
      <filter token="eml-version"          value="${eml-version}"/>
154
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
155
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
156
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
157
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
158
      <!-- MCD BYE filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" / -->
159
      <!-- MCD BYE filter filter token="debuglevel"           value="${debuglevel}" / -->
160
      <!-- MCD BYE filter token="defaultcontenttype"   value="${defaultcontenttype}" / -->
161
      <filter token="debugprefix"          value="${debugprefix}"/>
162
      <filter token="indexPaths"           value="${indexPaths}"/>
163

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

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

    
255
   </target>
256

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

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

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

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

    
291
   <target name="jar" depends="compile,geteml"
292
    description="Compiles and jars metacat java code to metacat.jar in build dir ">
293

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
492
   <target  name="copyxsl"
493
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
494

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

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

    
503

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

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

    
524
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
525
           description="Installs spatial option for metacat">
526

    
527
      <property name="spatial.dir" value="./lib/spatial"/>
528
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
529
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
530

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

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

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

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

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

    
567
    </target>
568

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

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

    
624
   <!-- target name="install-registry" depends="init,getConversionXSL"
625
            description="Install Registry">
626

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

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

    
643
      <echo message="Install Registry completed." />
644
   </target -->
645

    
646
   <!-- target name="install-ldap" depends="init"
647
            description="Install Metacat LDAP Access">
648

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

    
662

    
663
   <target name="install-skin" depends="init"
664
            description="Install a Skin">
665

    
666
      <input message="Please enter name of the skin"
667
             addproperty="skin-name"/>
668

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

    
711
      <echo message="Install Skin completed." />
712
   </target>
713

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

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

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

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

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

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

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

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

    
915
   <target name="test" depends="testprep"
916
            description="Uses the ant junit task to run all JUnit tests">
917

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

    
932
        <formatter type="plain" />
933

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

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

    
947
              <echo>testtorun: ${testtorun}</echo>
948

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

    
963
        <formatter type="plain" />
964

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

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

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

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

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

    
1028
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1029
                    basedir="${build.metacatnettest}"
1030
                    includes="**/*.class" />
1031

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

    
1044
        <formatter type="plain" />
1045

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

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

    
1059

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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