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: leinfelder $'
10
  *    '$Date: 2009-06-29 14:10:49 -0700 (Mon, 29 Jun 2009) $'
11
  *    '$Revision: 4962 $'
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
	
39
  <!-- Determine if ecogrid should be installed-->
40
  <condition property="enable.ecogrid">
41
    <equals arg1="${install.ecogrid}" arg2="true" />
42
  </condition>
43
  
44
  <!-- Determine if perl should be built-->
45
  <condition property="build.perl">
46
    <equals arg1="${make.perl.code}" arg2="true" />
47
  </condition>
48

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

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

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

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

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

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

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

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

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

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

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

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

    
280
   </target>
281

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

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

    
303
	<taskdef resource="axis-tasks.properties" classpathref="compile.classpath"/>
304
	
305
	<target name="generateStubs" depends="prepare">
306
		<echo message=" Generating stubs for execution service from ${wsdl.url.kepler}" />
307
		<axis-wsdl2java verbose="true" output="${srcdir}" 
308
			url="${wsdl.url.kepler}"  />
309
	</target>
310
	
311
   <target name="compile" depends="prepare,utilities"
312
    description="Compiles java code to build dir, and copies metacat props files there">
313

    
314
       <javac srcdir="${build.src}"
315
              destdir="${build.dest}"
316
              debug="${debug}"
317
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
318
        <classpath>
319
          <path refid="compile.classpath"/>
320
        </classpath>
321
      </javac>
322
   </target>
323

    
324
   <target name="jar" depends="compile,geteml"
325
    description="Compiles and jars metacat java code to metacat.jar in build dir ">
326

    
327
       <delete file="${build.dir}/${name}.jar" />
328
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
329
            excludes="**/protocols/ **/harvesterClient/" />
330
   </target>
331

    
332
   <target name="protocol" depends="compile"
333
    description="Compiles and jars protocol java code to protocol.jar in build dir">
334
       <delete file="${build.dir}/protocol.jar" />
335
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
336
            includes="**/protocols/" />
337
   </target>
338

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

    
356
     <!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
357
   </target>
358

    
359
   <target name="getutilities" depends="prepare"
360
   description="Checks utility out of svn and copies it to your metacat cvs sandbox">
361
     <echo>Enter CVS password: </echo>
362
     <cvs cvsRoot="${cvsroot}"
363
          package="${util-module}"
364
     	  tag="${utilities-tag}"
365
          dest="${build.tmp}" />
366
   </target>
367

    
368
   <target name="client" depends="utilities, prepare"
369
    description="Compiles metacat-client java code to build dir">
370
       <javac srcdir="${build.src}"
371
              destdir="${build.dest}"
372
              includes="edu/ucsb/nceas/metacat/client/*">
373
          <classpath>
374
            <path refid="compile.classpath"/>
375
          </classpath>
376
        </javac>
377
   </target>
378

    
379
   <target name="clientjar" depends="client"
380
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
381
       <delete file="${build.dir}/${name}-client.jar" />
382
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
383
            includes="**/metacat/client/" />
384
   </target>
385

    
386
    <target name="advancedsearchjar" depends="compile"
387
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
388
        <delete file="${build.dir}/advancedsearch.jar" />
389
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
390
             includes="**/metacat/advancedsearch/" />
391
    </target>
392

    
393
   <target name="harvester" depends="client"
394
           description="Compiles harvester java code to build dir">
395
       <javac srcdir="${build.src}"
396
              destdir="${build.dest}"
397
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
398
          <classpath>
399
            <path refid="compile.classpath"/>
400
          </classpath>
401
        </javac>
402
   </target>
403

    
404
   <target name="harvesterjar" depends="harvester"
405
           description="Compiles and jars harvester java code to harvester.jar in build dir">
406
       <delete file="${build.dir}/harvester.jar" />
407
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
408
            includes="**/metacat/harvesterClient/" />
409
   </target>
410

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

    
433
   <target name="getemlpre2" depends="prepare" if="eml.required"
434
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
435
     <echo>Enter CVS password: </echo>
436
     <cvs cvsRoot="${cvsroot}"
437
          package="${eml-module}"
438
          tag="${eml-beta-tag}"
439
          dest="${build.tmp}/eml_${eml-beta-tag}" />
440
     <mkdir dir="lib/dtd" />
441
     <copy todir="lib/dtd" filtering="yes">
442
       <fileset dir="${build.tmp}/eml_${eml-beta-tag}/${eml-module}">
443
         <include name="*.dtd"/>
444
       </fileset>
445
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
446
     </copy>
447

    
448
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
449
       <fileset dir="${build.tmp}/eml_${eml-beta-tag}/${eml-module}/style">
450
       <include name="**/*.xsl"/>
451
     </fileset>
452
     </copy>
453
   </target>
454

    
455
   <target name="geteml2+" depends="prepare" if="eml.required"
456
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
457
     <echo>Enter CVS password: </echo>
458
     <cvs cvsRoot="${cvsroot}"
459
          package="${eml-module}"
460
          tag="${eml2_0_0-schema-tag}"
461
          dest="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
462
     <mkdir dir="lib/schema/eml-2.0.0" />
463
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
464
       <fileset dir="${build.tmp}/eml_${eml2_0_0-schema-tag}/${eml-module}">
465
         <include name="*.xsd"/>
466
       </fileset>
467

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

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

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

    
530
   <target  name="copyxsl"
531
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
532

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

    
535
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
536
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
537
       <include name="**/*.xsl"/>
538
     </fileset>
539
     </copy>
540

    
541

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

    
547
   </target>
548
	
549
   <target name="correctEML201Docs" depends="jar"
550
		            description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
551
	   	<copy todir="${build.dir}" file="lib/metacat.properties" filtering="yes"/>    
552
	   	 <java classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector" >
553
		         <classpath>
554
		          <path refid="compile.classpath"/>
555
		          <fileset dir="${build.dir}">
556
		            <include name="${name}.jar"/>
557
		          </fileset>
558
		        </classpath>
559
		      </java>
560
   </target>
561

    
562
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
563
           description="Installs spatial option for metacat">
564

    
565
      <property name="spatial.dir" value="./lib/spatial"/>
566
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
567
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
568

    
569
      <!-- Copy geoserver libs into ${war.lib} -->
570
      <copy todir="${war.lib}" filtering="no">
571
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
572
          <include name="**"/>
573
        </fileset>
574
      </copy>
575

    
576
      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
577
      <copy todir="${war.webinf}" filtering="no">
578
        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
579
          <exclude name="lib/**"/>
580
          <exclude name="web.xml"/>
581
        </fileset>
582
      </copy>
583

    
584
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
585
      <copy todir="${war.context}" filtering="no">
586
        <fileset dir="${spatial.geoserver.dir}">
587
          <exclude name="WEB-INF/**"/>
588
          <exclude name="index.jsp"/>
589
        </fileset>
590
      </copy>
591

    
592
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
593
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
594
          tofile="${war.context}/geoserver.jsp"
595
          overwrite="true"
596
          filtering="no"/>
597

    
598
      <!-- Copy the rest of the modified geoserver web-inf files
599
      <copy todir="${war.webinf}" filtering="no">
600
        <fileset dir="${spatial.webinf-mods}">
601
          <exclude name="web.xml.combined"/>
602
        </fileset>
603
      </copy> -->
604

    
605
    </target>
606

    
607
   <target name="install" depends="build-metacat" description="* Full Install For Development *">
608
     <copy file="${dist.dir}/${metacat.context}.war" todir="${app.deploy.dir}"/>
609
   	 <delete dir="${app.deploy.dir}/${metacat.context}" />
610
   	   <tstamp>
611
   	   	 <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa"/>
612
   	   </tstamp>
613
   	 <echo>Dev install completed at ${NOW}</echo> 	   	
614
   </target>
615

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

    
662
   <!-- target name="install-registry" depends="init,getConversionXSL"
663
            description="Install Registry">
664

    
665
      <mkdir dir="${inst.cgi.dir}" />
666
      <copy file="${srcdir}/perl/register-dataset.cgi"
667
            todir="${inst.cgi.dir}"/>
668
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
669

    
670
      <! - - TODO SCW: set the permissions on this folder to be writable by the apache user - - >
671
      <mkdir dir="${temp-dir}" />
672
      <! - - TODO SCW: use relative paths to grab these instead of copying to tmp,
673
                     used in readDocumentFromMetacat - - >
674
      <copy todir="${temp-dir}" filtering="yes">
675
       <fileset dir="lib/style/common/emlb6toeml2">
676
         <include name="*.xsl"/>
677
         <include name="*.xml"/>
678
       </fileset>
679
      </copy>
680

    
681
      <echo message="Install Registry completed." />
682
   </target -->
683

    
684
   <!-- target name="install-ldap" depends="init"
685
            description="Install Metacat LDAP Access">
686

    
687
      <mkdir dir="${inst.cgi.dir}" />
688
      <copy file="${srcdir}/perl/ldapweb.cgi"
689
            todir="${inst.cgi.dir}" />
690
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
691
      <mkdir dir="${templates.dir}" />
692
      <copy todir="${templates.dir}">
693
        <fileset dir="lib/style/common/templates">
694
			< ! - - SCW: Copy all files - - >
695
        </fileset>
696
      </copy>
697
      <echo message="ldapweb install complete." />
698
   </target -->
699

    
700

    
701
   <target name="install-skin" depends="init"
702
            description="Install a Skin">
703

    
704
      <input message="Please enter name of the skin"
705
             addproperty="skin-name"/>
706

    
707
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
708
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
709
       <fileset dir="lib/style/skins/${skin-name}">
710
           <exclude name="**/*.png"/>
711
           <exclude name="**/*.gif"/>
712
           <exclude name="**/*.jpg"/>
713
           <exclude name="**/CVS*"/>
714
           <exclude name="**/.#*"/>
715
       </fileset>
716
      </copy>
717
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
718
       <fileset dir="lib/style/skins/${skin-name}">
719
           <include name="**/*.png"/>
720
           <include name="**/*.gif"/>
721
           <include name="**/*.jpg"/>
722
           <exclude name="**/CVS*"/>
723
           <exclude name="**/.#*"/>
724
       </fileset>
725
      </copy>
726
      <copy todir="${installdir}/style/common" filtering="yes">
727
       <fileset dir="lib/style/common">
728
           <include name="*.js"/>
729
           <include name="*.jsp"/>
730
           <include name="*.css"/>
731
           <exclude name="*.png"/>
732
           <exclude name="*.gif"/>
733
           <exclude name="*.jpg"/>
734
           <exclude name="**/CVS*"/>
735
           <exclude name="**/.#*"/>
736
       </fileset>
737
      </copy>
738
      <!--
739
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
740
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
741
       <fileset dir="lib/style/skins/${skin-name}/images">
742
           <include name="*.png"/>
743
           <include name="*.gif"/>
744
           <include name="*.jpg"/>
745
       </fileset>
746
      </copy>
747
      -->
748

    
749
      <echo message="Install Skin completed." />
750
   </target>
751

    
752
   <target name="war" depends="warPrepare,install-spatial"
753
            description="Create a web archive (WAR) for servlet deployment">
754
       <mkdir dir="${dist.dir}" />
755
       <war destfile="${dist.dir}/${metacat.context}.war"
756
            webxml="${build.war}/web.xml">
757
         <fileset dir="${war.context}"/>
758
         <lib dir="${war.lib}"/>
759
         <webinf dir="${war.webinf}"/>
760
       </war>
761
   </target>
762
	
763
   <target name="warPrepare" depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
764
            description="Prepare files for creating a web archive (WAR)">
765

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

    
920
   <target name="getConversionXSL" depends="prepare"
921
            unless="styles.not.needed"
922
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
923

    
924
     <echo>Enter CVS password: </echo>
925
     <cvs cvsRoot="${cvsroot}"
926
          package="${eml-module}"
927
          tag="${eml2-style-tag}"
928
          dest="${build.tmp}/eml_${eml2-style-tag}" />
929

    
930
     <mkdir dir="lib/style/common/emlb6toeml2" />
931
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
932
       <fileset dir="${build.tmp}/eml_${eml2-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
933
         <include name="*.xsl"/>
934
         <include name="*.xml"/>
935
       </fileset>
936
      </copy>
937
   </target>
938

    
939
   <target name="testprep" depends="jar,clientjar,harvesterjar">
940
      <mkdir dir="${build.tests}"/>
941
      <copy todir="${build.tests}" filtering="yes">
942
        <fileset dir="${testdir}">
943
          <include name="edu/**"/>
944
        </fileset>
945
      </copy>
946
   	  <copy todir="${build.tests}" file="${testdir}/test.properties" filtering="yes"/>
947

    
948
      <!-- copy and compile the tests into a jar file -->
949
      <javac srcdir="${build.tests}"
950
             destdir="${build.tests}"
951
             debug="on"
952
             includes="**/*.java">
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
          </fileset>
960
        </classpath>
961
      </javac>
962

    
963
      <jar jarfile="${build.dir}/${name}-junittests.jar"
964
        basedir="${build.tests}"
965
                includes="**/*.class" />
966
   </target>
967

    
968
   <target name="test" depends="testprep"
969
            description="Uses the ant junit task to run all JUnit tests">
970

    
971
      <!-- use the ant "junit" task to run JUnit tests. -->
972
      <junit printsummary="yes" haltonfailure="no" fork="yes"
973
             haltonerror="no">
974
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
975
        <classpath>
976
          <path refid="compile.classpath"/>
977
          <fileset dir="${build.dir}">
978
            <include name="${name}.jar"/>
979
            <include name="${name}-client.jar"/>
980
            <include name="harvester.jar"/>
981
            <include name="${name}-junittests.jar"/>
982
          </fileset>
983
        </classpath>
984

    
985
        <formatter type="plain" />
986

    
987
        <batchtest fork="yes" todir="${build.dir}">
988
          <fileset dir="${build.tests}">
989
            <include name="**/*.class"/>
990
          	<exclude name="**/MCTestCase.class" />
991
          	<exclude name="**/ClientViewHelperTest.class" />
992
          </fileset>
993
        </batchtest>
994
     </junit>
995
   </target>
996

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

    
1000
              <echo>testtorun: ${testtorun}</echo>
1001

    
1002
      <!-- use the ant "junit" task to run JUnit tests. -->
1003
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1004
             haltonerror="no" showoutput="yes">
1005
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1006
        <classpath>
1007
          <path refid="compile.classpath"/>
1008
          <fileset dir="${build.dir}">
1009
            <include name="${name}.jar"/>
1010
            <include name="${name}-client.jar"/>
1011
            <include name="harvester.jar"/>
1012
            <include name="${name}-junittests.jar"/>
1013
          </fileset>
1014
        </classpath>
1015

    
1016
        <formatter type="plain" />
1017

    
1018
        <batchtest fork="yes" todir="${build.dir}">
1019
          <fileset dir="${build.tests}">
1020
            <include name="**/${testtorun}.class" />
1021
          </fileset>
1022
        </batchtest>
1023
     </junit>
1024
   </target>
1025

    
1026
   <target name="testharvester"
1027
           depends="testprep"
1028
           description="Uses the ant junit task to test only the Harvester code">
1029
     <junit printsummary="yes"
1030
            haltonfailure="off"
1031
            fork="yes"
1032
            haltonerror="off">
1033
        <classpath>
1034
          <path refid="compile.classpath"/>
1035
          <fileset dir="${build.dir}">
1036
            <include name="${name}.jar"/>
1037
            <include name="${name}-client.jar"/>
1038
            <include name="harvester.jar"/>
1039
            <include name="${name}-junittests.jar"/>
1040
          </fileset>
1041
        </classpath>
1042
       <formatter type="plain" />
1043
       <batchtest fork="yes" todir="${build.dir}">
1044
         <fileset dir="${build.tests}">
1045
           <include name="**/harvesterClient/*.class" />
1046
         </fileset>
1047
       </batchtest>
1048
     </junit>
1049
   </target>
1050

    
1051
  <target name="gethttpclient" depends="prepare"
1052
            description="checks out and compiles morpho httpclient code">
1053
  <!--mkdir dir="${morphosourcedir}" -->
1054
        <cvs cvsRoot="${cvsroot}"
1055
             package="morpho"
1056
             dest="." />
1057
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
1058
   </target>
1059

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

    
1064
      <echo>***********************************
1065
      Please run ant gethttpclient first!
1066
      ***********************************
1067
      </echo>
1068
      <!-- copy and compile the tests into a jar file -->
1069
      <mkdir dir="${build.metacatnettest}"/>
1070
      <javac srcdir="${junitnettestsdir}"
1071
             destdir="${build.metacatnettest}"
1072
             includes="**/*.java">
1073
        <classpath>
1074
          <path refid="compile.classpath"/>
1075
          <fileset dir="${build.dir}">
1076
            <include name="${name}.jar"/>
1077
          </fileset>
1078
        </classpath>
1079
      </javac>
1080

    
1081
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1082
                    basedir="${build.metacatnettest}"
1083
                    includes="**/*.class" />
1084

    
1085
      <!-- use the ant "junit" task to run JUnit tests. -->
1086
      <junit printsummary="yes" haltonfailure="no" fork="yes"
1087
             haltonerror="no">
1088
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1089
        <classpath>
1090
          <path refid="compile.classpath"/>
1091
          <fileset dir="${build.dir}">
1092
            <include name="${name}.jar"/>
1093
            <include name="${name}-junitnettests.jar"/>
1094
          </fileset>
1095
        </classpath>
1096

    
1097
        <formatter type="plain" />
1098

    
1099
        <batchtest fork="yes" todir="${build.dir}">
1100
          <fileset dir="${build.metacatnettest}">
1101
            <include name="**/*.class" />
1102
          </fileset>
1103
        </batchtest>
1104
     </junit>
1105
   </target>
1106

    
1107
   <target name="cleanweb" depends="clean"
1108
            description="deletes tomcat web context dir and all its contents">
1109
     <delete dir="${installdir}" />
1110
   </target>
1111

    
1112

    
1113
   <target name="clean" depends="init"
1114
            description="deletes build dir and files that can be regenerated form the release">
1115
       <delete dir="${build.dir}" />
1116
       <delete dir="${dist.dir}" />
1117
   </target>
1118

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

    
1143
   <target name="jdoc" depends="prepare"
1144
            description="generates javadoc documentation">
1145
       <javadoc packagenames="edu.ucsb.nceas.*"
1146
           sourcepath="${build.src}"
1147
           destdir="${build.javadocs}"
1148
           author="true"
1149
           version="true"
1150
           use="true"
1151
           windowtitle="${Name} API"
1152
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1153
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1154
         <classpath>
1155
           <path refid="compile.classpath"/>
1156
         </classpath>
1157
       </javadoc>
1158
   </target>
1159

    
1160
   <target name="dist"
1161
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1162
            description="prepares a full release distribution">
1163
      <mkdir dir="${dist.dir}"/>
1164
      <delete dir="${ver.dir}" />
1165
      <mkdir dir="${ver.dir}"/>
1166
      <copy todir="${ver.dir}">
1167
        <fileset dir="."
1168
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip"/>
1169
      </copy>
1170
      <copy todir="${ver.dir}" file="build.xml"/>
1171
      <copy todir="${ver.dir}" file="build.properties"/>
1172

    
1173
      <copy todir="${ver.dir}/docs" filtering="yes">
1174
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1175
      </copy>
1176
      <copy todir="${ver.dir}/docs" filtering="no">
1177
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1178
      </copy>
1179
      <copy todir="${ver.dir}/docs/dev">
1180
        <fileset dir="${build.dir}/docs"/>
1181
      </copy>
1182
      <copy todir="${ver.dir}/src">
1183
        <fileset dir="${build.dir}/src"/>
1184
      </copy>
1185
   	
1186
   	  <mkdir dir="${ver.dir}/tests/servertestfiles"/>
1187
	  <copy todir="${ver.dir}/test/servertestfiles">
1188
	    <fileset dir="./test/servertestfiles"/>
1189
	  </copy>
1190
  </target>
1191

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

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

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

    
1271
   <target name="stylesheettest">
1272
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1273
      <param name="displaymodule" expression="${displaymodule}"/>
1274
      <param name="docid" expression="${input}"/>
1275
      <param name="entitytype" expression="${entitytype}"/>
1276
      <param name="entityindex" expression="${entityindex}"/>
1277
      <outputproperty name="method" value="html"/>
1278
      <outputproperty name="standalone" value="yes"/>
1279
      <outputproperty name="encoding" value="iso8859_1"/>
1280
      <outputproperty name="indent" value="yes"/>
1281
    </xslt>
1282
  </target>
1283

    
1284
 
1285
  <target name="compilewebclient" depends="prepare">
1286
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1287
  </target>
1288

    
1289
  <target name="runwebclient" depends="compilewebclient">
1290
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1291
           dir="${build.dest}" fork="yes"
1292
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1293
         <arg value="${serviceUrl}"/>
1294
         <arg value="${docid}"/>
1295
     </java>
1296
  </target>
1297
  
1298
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1299

    
1300
    <echo message="Compiling the metatcat shapefile creator"/>
1301
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1302
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1303
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1304
    </exec>
1305
  
1306
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1307
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1308
    </exec>
1309
  </target>
1310

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

    
1340
    <path id="lsid.classpath">
1341
        <fileset dir="${lsid.lib.dir}">
1342
            <patternset refid="lsid.jars"/>
1343
        </fileset>
1344
        <fileset dir="${lib.dir}">
1345
            <patternset refid="lsid.jars"/>
1346
        </fileset>
1347
        <fileset dir="${lib.dir}">
1348
            <include name="xalan.jar" />
1349
            <include name="xml-apis.jar" />
1350
        </fileset>
1351
        <fileset dir="${build.dir}">
1352
            <include name="metacat-client.jar" />
1353
        </fileset>
1354
    </path>
1355

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