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: jones $'
10
	*    '$Date: 2010-04-29 00:56:43 -0700 (Thu, 29 Apr 2010) $'
11
	*    '$Revision: 5330 $'
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
         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
34
	<property environment="env" />
35
	<property file="build.properties" /><!-- USER SPECIFIC PROPS -->
36

    
37

    
38
    <!-- Configure the maven2 ant tasks -->
39
    <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
40
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
41
             uri="antlib:org.apache.maven.artifact.ant"
42
             classpathref="maven-ant-tasks.classpath" />
43

    
44
	<!-- Determine if ecogrid should be installed-->
45
	<condition property="enable.ecogrid">
46
		<equals arg1="${install.ecogrid}" arg2="true" />
47
	</condition>
48

    
49
	<!-- Determine if perl should be built-->
50
	<condition property="build.perl">
51
		<equals arg1="${make.perl.code}" arg2="true" />
52
	</condition>
53

    
54
	<!-- Determine if dataone-service should be built-->
55
	<condition property="d1.available">
56
        <and>
57
	        <available file="${d1.dir}"/>
58
	        <available file="${maven.home}"/>
59
        </and>
60
	</condition>
61

    
62
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
63
			property="tomcat.common.exists" />
64

    
65
	<target name="config" depends="setTomcatCommon, setTomcatNoCommon">
66
		<!-- usr for client testing, generally you don't need change-->
67
		<property name="mcuser"
68
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
69
		<property name="mcpassword" value="kepler" />
70
		<property name="mcanotheruser"
71
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
72
		<property name="mcanotherpassword" value="yourpass" />
73
		<property name="piscouser"
74
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
75
		<property name="piscopassword" value="yourpass" />
76
		<property name="lteruser"
77
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
78
		<property name="lterpassword" value="yourpass" />
79

    
80
		<property name="debug" value="on" />
81
		<property name="morphosourcedir" value="../morpho" />
82
		<property name="utilitiesdir" value="../utilities" />
83
		<property name="installdir"
84
			value="${app.deploy.dir}/${metacat.context}" />
85

    
86
		<echo>*********** set jsdk to ${jsdk}</echo>
87
	</target>
88
	
89
	<target name="setTomcatCommon" if="tomcat.common.exists" >
90
		<property name="jsdk"
91
			value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
92
	</target>
93
	
94
	<target name="setTomcatNoCommon" unless="tomcat.common.exists" >
95
		<property name="jsdk"
96
			value="${build.tomcat.dir}/lib/servlet-api.jar" />
97
	</target>
98
	
99
	<target name="init" depends="config">
100
		<path id="compile.classpath">
101
			<pathelement location="${jsdk}" />
102
			<pathelement location="lib" />
103
			<fileset dir="lib">
104
				<include name="*.jar" />
105
			</fileset>
106
			<fileset dir="lib">
107
				<include name="xalan.jar" />
108
			</fileset>
109
			<fileset dir="lib/lsid_lib">
110
				<include name="*.jar" />
111
			</fileset>
112

    
113
			<!-- Include geoserver, geotools, et. al. -->
114
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
115
				<include name="*.jar" />
116
			</fileset>
117
			<pathelement
118
				location="lib/spatial/geoserver/WEB-INF/classes" />
119

    
120
			<!-- Include OAI-PMH -->
121
			<fileset dir="lib/oaipmh">
122
				<include name="*.jar" />
123
			</fileset>
124

    
125
		</path>
126
		
127
		<path id="test.classpath">
128
			<pathelement location="${jsdk}" />
129
			<pathelement location="lib" />
130
			<fileset dir="lib">
131
				<include name="*.jar" />
132
				<exclude name="maven-ant-tasks-2.1.0.jar" />
133
			</fileset>
134
			<fileset dir="lib">
135
				<include name="xalan.jar" />
136
			</fileset>
137
			<fileset dir="lib/lsid_lib">
138
				<include name="*.jar" />
139
			</fileset>
140

    
141
			<!-- Include geoserver, geotools, et. al. -->
142
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
143
				<include name="*.jar" />
144
			</fileset>
145
			<pathelement
146
				location="lib/spatial/geoserver/WEB-INF/classes" />
147

    
148
			<!-- Include OAI-PMH -->
149
			<fileset dir="lib/oaipmh">
150
				<include name="*.jar" />
151
			</fileset>
152

    
153
		</path>
154

    
155
		<!-- It is less likely you'll need to make any changes from here down,
156
			but customization is possible -->
157
		<property name="name" value="metacat" />
158
		<property name="Name" value="MetaCat" />
159
		<property name="debugprefix" value="${Name}:" />
160
		<property name="release" value="${metacat.version}" />
161
		<property name="style-common-relpath" value="/style/common" />
162
		<property name="style-shared-relpath" value="/style/shared" />
163
		<property name="schema-relpath" value="/schema" />
164
		<property name="style-common-cvsrelpath"
165
			value="lib${style-common-relpath}" />
166
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
167
		<property name="style-skins-relpath" value="/style/skins" />
168
		<property name="util-module" value="utilities" />
169
		<!-- property name="utilities-tag" value="/tags/UTILITIES_1_0_1_RC2" / -->
170
		<property name="utilities-tag" value="trunk" />
171
		<property name="eml-module" value="eml" />
172
		<property name="eml-version" value="2.0.0beta6" />
173
		<property name="eml-beta-tag"
174
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
175
		<property name="eml2_0_0-schema-tag"
176
			value="RELEASE_EML_2_0_0_UPDATE_1" />
177
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
178
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
179
		<property name="dataone-0.1-schema-tag" value="D1_SCHEMA_0_1" />
180
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_0_9_0" />
181
		<property name="eml2_0_0namespace"
182
			value="eml://ecoinformatics.org/eml-2.0.0" />
183
		<property name="eml2_0_1namespace"
184
			value="eml://ecoinformatics.org/eml-2.0.1" />
185
		<property name="eml2_1_0namespace"
186
			value="eml://ecoinformatics.org/eml-2.1.0" />
187
		<property name="stmmlnamespace"
188
			value="http://www.xml-cml.org/schema/stmml" />
189
		<property name="eml-css" value="eml_xsl.css" />
190
		<property name="eml-module.default.css" value="default.css" />
191
		<property name="systemidserver" value="" />
192
		<property name="html-path" value="" />
193

    
194

    
195
		<!-- Config for registry variables -->
196
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
197
		<property name="scope" value="obfs" />
198
		<property name="responseForm" value="genericResponse.tmpl" />
199
		<property name="entryForm" value="entryForm.tmpl" />
200
		<property name="guide" value="genericGuide.tmpl" />
201
		<property name="loginForm" value="loginForm.tmpl" />
202
		<property name="confirmData" value="confirmData.tmpl" />
203
		<property name="deleteData" value="deleteData.tmpl" />
204
		<property name="genericHeader" value="genericHeader.tmpl" />
205
		<property name="genericFooter" value="genericFooter.tmpl" />
206

    
207
		<filter token="scope" value="${scope}" />
208
		<filter token="responseForm" value="${responseForm}" />
209
		<filter token="entryForm" value="${entryForm}" />
210
		<filter token="guide" value="${guide}" />
211
		<filter token="loginForm" value="${loginForm}" />
212
		<filter token="confirmData" value="${confirmData}" />
213
		<filter token="deleteData" value="${deleteData}" />
214
		<filter token="genericHeader" value="${genericHeader}" />
215
		<filter token="genericFooter" value="${genericFooter}" />
216
		<filter token="adminname" value="${adminname}" />
217
		<filter token="recipient" value="${recipient}" />
218
		<filter token="metacatVersion" value="${metacat.version}" />
219
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
220
		<filter token="build.context" value="${metacat.context}" />
221

    
222
		<filter token="docrooturl" value="./" />
223
		<filter token="mcuser" value="${mcuser}" />
224
		<filter token="mcpassword" value="${mcpassword}" />
225
		<filter token="mcanotheruser" value="${mcanotheruser}" />
226
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
227
		<filter token="eml-css" value="${eml-css}" />
228
		<filter token="style-skins-relpath"
229
			value="${style-skins-relpath}" />
230
		<filter token="style-common-relpath"
231
			value="${style-common-relpath}" />
232

    
233
		<filter token="eml-version" value="${eml-version}" />
234
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
235
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
236
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
237
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
238
		<filter token="debugprefix" value="${debugprefix}" />
239

    
240
		<filter token="defaultStage" value="${defaultStage}" />
241
		<filter token="defaultHeader" value="${defaultHeader}" />
242
		<filter token="defaultFooter" value="${defaultFooter}" />
243
		<filter token="defaultChangePass" value="${defaultChangePass}" />
244
		<filter token="defaultResetPass" value="${defaultResetPass}" />
245
		<filter token="changePassSuccess" value="${changePassSuccess}" />
246
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
247
		<filter token="registerFailed" value="${registerFailed}" />
248
		<filter token="registerLter" value="${registerLter}" />
249
		<filter token="registerMatch" value="${registerMatch}" />
250
		<filter token="registerSuccess" value="${registerSuccess}" />
251
		<filter token="register" value="${register}" />
252
		<filter token="searchResults" value="${searchResults}" />
253
		<filter token="ldapMainServerFailure"
254
			value="${ldapMainServerFailure}" />
255
		<filter token="lter-user" value="${lteruser}" />
256
		<filter token="lter-pass" value="${lterpassword}" />
257
		<filter token="pisco-user" value="${piscouser}" />
258
		<filter token="pisco-pass" value="${piscopassword}" />
259

    
260

    
261
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
262
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
263
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
264

    
265
		<property name="srcdir" value="./src" />
266
		<property name="lib.dir" value="./lib" />
267
		<property name="docdir" value="./docs" />
268
		<property name="cgidir" value="./cgi-bin" />
269
		<property name="testdir" value="./test" />
270
		<property name="testtorun" value="BuildIndexTest" />
271
		<property name="junittestsdir"
272
			value="./test/edu/ucsb/nceas/metacattest" />
273
		<property name="junitnettestsdir"
274
			value="./test/edu/ucsb/nceas/metacatnettest" />
275
		<property name="build.dir" value="./build" />
276
		<property name="build.src" value="${build.dir}/src" />
277
		<property name="build.dest" value="${build.dir}/classes" />
278
		<property name="build.samples" value="${build.dir}/samples" />
279
		<property name="build.tests" value="${build.dir}/tests" />
280
		<property name="build.tmp" value="${build.dir}/tmp" />
281
		<property name="build.metacattest"
282
			value="${build.tests}/metacattest" />
283
		<property name="build.metacatnettest"
284
			value="${build.tests}/metacatnettest" />
285
		<property name="build.data" value="${build.dir}/data" />
286
		<property name="build.javadocs" value="${build.dir}/docs/api" />
287
		<property name="build.war" value="${build.dir}/war" />
288
		<property name="dist.dir" value="dist" />
289
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
290
		<property name="ver.src" value="${ver.dir}/src" />
291
		<property name="util.dir" value="${dist.dir}/${util-module}" />
292
		<property name="test.dir" value="${dist.dir}/test" />
293
		<!-- directories for creating a Harvest List Editor distribution -->
294
		<property name="dist.dir.hle" value="disthle" />
295
		<property name="ver.dir.hle"
296
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
297
		<property name="pkg.dir" value="./package" />
298
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
299

    
300
		<property name="ecogrid-target-name" value="metacatImpl" />
301
		<property name="ecogrid-module-dest-dir" value=".." />
302
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
303
		<property name="ecogrid-dist-dir"
304
			value="${dist.dir}/${ecogrid-module}" />
305
		<property name="ecogrid-dir"
306
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
307

    
308
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
309

    
310
		<!-- set up svn -->
311
		<property name="svnant.lib" value="lib" />
312
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
313
		<property name="svnClientAdapter.jar"
314
			value="${svnant.lib}/svnClientAdapter.jar" />
315
		<property name="svnjavahl.jar"
316
			value="${svnant.lib}/svnjavahl.jar" />
317
		<property name="svn.utilitiesUrl"
318
			value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
319
		<property name="svn.ecogridUrl"
320
			value="https://code.ecoinformatics.org/code/seek/trunk/projects/ecogrid/" />
321
		<property name="svn.emlBetaUrl"
322
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
323
		<property name="svn.eml200SchemaUrl"
324
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
325
		<property name="svn.eml201SchemaUrl"
326
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
327
		<property name="svn.eml210SchemaUrl"
328
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
329
		<property name="svn.dataone-0.1-schema-url"
330
			value="https://repository.dataone.org/software/cicore/tags/${dataone-0.1-schema-tag}" />
331
		<property name="svn.eml2StyleUrl"
332
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
333

    
334
		<!-- load the svn task -->
335
		<path id="svn.classpath">
336
			<pathelement location="${svnjavahl.jar}" />
337
			<pathelement location="${svnant.jar}" />
338
			<pathelement location="${svnClientAdapter.jar}" />
339
		</path>
340
		<taskdef resource="svntask.properties"
341
			classpathref="svn.classpath" />
342

    
343
		<condition property="utilities.required">
344
			<or>
345
				<not>
346
					<available file="lib/httpclient.jar" />
347
				</not>
348
				<not>
349
					<available file="lib/utilities.jar" />
350
				</not>
351
				<not>
352
					<available file="${utilitiesdir}" type="dir" />
353
				</not>
354
			</or>
355
		</condition>
356
		<!-- peer.utilities.required is used when there is no utilities 
357
			directory at ${utilitiesdir} -->
358
		<condition property="peer.utilities.required">
359
			<or>
360
				<not>
361
					<available file="${utilitiesdir}" type="dir" />
362
				</not>
363
			</or>
364
		</condition>
365
		<condition property="eml.required">
366
			<or>
367
				<not>
368
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
369
				</not>
370
				<not>
371
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
372
				</not>
373
				<not>
374
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
375
				</not>
376
				<not>
377
					<available
378
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
379
				</not>
380
			</or>
381
		</condition>
382

    
383
		<condition property="ecogrid.required">
384
			<or>
385
				<not>
386
					<available file="${ecogrid-dir}/build.properties" />
387
				</not>
388
				<not>
389
					<available
390
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
391
				</not>
392
			</or>
393
		</condition>
394

    
395
	</target>
396

    
397
	<target name="prepare" depends="init">
398
		<mkdir dir="${build.dir}" />
399
		<mkdir dir="${build.src}" />
400
		<mkdir dir="${build.dest}" />
401
		<mkdir dir="${build.javadocs}" />
402
		<mkdir dir="${build.tmp}" />
403

    
404
		<copy todir="${build.src}" filtering="yes">
405
			<fileset dir="${srcdir}">
406
				<include name="edu/**" />
407
				<include name="com/**" />
408
				<include name="org/**" />
409
				<!-- include name="java/**" / -->
410
				<include name="**/*.sql" />
411
				<exclude name="**/CVS*" />
412
				<exclude name="**/.#*" />
413
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
414
			</fileset>
415
		</copy>
416
		<available file="lib/style/common/emlb6toeml2" type="dir"
417
			property="styles.not.needed" />
418
	</target>
419

    
420
	<taskdef resource="axis-tasks.properties"
421
		classpathref="compile.classpath" />
422

    
423
	<target name="generateStubs" depends="prepare">
424
		<echo
425
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
426
		<axis-wsdl2java verbose="true" output="${srcdir}"
427
			url="/tmp/KeplerWebService.wsdl" />
428
	</target>
429

    
430
	<target name="compile" depends="dataone-service,prepare,utilities"
431
		description="Compiles java code to build dir, and copies metacat props files there">
432

    
433
		<javac srcdir="${build.src}" destdir="${build.dest}"
434
			debug="${debug}"
435
			excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
436
			<classpath>
437
				<path refid="compile.classpath" />
438
			</classpath>
439
		</javac>
440
	</target>
441

    
442
	<target name="jar" depends="compile,geteml,getd1schemas"
443
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
444

    
445
		<delete file="${build.dir}/${name}.jar" />
446
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
447
			excludes="**/protocols/ **/harvesterClient/" />
448
	</target>
449

    
450
	<target name="protocol" depends="compile"
451
		description="Compiles and jars protocol java code to protocol.jar in build dir">
452
		<delete file="${build.dir}/protocol.jar" />
453
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
454
			includes="**/protocols/" />
455
	</target>
456

    
457
	<target name="utilities" depends="config,getpeerutilities"
458
		if="utilities.required">
459
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
460
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
461
		<copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
462
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
463
	</target>
464

    
465
	<target name="getpeerutilities" depends="prepare"
466
		if="peer.utilities.required"
467
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
468
		<echo message="Exporting utilities files from svn repository:" />
469
		<svn>
470
			<export srcUrl="${svn.utilitiesUrl}"
471
				destPath="${utilitiesdir}" />
472
		</svn>
473

    
474
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
475
	</target>
476

    
477
	<target name="getutilities" depends="prepare"
478
		description="Checks utility out of svn and copies it to your metacat sandbox">
479
		<svn>
480
			<export srcUrl="${svn.utilitiesUrl}"
481
				destPath="${utilitiesdir}" />
482
		</svn>
483
	</target>
484

    
485
	<target name="client" depends="utilities, prepare"
486
		description="Compiles metacat-client java code to build dir">
487
		<javac srcdir="${build.src}" destdir="${build.dest}"
488
			includes="edu/ucsb/nceas/metacat/client/*">
489
			<classpath>
490
				<path refid="compile.classpath" />
491
			</classpath>
492
		</javac>
493
	</target>
494

    
495
	<target name="clientjar" depends="client"
496
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
497
		<delete file="${build.dir}/${name}-client.jar" />
498
		<jar jarfile="${build.dir}/${name}-client.jar"
499
			basedir="${build.dest}" includes="**/metacat/client/" />
500
	</target>
501

    
502
	<target name="advancedsearchjar" depends="compile"
503
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
504
		<delete file="${build.dir}/advancedsearch.jar" />
505
		<jar jarfile="${build.dir}/advancedsearch.jar"
506
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
507
	</target>
508

    
509
	<target name="harvester" depends="client"
510
		description="Compiles harvester java code to build dir">
511
		<javac srcdir="${build.src}" destdir="${build.dest}"
512
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
513
			<classpath>
514
				<path refid="compile.classpath" />
515
			</classpath>
516
		</javac>
517
	</target>
518

    
519
	<target name="harvesterjar" depends="harvester"
520
		description="Compiles and jars harvester java code to harvester.jar in build dir">
521
		<delete file="${build.dir}/harvester.jar" />
522
		<jar jarfile="${build.dir}/harvester.jar"
523
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
524
	</target>
525

    
526
	<target name="harvestListEditorDist" depends="harvesterjar"
527
		description="Prepares a distribution of the Harvest List Editor tool">
528
		<mkdir dir="${dist.dir.hle}" />
529
		<delete dir="${ver.dir.hle}" />
530
		<mkdir dir="${ver.dir.hle}" />
531
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
532
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
533
		<copy todir="${ver.dir.hle}"
534
			file="lib/harvester/harvestList.xsd" />
535
		<copy todir="${ver.dir.hle}"
536
			file="lib/harvester/harvestListEditor.bat" />
537
		<copy todir="${ver.dir.hle}"
538
			file="lib/harvester/harvestListEditor.sh" />
539
		<delete file="./harvest-list-editor-${release}.zip" />
540
		<zip zipfile="./harvest-list-editor-${release}.zip"
541
			basedir="${ver.dir.hle}" />
542
		<delete file="./harvest-list-editor-${release}.tar.gz" />
543
		<tar tarfile="./harvest-list-editor-${release}.tar"
544
			basedir="${ver.dir.hle}" />
545
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
546
			src="./harvest-list-editor-${release}.tar" />
547
		<delete file="./harvest-list-editor-${release}.tar" />
548
	</target>
549

    
550
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
551
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
552

    
553
	<target name="getemlpre2" depends="prepare" if="eml.required"
554
		description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
555
		<svn>
556
			<export srcUrl="${svn.emlBetaUrl}"
557
				destPath="${build.tmp}/eml_${eml-beta-tag}" />
558
		</svn>
559
		<mkdir dir="lib/dtd" />
560
		<copy todir="lib/dtd" filtering="yes">
561
			<fileset
562
				dir="${build.tmp}/eml_${eml-beta-tag}">
563
				<include name="*.dtd" />
564
			</fileset>
565
			<mapper type="glob" from="eml-*.dtd"
566
				to="eml-*-${eml-version}.dtd" />
567
		</copy>
568

    
569
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
570
			<fileset
571
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
572
				<include name="**/*.xsl" />
573
			</fileset>
574
		</copy>
575
	</target>
576

    
577
	<target name="geteml2+" depends="prepare" if="eml.required"
578
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
579
		<svn>
580
			<export srcUrl="${svn.eml200SchemaUrl}"
581
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
582
		</svn>
583
		<mkdir dir="lib/schema/eml-2.0.0" />
584
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
585
			<fileset
586
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
587
				<include name="*.xsd" />
588
			</fileset>
589

    
590
			<!-- shouldn't we have a mapper here like this??
591
				<mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
592
				
593
				Jing's code didn't nave one - does it need to be added?
594
				NOTE that eml-version is set to beta 6, so this would need changing -->
595

    
596
		</copy>
597
		<!-- <antcall target="copyxsl">
598
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
599
			<param name="dirname" value="eml-2.0.0" />
600
			</antcall> -->
601

    
602
		<!-- Checkout eml201 for given schema tag-->
603
		<svn>
604
			<export srcUrl="${svn.eml201SchemaUrl}"
605
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
606
		</svn>
607
		<mkdir dir="lib/schema/eml-2.0.1" />
608
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
609
			<fileset
610
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
611
				<include name="*.xsd" />
612
			</fileset>
613
		</copy>
614

    
615
		<!-- Checkout eml201 again for given style sheet tag-->
616
		<!-- echo>Enter CVS password: </echo>
617
			<cvs cvsRoot="${cvsroot}"
618
			package="${eml-module}"
619
			tag="${eml2_0_1-style-tag}"
620
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
621
			<antcall target="copyxsl">
622
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
623
			<param name="dirname" value="eml-2.0.1" />
624
			</antcall -->
625

    
626
		<!-- Checkout eml210 for given schema tag-->
627
		<svn>
628
			<export srcUrl="${svn.eml210SchemaUrl}"
629
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
630
		</svn>
631
		<mkdir dir="lib/schema/eml-2.1.0" />
632
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
633
			<fileset
634
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
635
				<include name="*.xsd" />
636
			</fileset>
637
		</copy>
638

    
639
		<!-- Checkout eml210 for given style sheet tag-->
640
		<svn>
641
			<export srcUrl="${svn.eml2StyleUrl}"
642
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
643
		</svn>
644
		<antcall target="copyxsl">
645
			<param name="cvs.tagname" value="${eml2-style-tag}" />
646
			<!-- param name="dirname" value="eml-2.1.0" / -->
647
			<param name="dirname" value="eml-2" />
648
		</antcall>
649
	</target>
650

    
651
	<target name="getd1schemas" depends="prepare" 
652
		description="Checkout dataone schemas from svn and copy to metacat sandbox">
653
		<delete dir="${build.tmp}/${dataone-0.1-schema-tag}"/>
654
        <svn>
655
            <export srcUrl="${svn.dataone-0.1-schema-url}"
656
                destPath="${build.tmp}/${dataone-0.1-schema-tag}" />
657
        </svn>
658
        <mkdir dir="lib/schema/${dataone-0.1-schema-tag}" />
659
        <copy todir="lib/schema/${dataone-0.1-schema-tag}" filtering="yes">
660
            <fileset dir="${build.tmp}/${dataone-0.1-schema-tag}">
661
                <include name="*.xsd" />
662
            </fileset>
663
        </copy>
664
    </target>
665

    
666
	<target name="copyxsl"
667
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
668

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

    
671
		<copy todir="${style-common-cvsrelpath}/${dirname}"
672
			filtering="yes">
673
			<fileset
674
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
675
				<include name="**/*.xsl" />
676
			</fileset>
677
		</copy>
678

    
679

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

    
686
	</target>
687

    
688
	<target name="correctEML201Docs" depends="jar"
689
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
690
		<copy todir="${build.dir}" file="lib/metacat.properties"
691
			filtering="yes" />
692
		<java
693
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
694
			<classpath>
695
				<path refid="compile.classpath" />
696
				<fileset dir="${build.dir}">
697
					<include name="${name}.jar" />
698
				</fileset>
699
			</classpath>
700
		</java>
701
	</target>
702

    
703
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
704
		description="Installs spatial option for metacat">
705

    
706
		<property name="spatial.dir" value="./lib/spatial" />
707
		<property name="spatial.geoserver.dir"
708
			value="${spatial.dir}/geoserver" />
709
		<property name="spatial.webinf-mods"
710
			value="${spatial.dir}/WEB-INF" />
711

    
712
		<!-- Copy geoserver libs into ${war.lib} -->
713
		<copy todir="${war.lib}" filtering="no">
714
			<fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
715
				<include name="**" />
716
			</fileset>
717
		</copy>
718

    
719
		<!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
720
		<copy todir="${war.webinf}" filtering="no">
721
			<fileset dir="${spatial.geoserver.dir}/WEB-INF">
722
				<exclude name="lib/**" />
723
				<exclude name="web.xml" />
724
			</fileset>
725
		</copy>
726

    
727
		<!-- Copy the rest of the geoserver codebase into ${war.context} -->
728
		<copy todir="${war.context}" filtering="no">
729
			<fileset dir="${spatial.geoserver.dir}">
730
				<exclude name="WEB-INF/**" />
731
				<exclude name="index.jsp" />
732
			</fileset>
733
		</copy>
734

    
735
		<!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
736
		<copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
737
			tofile="${war.context}/geoserver.jsp" overwrite="true"
738
			filtering="no" />
739

    
740
		<!-- Copy the rest of the modified geoserver web-inf files
741
			<copy todir="${war.webinf}" filtering="no">
742
			<fileset dir="${spatial.webinf-mods}">
743
			<exclude name="web.xml.combined"/>
744
			</fileset>
745
			</copy> -->
746

    
747
	</target>
748

    
749
	<target name="install" depends="build-metacat"
750
		description="* Full Install For Development *">
751
		<copy file="${dist.dir}/${metacat.context}.war"
752
			todir="${app.deploy.dir}" />
753
		<delete dir="${app.deploy.dir}/${metacat.context}" />
754
		<tstamp>
755
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
756
		</tstamp>
757
		<echo>Dev install completed at ${NOW}</echo>
758
	</target>
759

    
760
	<target name="build-metacat" depends="install-ecogrid"
761
		description="Build Metacat">
762
	</target>
763

    
764
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
765
		if="enable.ecogrid" description="Install Ecogrid Compentent">
766
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
767
			inheritall="false">
768
			<property name="context" value="${metacat.context}" />
769
			<property name="target" value="${ecogrid-target-name}" />
770
			<!-- property name="metacat.dir" value="."/ -->
771
		</ant>
772
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
773
			inheritall="false">
774
			<property name="context" value="${metacat.context}" />
775
			<property name="target" value="${ecogrid-target-name}" />
776
			<!-- property name="metacat.dir" value="."/ -->
777
		</ant>
778
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
779
			<webinf dir="${ecogrid-dir}/lib">
780
			<include name="server-config.wsdd"/>
781
			</webinf>
782
			</war -->
783
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
784
			todir="${dist.dir}" overwrite="true" />
785

    
786

    
787
	</target>
788

    
789
	<target name="get-ecogrid" depends="init"
790
		description="Check out ecogrid module" if="ecogrid.required">
791
		<svn>
792
			<export srcUrl="${svn.ecogridUrl}"
793
				destPath="${ecogrid-dir}" />
794
		</svn>
795
	</target>
796

    
797
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
798
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
799
		<property name="context" value="${metacat.context}"/>
800
		<property name="target" value="${ecogrid-target-name}"/>
801
		<property name="metacat.dir" value="."/>
802
		<property name="hostname" value="${ecogrid.hostname}"/>
803
		<property name="port" value="${config.port}"/>
804
		</ant>
805
		</target -->
806

    
807
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
808
		description="Automately generate wsdd for ecogrid service">
809
		<delete
810
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
811
	</target>
812

    
813
	<target name="install-skin" depends="init"
814
		description="Install a Skin">
815

    
816
		<input message="Please enter name of the skin"
817
			addproperty="skin-name" />
818

    
819
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
820
		<copy todir="${installdir}/style/skins/${skin-name}"
821
			filtering="yes">
822
			<fileset dir="lib/style/skins/${skin-name}">
823
				<exclude name="**/*.png" />
824
				<exclude name="**/*.gif" />
825
				<exclude name="**/*.jpg" />
826
				<exclude name="**/CVS*" />
827
				<exclude name="**/.#*" />
828
			</fileset>
829
		</copy>
830
		<copy todir="${installdir}/style/skins/${skin-name}"
831
			filtering="no">
832
			<fileset dir="lib/style/skins/${skin-name}">
833
				<include name="**/*.png" />
834
				<include name="**/*.gif" />
835
				<include name="**/*.jpg" />
836
				<exclude name="**/CVS*" />
837
				<exclude name="**/.#*" />
838
			</fileset>
839
		</copy>
840
		<copy todir="${installdir}/style/common" filtering="yes">
841
			<fileset dir="lib/style/common">
842
				<include name="*.js" />
843
				<include name="*.jsp" />
844
				<include name="*.css" />
845
				<exclude name="*.png" />
846
				<exclude name="*.gif" />
847
				<exclude name="*.jpg" />
848
				<exclude name="**/CVS*" />
849
				<exclude name="**/.#*" />
850
			</fileset>
851
		</copy>
852
		<!--
853
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
854
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
855
			<fileset dir="lib/style/skins/${skin-name}/images">
856
			<include name="*.png"/>
857
			<include name="*.gif"/>
858
			<include name="*.jpg"/>
859
			</fileset>
860
			</copy>
861
		-->
862

    
863
		<echo message="Install Skin completed." />
864
	</target>
865

    
866
	<target name="war" depends="warPrepare,install-spatial"
867
		description="Create a web archive (WAR) for servlet deployment">
868
		<mkdir dir="${dist.dir}" />
869
		<war destfile="${dist.dir}/${metacat.context}.war"
870
			webxml="${build.war}/web.xml">
871
			<fileset dir="${war.context}" />
872
			<lib dir="${war.lib}" />
873
			<webinf dir="${war.webinf}" />
874
		</war>
875
	</target>
876

    
877
	<target name="warPrepare"
878
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
879
		description="Prepare files for creating a web archive (WAR)">
880

    
881
		<property name="war.lib" value="${build.war}/lib" />
882
		<property name="war.webinf" value="${build.war}/WEB-INF" />
883
		<property name="war.context"
884
			value="${build.war}/${metacat.context}" />
885
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
886
		<property name="war.webinf.scripts"
887
			value="${war.webinf}/scripts" />
888
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
889
		<property name="war.context.docs" value="${war.context}/docs" />
890
		<property name="war.context.temp" value="${war.context}/temp" />
891
		<property name="war.context.templates"
892
			value="${war.context}${style-common-relpath}/templates" />
893
		<mkdir dir="${war.lib}" />
894
		<mkdir dir="${war.webinf}" />
895
		<mkdir dir="${war.context}" />
896
		<mkdir dir="${war.webinf.sql}" />
897
		<mkdir dir="${war.context.cgi}" />
898
		<mkdir dir="${war.context.docs}" />
899
		<mkdir dir="${war.context.temp}" />
900
		<mkdir dir="${war.context.templates}" />
901

    
902
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
903
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
904
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
905
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
906
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
907
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
908
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
909
		<copy todir="${war.lib}" filtering="no">
910
			<fileset dir="lib">
911
				<!--
912
					<not>
913
					<filename name="${jdbc-jar-name}"/>
914
					</not>
915
				-->
916
				<include name="*.jar" />
917
				<exclude name="maven-ant-tasks*.jar" />
918
			</fileset>
919
			<fileset dir="lib">
920
				<include name="xalan.jar" />
921
				<include name="gwt*.jar" />
922
			</fileset>
923
			<fileset dir="lib/oaipmh">
924
				<include name="oaicat.jar" />
925
			</fileset>
926
		</copy>
927
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
928
			tofile="${build.war}/web.xml" / -->
929
		<!-- MCD added next - Remove the tomcat5 reference-->
930
		<copy file="lib/web.xml.tomcat5" tofile="${build.war}/web.xml" />
931
		<copy file="lib/metacat.properties" todir="${war.webinf}"
932
			filtering="yes" />
933
		<copy file="lib/metacat.properties.metadata.xml"
934
			todir="${war.webinf}" filtering="no" />
935
		<copy file="lib/org.properties.metadata.xml"
936
			todir="${war.webinf}" filtering="no" />
937
		<copy file="lib/auth.properties.metadata.xml"
938
			todir="${war.webinf}" filtering="no" />
939
		<copy todir="${war.webinf}" filtering="yes">
940
			<fileset dir="lib">
941
				<include name="skin.configs/**" />
942
			</fileset>
943
		</copy>
944
		<copy file="lib/log4j.properties" todir="${war.webinf}"
945
			filtering="yes" />
946
		<copy todir="${war.context}" filtering="no">
947
			<fileset dir="lib">
948
				<include name="**/*.jpg" />
949
				<include name="**/*.png" />
950
				<include name="**/*.gif" />
951
				<include name="LiveMap_30/**" />
952
				<include name="oaipmh/**" />
953
			</fileset>
954
		</copy>
955
		<copy todir="${war.context}" filtering="yes">
956
			<fileset dir="lib">
957
				<exclude name="*.jar" />
958
				<exclude name="*.properties" />
959
				<exclude name="*.metadata.xml" />
960
				<exclude name="web.xml" />
961
				<exclude name="**/*.jpg" />
962
				<exclude name="**/*.png" />
963
				<exclude name="**/*.gif" />
964
				<exclude name="lsid_lib/**" />
965
				<exclude name="lsid_conf/**" />
966
				<exclude name="LiveMap_30/**" />
967
				<exclude name="oaipmh/**" />
968
				<exclude name="skin.configs/**" />
969
				<exclude name="spatial/geoserver/**" />
970
				<exclude name="spatial/WEB-INF/**" />
971
			</fileset>
972
		</copy>
973
		<copy todir="${war.context.docs}" filtering="yes">
974
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
975
		</copy>
976
		<copy todir="${war.context.docs}" filtering="no">
977
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
978
		</copy>
979
		<copy todir="${war.webinf.sql}" filtering="yes">
980
			<fileset dir="src">
981
				<include name="**/*.sql" />
982
			</fileset>
983
		</copy>
984
		<copy todir="${war.webinf.scripts}" filtering="yes">
985
			<fileset dir="src/scripts" />
986
		</copy>
987
		<copy todir="${war.webinf.scripts}"
988
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
989
			failonerror="false" />
990

    
991
		<copy file="src/perl/register-dataset.cgi"
992
			todir="${war.context.cgi}" />
993
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
994
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
995

    
996
		<!-- registry cgi section -->
997
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
998
			used in readDocumentFromMetacat -->
999
		<!-- TODO MCD copy temp files to actual location using config util?? -->
1000
		<copy todir="${war.context.temp}" filtering="yes">
1001
			<fileset dir="lib/style/common/emlb6toeml2">
1002
				<include name="*.xsl" />
1003
				<include name="*.xml" />
1004
			</fileset>
1005
		</copy>
1006
		<available file="lib/style/common/emlb6toeml2" type="dir"
1007
			property="styles.not.needed" />
1008

    
1009
		<!-- ldap cgi section -->
1010
		<copy todir="${war.context.templates}">
1011
			<fileset dir="lib/style/common/templates">
1012
				<!-- SCW: Copy all files -->
1013
			</fileset>
1014
		</copy>
1015
	</target>
1016

    
1017
	<target name="cgiPrepare" if="build.perl">
1018
		<exec dir="src/perl/Metacat/" executable="make">
1019
			<arg value="clean" />
1020
		</exec>
1021
		<exec dir="src/perl/Metacat/" executable="perl">
1022
			<arg value="Makefile.PL" />
1023
		</exec>
1024
		<exec dir="src/perl/Metacat/" executable="make" />
1025
	</target>
1026

    
1027
	<target name="testPrepare"
1028
		description="Copies test files into the war directories">
1029
		<echo>in testPrepare</echo>
1030
		<property name="war.context.test"
1031
			value="${build.war}/${metacat.context}/test" />
1032
		<mkdir dir="${war.context.test}" />
1033
		<copy todir="${war.context.test}" filtering="yes">
1034
			<fileset dir="test/servertestfiles">
1035
				<include name="*/**" />
1036
			</fileset>
1037
		</copy>
1038
	</target>
1039

    
1040
	<target name="getConversionXSL" depends="prepare"
1041
		unless="styles.not.needed"
1042
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1043

    
1044
		<svn>
1045
			<export srcUrl="${svn.eml2StyleUrl}"
1046
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1047
		</svn>
1048

    
1049
		<mkdir dir="lib/style/common/emlb6toeml2" />
1050
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1051
			<fileset
1052
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1053
				<include name="*.xsl" />
1054
				<include name="*.xml" />
1055
			</fileset>
1056
		</copy>
1057
	</target>
1058

    
1059
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1060
		<mkdir dir="${build.tests}" />
1061
		<copy todir="${build.tests}" filtering="yes">
1062
			<fileset dir="${testdir}">
1063
				<include name="edu/**" />
1064
			</fileset>
1065
		</copy>
1066
		<copy todir="${build.tests}" file="${testdir}/test.properties"
1067
			filtering="yes" />
1068

    
1069
		<!-- copy and compile the tests into a jar file -->
1070
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1071
			debug="on" includes="**/*.java">
1072
			<classpath>
1073
				<path refid="compile.classpath" />
1074
				<fileset dir="${build.dir}">
1075
					<include name="${name}.jar" />
1076
					<include name="${name}-client.jar" />
1077
					<include name="harvester.jar" />
1078
				</fileset>
1079
			</classpath>
1080
		</javac>
1081

    
1082
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1083
			basedir="${build.tests}" includes="**/*.class" />
1084
	</target>
1085

    
1086
	<target name="test" depends="testprep"
1087
		description="Uses the ant junit task to run all JUnit tests">
1088

    
1089
		<!-- use the ant "junit" task to run JUnit tests. -->
1090
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1091
			haltonerror="no">
1092
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1093
			<classpath>
1094
				<path refid="test.classpath" />
1095
				<fileset dir="${build.dir}">
1096
					<include name="${name}.jar" />
1097
					<include name="${name}-client.jar" />
1098
					<include name="harvester.jar" />
1099
					<include name="${name}-junittests.jar" />
1100
				</fileset>
1101
			</classpath>
1102

    
1103
			<formatter type="plain" />
1104

    
1105
			<batchtest fork="yes" todir="${build.dir}">
1106
				<fileset dir="${build.tests}">
1107
					<include name="**/*.class" />
1108
					<exclude name="**/MCTestCase.class" />
1109
					<exclude name="**/ClientViewHelperTest.class" />
1110
				</fileset>
1111
			</batchtest>
1112
		</junit>
1113
	</target>
1114

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

    
1118
		<echo>testtorun: ${testtorun}</echo>
1119

    
1120
		<!-- use the ant "junit" task to run JUnit tests. -->
1121
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1122
			haltonerror="no" showoutput="yes">
1123
			<!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1124
			<classpath>
1125
				<path refid="test.classpath" />
1126
				<fileset dir="${build.dir}">
1127
					<include name="${name}.jar" />
1128
					<include name="${name}-client.jar" />
1129
					<include name="harvester.jar" />
1130
					<include name="${name}-junittests.jar" />
1131
				</fileset>
1132
			</classpath>
1133

    
1134
			<formatter type="plain" />
1135

    
1136
			<batchtest fork="yes" todir="${build.dir}">
1137
				<fileset dir="${build.tests}">
1138
					<include name="**/${testtorun}.class" />
1139
				</fileset>
1140
			</batchtest>
1141
		</junit>
1142
	</target>
1143

    
1144
	<target name="testharvester" depends="testprep"
1145
		description="Uses the ant junit task to test only the Harvester code">
1146
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1147
			haltonerror="off">
1148
			<classpath>
1149
				<path refid="compile.classpath" />
1150
				<fileset dir="${build.dir}">
1151
					<include name="${name}.jar" />
1152
					<include name="${name}-client.jar" />
1153
					<include name="harvester.jar" />
1154
					<include name="${name}-junittests.jar" />
1155
				</fileset>
1156
			</classpath>
1157
			<formatter type="plain" />
1158
			<batchtest fork="yes" todir="${build.dir}">
1159
				<fileset dir="${build.tests}">
1160
					<include name="**/harvesterClient/*.class" />
1161
				</fileset>
1162
			</batchtest>
1163
		</junit>
1164
	</target>
1165

    
1166
	<target name="gethttpclient" depends="prepare"
1167
		description="checks out and compiles morpho httpclient code">
1168
		<!--mkdir dir="${morphosourcedir}" -->
1169
		<cvs cvsRoot="${cvsroot}" package="morpho" dest="." />
1170
		<ant dir="${morphosourcedir}" inheritAll="false" target="jar" />
1171
	</target>
1172

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

    
1177
		<echo>
1178
			*********************************** Please run ant
1179
			gethttpclient first! ***********************************
1180
		</echo>
1181
		<!-- copy and compile the tests into a jar file -->
1182
		<mkdir dir="${build.metacatnettest}" />
1183
		<javac srcdir="${junitnettestsdir}"
1184
			destdir="${build.metacatnettest}" includes="**/*.java">
1185
			<classpath>
1186
				<path refid="compile.classpath" />
1187
				<fileset dir="${build.dir}">
1188
					<include name="${name}.jar" />
1189
				</fileset>
1190
			</classpath>
1191
		</javac>
1192

    
1193
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1194
			basedir="${build.metacatnettest}" includes="**/*.class" />
1195

    
1196
		<!-- use the ant "junit" task to run JUnit tests. -->
1197
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1198
			haltonerror="no">
1199
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1200
			<classpath>
1201
				<path refid="compile.classpath" />
1202
				<fileset dir="${build.dir}">
1203
					<include name="${name}.jar" />
1204
					<include name="${name}-junitnettests.jar" />
1205
				</fileset>
1206
			</classpath>
1207

    
1208
			<formatter type="plain" />
1209

    
1210
			<batchtest fork="yes" todir="${build.dir}">
1211
				<fileset dir="${build.metacatnettest}">
1212
					<include name="**/*.class" />
1213
				</fileset>
1214
			</batchtest>
1215
		</junit>
1216
	</target>
1217

    
1218
	<target name="cleanweb" depends="clean"
1219
		description="deletes tomcat web context dir and all its contents">
1220
		<delete dir="${installdir}" />
1221
	</target>
1222

    
1223

    
1224
	<target name="clean" depends="init"
1225
		description="deletes build dir and files that can be regenerated form the release">
1226
		<delete dir="${build.dir}" />
1227
		<delete dir="${dist.dir}" />
1228
	</target>
1229

    
1230
	<target name="localclean" depends="clean"
1231
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1232
		<delete file="lib/httpclient.jar" />
1233
		<delete file="lib/utilities.jar" />
1234
	</target>
1235

    
1236
	<target name="fullclean" depends="localclean"
1237
		description="deletes code and eml">
1238
		<delete includeEmptyDirs="true" failonerror="false">
1239
			<fileset dir="${style-common-cvsrelpath}">
1240
				<include name="${eml-css}" />
1241
				<include name="eml-*/*.xsl" />
1242
				<include name="eml-*" />
1243
			</fileset>
1244
			<fileset dir="${schema-cvsrelpath}">
1245
				<include name="eml-*/*.xsd" />
1246
			</fileset>
1247
			<fileset dir="${ecogrid-dir}">
1248
				<include name="build.properties" />
1249
				<include name="buildfiles/metacatImpl.xml" />
1250
			</fileset>
1251
		</delete>
1252
	</target>
1253

    
1254
	<target name="jdoc" depends="prepare"
1255
		description="generates javadoc documentation">
1256
		<javadoc packagenames="edu.ucsb.nceas.*"
1257
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1258
			version="true" use="true" windowtitle="${Name} API"
1259
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1260
			bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1261
			<classpath>
1262
				<path refid="compile.classpath" />
1263
			</classpath>
1264
		</javadoc>
1265
	</target>
1266

    
1267
	<target name="dist"
1268
		depends="geteml,getd1schemas,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1269
		description="prepares a full release distribution">
1270
		<mkdir dir="${dist.dir}" />
1271
		<delete dir="${ver.dir}" />
1272
		<mkdir dir="${ver.dir}" />
1273
		<copy todir="${ver.dir}">
1274
			<fileset dir="."
1275
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1276
		</copy>
1277
		<copy todir="${ver.dir}" file="build.xml" />
1278
		<copy todir="${ver.dir}" file="build.properties" />
1279

    
1280
		<copy todir="${ver.dir}/docs" filtering="yes">
1281
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1282
		</copy>
1283
		<copy todir="${ver.dir}/docs" filtering="no">
1284
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1285
		</copy>
1286
		<copy todir="${ver.dir}/docs/dev">
1287
			<fileset dir="${build.dir}/docs" />
1288
		</copy>
1289
		<copy todir="${ver.dir}/src">
1290
			<fileset dir="${build.dir}/src" />
1291
		</copy>
1292

    
1293
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1294
		<copy todir="${ver.dir}/test/servertestfiles">
1295
			<fileset dir="./test/servertestfiles" />
1296
		</copy>
1297
	</target>
1298

    
1299
	<target name="distbin" depends="build-metacat,war-lsid"
1300
		description="prepares a binary distribution">
1301
		<copy todir="${dist.dir}">
1302
			<fileset dir="./src/scripts" />
1303
		</copy>
1304
		<delete file="./${name}-bin-${release}.zip" />
1305
		<zip zipfile="./${name}-bin-${release}.zip"
1306
			basedir="${dist.dir}" excludes="metacat-*/**" />
1307
		<delete file="./${name}-bin-${release}.tar.gz" />
1308
		<tar tarfile="./${name}-bin-${release}.tar"
1309
			basedir="${dist.dir}" excludes="metacat-*/**" />
1310
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1311
			src="./${name}-bin-${release}.tar" />
1312
		<delete file="./${name}-bin-${release}.tar" />
1313
	</target>
1314

    
1315
	<target name="distsrc" depends="dist"
1316
		description="prepares a source distribution">
1317
		<mkdir dir="${ver.src}" />
1318
		<copy todir="${ver.src}">
1319
			<fileset dir="./src" />
1320
		</copy>
1321
		<mkdir dir="${util.dir}" />
1322
		<copy todir="${util.dir}">
1323
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1324
		</copy>
1325

    
1326
		<mkdir dir="${ecogrid-dist-dir}" />
1327
		<copy todir="${ecogrid-dist-dir}">
1328
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1329
		</copy>
1330

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

    
1333
		<delete file="./${name}-src-${release}.zip" />
1334
		<zip zipfile="./${name}-src-${release}.zip"
1335
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1336
		<delete file="./${name}-src-${release}.tar.gz" />
1337
		<tar tarfile="./${name}-src-${release}.tar"
1338
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1339
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1340
			src="./${name}-src-${release}.tar" />
1341
		<delete file="./${name}-src-${release}.tar" />
1342
		<!--delete dir="${dist.dir}"/ -->
1343
	</target>
1344

    
1345
	<target name="deb-package" depends="distbin"
1346
		description="create a debian installation package">
1347
		<delete dir="${deb.pkg.dir}" />
1348
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1349
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1350
			<fileset dir="./src/scripts/debian"
1351
				includes="control postinst" />
1352
		</copy>
1353

    
1354
		<mkdir
1355
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1356
		<copy
1357
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1358
			filtering="yes">
1359
			<fileset dir="./src/scripts/debian"
1360
				excludes="control postinst" />
1361
		</copy>
1362
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1363

    
1364
		<copy file="${dist.dir}/knb.war"
1365
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1366
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1367
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1368

    
1369
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1370
			failonerror="true">
1371
			<arg line="--build debian" />
1372
		</exec>
1373

    
1374
		<move file="${pkg.dir}/debian.deb"
1375
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1376
	</target>
1377

    
1378
	<target name="stylesheettest">
1379
		<xslt in="${input}" out="eml.html"
1380
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1381
			<param name="displaymodule" expression="${displaymodule}" />
1382
			<param name="docid" expression="${input}" />
1383
			<param name="entitytype" expression="${entitytype}" />
1384
			<param name="entityindex" expression="${entityindex}" />
1385
			<outputproperty name="method" value="html" />
1386
			<outputproperty name="standalone" value="yes" />
1387
			<outputproperty name="encoding" value="iso8859_1" />
1388
			<outputproperty name="indent" value="yes" />
1389
		</xslt>
1390
	</target>
1391

    
1392

    
1393
	<target name="compilewebclient" depends="prepare">
1394
		<javac srcdir="${build.src}" destdir="${build.dest}"
1395
			includes="**/application/*.java" classpathref="webservicepath" />
1396
	</target>
1397

    
1398
	<target name="runwebclient" depends="compilewebclient">
1399
		<java
1400
			classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1401
			dir="${build.dest}" fork="yes" classpathref="webservicepath"
1402
			classpath="./lib/utilities.jar" failonerror="true">
1403
			<arg value="${serviceUrl}" />
1404
			<arg value="${docid}" />
1405
		</java>
1406
	</target>
1407

    
1408
	<target name="spatial_option" depends="prepare"
1409
		description=" -- compiles code for the spatial option">
1410

    
1411
		<echo message="Compiling the metatcat shapefile creator" />
1412
		<echo message="using the shapelib at: ${shapelib.dir}" />
1413
		<exec dir="." executable="g++" os="Linux, Unix"
1414
			failonerror="true">
1415
			<arg
1416
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1417
		</exec>
1418

    
1419
		<exec dir="." executable="g++" os="Linux, Unix"
1420
			failonerror="true">
1421
			<arg
1422
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1423
		</exec>
1424
	</target>
1425

    
1426
	<!-- LSID Authority support -->
1427
	<patternset id="lsid.jars">
1428
		<include name="axis.jar" />
1429
		<include name="commons-discovery-0.2.jar" />
1430
		<include name="jaxrpc.jar" />
1431
		<include name="lsid-client-1.1.1.jar" />
1432
		<include name="lsid-server-1.1.1.jar" />
1433
		<include name="saaj.jar" />
1434
		<include name="wsdl4j-1.5.1.jar" />
1435
		<include name="activation.jar" />
1436
		<include name="castor-0.9.5.jar" />
1437
		<include name="dnsjava-1.3.2.jar" />
1438
		<include name="mail.jar" />
1439
		<include name="commons-logging-1.0.4.jar" />
1440
		<!-- These jars may be needed but seem to not actually be,
1441
			so leaving them out for now
1442
			<include name="axis-ant.jar" />
1443
		-->
1444
		<!--<include name="GenCastor.class" />-->
1445
	</patternset>
1446
	<patternset id="lib.jars">
1447
		<include name="httpclient.jar" />
1448
		<include name="log4j-1.2.12.jar" />
1449
		<include name="utilities.jar" />
1450
		<include name="xercesImpl.jar" />
1451
		<include name="xalan.jar" />
1452
		<include name="xml-apis.jar" />
1453
	</patternset>
1454

    
1455
	<path id="lsid.classpath">
1456
		<fileset dir="${lsid.lib.dir}">
1457
			<patternset refid="lsid.jars" />
1458
		</fileset>
1459
		<fileset dir="${lib.dir}">
1460
			<patternset refid="lsid.jars" />
1461
		</fileset>
1462
		<fileset dir="${lib.dir}">
1463
			<include name="xalan.jar" />
1464
			<include name="xml-apis.jar" />
1465
		</fileset>
1466
		<fileset dir="${build.dir}">
1467
			<include name="metacat-client.jar" />
1468
		</fileset>
1469
	</path>
1470

    
1471
	<filterset id="configFilters">
1472
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1473
			value="${config.hostname}" / -->
1474
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1475
			value="${config.port}" / -->
1476
		<!-- MCD BYE filter token="METADATA_LABELS"
1477
			value="${config.metadataLabelLsid}" / -->
1478
		<!-- MCD BYE filter token="METACAT_SERVER"
1479
			value="${config.metacatserver}" / -->
1480
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1481
			value="${config.lsidauthority}" / -->
1482
	</filterset>
1483

    
1484
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1485
		description="Configure files prior to compilation">
1486
		<mkdir dir="${lsid.build.dir}" />
1487
		<!-- Copy the properties file into the build -->
1488
		<copy file="${conf.dir}/metacat-lsid.properties"
1489
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1490
			overwrite="true">
1491
			<filterset refid="configFilters" />
1492
		</copy>
1493
		<copy file="${conf.dir}/log4j.properties"
1494
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1495
			overwrite="true">
1496
			<filterset refid="configFilters" />
1497
		</copy>
1498
		<!-- Copy config files into the build -->
1499
		<copy todir="${lsid.build.dir}/WEB-INF">
1500
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1501
		</copy>
1502
		<!-- Copy the metadata configuration files into the build -->
1503
		<mkdir
1504
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1505
		<copy
1506
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1507
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1508
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1509
			<filterset refid="configFilters" />
1510
		</copy>
1511
		<!-- Copy services files into the build -->
1512
		<mkdir dir="${lsid.build.dir}/services" />
1513
		<copy todir="${lsid.build.dir}/services">
1514
			<fileset dir="${services.dir}" />
1515
			<filterset refid="configFilters" />
1516
		</copy>
1517
		<!-- Copy axis files into the build -->
1518
		<mkdir dir="${lsid.build.dir}" />
1519
		<copy todir="${lsid.build.dir}">
1520
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1521
		</copy>
1522
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1523
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1524
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1525
		</copy>
1526
	</target>
1527

    
1528
	<target name="compile-lsid" depends="prepare-lsid"
1529
		description="Compile Java sources">
1530
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1531
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1532
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1533
			deprecation="${compile.deprecation}"
1534
			optimize="${compile.optimize}">
1535
			<classpath refid="lsid.classpath" />
1536
		</javac>
1537
	</target>
1538

    
1539
	<target name="war-lsid" depends="compile-lsid"
1540
		description="Create a war file for the application">
1541
		<mkdir dir="${dist.dir}" />
1542
		<war destfile="${dist.dir}/${authority.context}.war"
1543
			webxml="${webinf.dir}/web.xml">
1544
			<fileset dir="${lsid.build.dir}" />
1545
			<lib dir="${lsid.lib.dir}">
1546
				<patternset refid="lsid.jars" />
1547
			</lib>
1548
			<lib dir="${lib.dir}">
1549
				<patternset refid="lib.jars" />
1550
			</lib>
1551
			<lib dir="${lib.dir}">
1552
				<include name="xalan.jar" />
1553
				<include name="xml-apis.jar" />
1554
			</lib>
1555
			<lib dir="${build.dir}">
1556
				<include name="metacat-client.jar" />
1557
			</lib>
1558
		</war>
1559
	</target>
1560

    
1561
	<target name="deploy-lsid" depends="war-lsid"
1562
		description="Deploy LSID war to servlet container">
1563
		<delete dir="${app.deploy.dir}/${authority.context}" />
1564
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1565
		<mkdir dir="${app.deploy.dir}" />
1566
		<copy todir="${app.deploy.dir}">
1567
			<fileset dir="${dist.dir}" />
1568
		</copy>
1569
	</target>
1570

    
1571
    <!-- Build the dataone service, but only if it is checked out as a
1572
         sibling of the current build directory. Requires maven2 to
1573
         be installed and on the path. -->
1574
    <target name="dataone-service" if="d1.available">
1575
        <property name="d1.jar" value="dataone-service-api-0.3.0.jar"/>
1576

    
1577
        <artifact:mvn pom="${d1.dir}/pom.xml" fork="true"
1578
                      mavenHome="${maven.home}">
1579
            <arg value="install"/>
1580
        </artifact:mvn>
1581
		<copy file="${d1.dir}/target/${d1.jar}" todir="${lib.dir}" />
1582
    </target>
1583
</project>
(5-5/6)