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-19 22:14:07 -0700 (Mon, 19 Apr 2010) $'
11
	*    '$Revision: 5320 $'
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="eml2-style-tag" value="RELEASE_EML_UTILS_0_9_0" />
180
		<property name="eml2_0_0namespace"
181
			value="eml://ecoinformatics.org/eml-2.0.0" />
182
		<property name="eml2_0_1namespace"
183
			value="eml://ecoinformatics.org/eml-2.0.1" />
184
		<property name="eml2_1_0namespace"
185
			value="eml://ecoinformatics.org/eml-2.1.0" />
186
		<property name="stmmlnamespace"
187
			value="http://www.xml-cml.org/schema/stmml" />
188
		<property name="eml-css" value="eml_xsl.css" />
189
		<property name="eml-module.default.css" value="default.css" />
190
		<property name="systemidserver" value="" />
191
		<property name="html-path" value="" />
192

    
193

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

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

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

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

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

    
259

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

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

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

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

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

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

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

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

    
392
	</target>
393

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

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

    
417
	<taskdef resource="axis-tasks.properties"
418
		classpathref="compile.classpath" />
419

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

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

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

    
439
	<target name="jar" depends="compile,geteml"
440
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
441

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

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

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

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

    
471
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
472
	</target>
473

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

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

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

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

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

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

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

    
547
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
548
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
549

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

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

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

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

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

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

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

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

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

    
648
	<target name="copyxsl"
649
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
650

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

    
653
		<copy todir="${style-common-cvsrelpath}/${dirname}"
654
			filtering="yes">
655
			<fileset
656
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
657
				<include name="**/*.xsl" />
658
			</fileset>
659
		</copy>
660

    
661

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

    
668
	</target>
669

    
670
	<target name="correctEML201Docs" depends="jar"
671
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
672
		<copy todir="${build.dir}" file="lib/metacat.properties"
673
			filtering="yes" />
674
		<java
675
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
676
			<classpath>
677
				<path refid="compile.classpath" />
678
				<fileset dir="${build.dir}">
679
					<include name="${name}.jar" />
680
				</fileset>
681
			</classpath>
682
		</java>
683
	</target>
684

    
685
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
686
		description="Installs spatial option for metacat">
687

    
688
		<property name="spatial.dir" value="./lib/spatial" />
689
		<property name="spatial.geoserver.dir"
690
			value="${spatial.dir}/geoserver" />
691
		<property name="spatial.webinf-mods"
692
			value="${spatial.dir}/WEB-INF" />
693

    
694
		<!-- Copy geoserver libs into ${war.lib} -->
695
		<copy todir="${war.lib}" filtering="no">
696
			<fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
697
				<include name="**" />
698
			</fileset>
699
		</copy>
700

    
701
		<!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
702
		<copy todir="${war.webinf}" filtering="no">
703
			<fileset dir="${spatial.geoserver.dir}/WEB-INF">
704
				<exclude name="lib/**" />
705
				<exclude name="web.xml" />
706
			</fileset>
707
		</copy>
708

    
709
		<!-- Copy the rest of the geoserver codebase into ${war.context} -->
710
		<copy todir="${war.context}" filtering="no">
711
			<fileset dir="${spatial.geoserver.dir}">
712
				<exclude name="WEB-INF/**" />
713
				<exclude name="index.jsp" />
714
			</fileset>
715
		</copy>
716

    
717
		<!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
718
		<copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
719
			tofile="${war.context}/geoserver.jsp" overwrite="true"
720
			filtering="no" />
721

    
722
		<!-- Copy the rest of the modified geoserver web-inf files
723
			<copy todir="${war.webinf}" filtering="no">
724
			<fileset dir="${spatial.webinf-mods}">
725
			<exclude name="web.xml.combined"/>
726
			</fileset>
727
			</copy> -->
728

    
729
	</target>
730

    
731
	<target name="install" depends="build-metacat"
732
		description="* Full Install For Development *">
733
		<copy file="${dist.dir}/${metacat.context}.war"
734
			todir="${app.deploy.dir}" />
735
		<delete dir="${app.deploy.dir}/${metacat.context}" />
736
		<tstamp>
737
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
738
		</tstamp>
739
		<echo>Dev install completed at ${NOW}</echo>
740
	</target>
741

    
742
	<target name="build-metacat" depends="install-ecogrid"
743
		description="Build Metacat">
744
	</target>
745

    
746
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
747
		if="enable.ecogrid" description="Install Ecogrid Compentent">
748
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
749
			inheritall="false">
750
			<property name="context" value="${metacat.context}" />
751
			<property name="target" value="${ecogrid-target-name}" />
752
			<!-- property name="metacat.dir" value="."/ -->
753
		</ant>
754
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
755
			inheritall="false">
756
			<property name="context" value="${metacat.context}" />
757
			<property name="target" value="${ecogrid-target-name}" />
758
			<!-- property name="metacat.dir" value="."/ -->
759
		</ant>
760
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
761
			<webinf dir="${ecogrid-dir}/lib">
762
			<include name="server-config.wsdd"/>
763
			</webinf>
764
			</war -->
765
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
766
			todir="${dist.dir}" overwrite="true" />
767

    
768

    
769
	</target>
770

    
771
	<target name="get-ecogrid" depends="init"
772
		description="Check out ecogrid module" if="ecogrid.required">
773
		<svn>
774
			<export srcUrl="${svn.ecogridUrl}"
775
				destPath="${ecogrid-dir}" />
776
		</svn>
777
	</target>
778

    
779
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
780
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
781
		<property name="context" value="${metacat.context}"/>
782
		<property name="target" value="${ecogrid-target-name}"/>
783
		<property name="metacat.dir" value="."/>
784
		<property name="hostname" value="${ecogrid.hostname}"/>
785
		<property name="port" value="${config.port}"/>
786
		</ant>
787
		</target -->
788

    
789
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
790
		description="Automately generate wsdd for ecogrid service">
791
		<delete
792
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
793
	</target>
794

    
795
	<target name="install-skin" depends="init"
796
		description="Install a Skin">
797

    
798
		<input message="Please enter name of the skin"
799
			addproperty="skin-name" />
800

    
801
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
802
		<copy todir="${installdir}/style/skins/${skin-name}"
803
			filtering="yes">
804
			<fileset dir="lib/style/skins/${skin-name}">
805
				<exclude name="**/*.png" />
806
				<exclude name="**/*.gif" />
807
				<exclude name="**/*.jpg" />
808
				<exclude name="**/CVS*" />
809
				<exclude name="**/.#*" />
810
			</fileset>
811
		</copy>
812
		<copy todir="${installdir}/style/skins/${skin-name}"
813
			filtering="no">
814
			<fileset dir="lib/style/skins/${skin-name}">
815
				<include name="**/*.png" />
816
				<include name="**/*.gif" />
817
				<include name="**/*.jpg" />
818
				<exclude name="**/CVS*" />
819
				<exclude name="**/.#*" />
820
			</fileset>
821
		</copy>
822
		<copy todir="${installdir}/style/common" filtering="yes">
823
			<fileset dir="lib/style/common">
824
				<include name="*.js" />
825
				<include name="*.jsp" />
826
				<include name="*.css" />
827
				<exclude name="*.png" />
828
				<exclude name="*.gif" />
829
				<exclude name="*.jpg" />
830
				<exclude name="**/CVS*" />
831
				<exclude name="**/.#*" />
832
			</fileset>
833
		</copy>
834
		<!--
835
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
836
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
837
			<fileset dir="lib/style/skins/${skin-name}/images">
838
			<include name="*.png"/>
839
			<include name="*.gif"/>
840
			<include name="*.jpg"/>
841
			</fileset>
842
			</copy>
843
		-->
844

    
845
		<echo message="Install Skin completed." />
846
	</target>
847

    
848
	<target name="war" depends="warPrepare,install-spatial"
849
		description="Create a web archive (WAR) for servlet deployment">
850
		<mkdir dir="${dist.dir}" />
851
		<war destfile="${dist.dir}/${metacat.context}.war"
852
			webxml="${build.war}/web.xml">
853
			<fileset dir="${war.context}" />
854
			<lib dir="${war.lib}" />
855
			<webinf dir="${war.webinf}" />
856
		</war>
857
	</target>
858

    
859
	<target name="warPrepare"
860
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
861
		description="Prepare files for creating a web archive (WAR)">
862

    
863
		<property name="war.lib" value="${build.war}/lib" />
864
		<property name="war.webinf" value="${build.war}/WEB-INF" />
865
		<property name="war.context"
866
			value="${build.war}/${metacat.context}" />
867
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
868
		<property name="war.webinf.scripts"
869
			value="${war.webinf}/scripts" />
870
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
871
		<property name="war.context.docs" value="${war.context}/docs" />
872
		<property name="war.context.temp" value="${war.context}/temp" />
873
		<property name="war.context.templates"
874
			value="${war.context}${style-common-relpath}/templates" />
875
		<mkdir dir="${war.lib}" />
876
		<mkdir dir="${war.webinf}" />
877
		<mkdir dir="${war.context}" />
878
		<mkdir dir="${war.webinf.sql}" />
879
		<mkdir dir="${war.context.cgi}" />
880
		<mkdir dir="${war.context.docs}" />
881
		<mkdir dir="${war.context.temp}" />
882
		<mkdir dir="${war.context.templates}" />
883

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

    
973
		<copy file="src/perl/register-dataset.cgi"
974
			todir="${war.context.cgi}" />
975
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
976
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
977

    
978
		<!-- registry cgi section -->
979
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
980
			used in readDocumentFromMetacat -->
981
		<!-- TODO MCD copy temp files to actual location using config util?? -->
982
		<copy todir="${war.context.temp}" filtering="yes">
983
			<fileset dir="lib/style/common/emlb6toeml2">
984
				<include name="*.xsl" />
985
				<include name="*.xml" />
986
			</fileset>
987
		</copy>
988
		<available file="lib/style/common/emlb6toeml2" type="dir"
989
			property="styles.not.needed" />
990

    
991
		<!-- ldap cgi section -->
992
		<copy todir="${war.context.templates}">
993
			<fileset dir="lib/style/common/templates">
994
				<!-- SCW: Copy all files -->
995
			</fileset>
996
		</copy>
997
	</target>
998

    
999
	<target name="cgiPrepare" if="build.perl">
1000
		<exec dir="src/perl/Metacat/" executable="make">
1001
			<arg value="clean" />
1002
		</exec>
1003
		<exec dir="src/perl/Metacat/" executable="perl">
1004
			<arg value="Makefile.PL" />
1005
		</exec>
1006
		<exec dir="src/perl/Metacat/" executable="make" />
1007
	</target>
1008

    
1009
	<target name="testPrepare"
1010
		description="Copies test files into the war directories">
1011
		<echo>in testPrepare</echo>
1012
		<property name="war.context.test"
1013
			value="${build.war}/${metacat.context}/test" />
1014
		<mkdir dir="${war.context.test}" />
1015
		<copy todir="${war.context.test}" filtering="yes">
1016
			<fileset dir="test/servertestfiles">
1017
				<include name="*/**" />
1018
			</fileset>
1019
		</copy>
1020
	</target>
1021

    
1022
	<target name="getConversionXSL" depends="prepare"
1023
		unless="styles.not.needed"
1024
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1025

    
1026
		<svn>
1027
			<export srcUrl="${svn.eml2StyleUrl}"
1028
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1029
		</svn>
1030

    
1031
		<mkdir dir="lib/style/common/emlb6toeml2" />
1032
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1033
			<fileset
1034
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1035
				<include name="*.xsl" />
1036
				<include name="*.xml" />
1037
			</fileset>
1038
		</copy>
1039
	</target>
1040

    
1041
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1042
		<mkdir dir="${build.tests}" />
1043
		<copy todir="${build.tests}" filtering="yes">
1044
			<fileset dir="${testdir}">
1045
				<include name="edu/**" />
1046
			</fileset>
1047
		</copy>
1048
		<copy todir="${build.tests}" file="${testdir}/test.properties"
1049
			filtering="yes" />
1050

    
1051
		<!-- copy and compile the tests into a jar file -->
1052
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1053
			debug="on" includes="**/*.java">
1054
			<classpath>
1055
				<path refid="compile.classpath" />
1056
				<fileset dir="${build.dir}">
1057
					<include name="${name}.jar" />
1058
					<include name="${name}-client.jar" />
1059
					<include name="harvester.jar" />
1060
				</fileset>
1061
			</classpath>
1062
		</javac>
1063

    
1064
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1065
			basedir="${build.tests}" includes="**/*.class" />
1066
	</target>
1067

    
1068
	<target name="test" depends="testprep"
1069
		description="Uses the ant junit task to run all JUnit tests">
1070

    
1071
		<!-- use the ant "junit" task to run JUnit tests. -->
1072
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1073
			haltonerror="no">
1074
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1075
			<classpath>
1076
				<path refid="test.classpath" />
1077
				<fileset dir="${build.dir}">
1078
					<include name="${name}.jar" />
1079
					<include name="${name}-client.jar" />
1080
					<include name="harvester.jar" />
1081
					<include name="${name}-junittests.jar" />
1082
				</fileset>
1083
			</classpath>
1084

    
1085
			<formatter type="plain" />
1086

    
1087
			<batchtest fork="yes" todir="${build.dir}">
1088
				<fileset dir="${build.tests}">
1089
					<include name="**/*.class" />
1090
					<exclude name="**/MCTestCase.class" />
1091
					<exclude name="**/ClientViewHelperTest.class" />
1092
				</fileset>
1093
			</batchtest>
1094
		</junit>
1095
	</target>
1096

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

    
1100
		<echo>testtorun: ${testtorun}</echo>
1101

    
1102
		<!-- use the ant "junit" task to run JUnit tests. -->
1103
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1104
			haltonerror="no" showoutput="yes">
1105
			<!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1106
			<classpath>
1107
				<path refid="test.classpath" />
1108
				<fileset dir="${build.dir}">
1109
					<include name="${name}.jar" />
1110
					<include name="${name}-client.jar" />
1111
					<include name="harvester.jar" />
1112
					<include name="${name}-junittests.jar" />
1113
				</fileset>
1114
			</classpath>
1115

    
1116
			<formatter type="plain" />
1117

    
1118
			<batchtest fork="yes" todir="${build.dir}">
1119
				<fileset dir="${build.tests}">
1120
					<include name="**/${testtorun}.class" />
1121
				</fileset>
1122
			</batchtest>
1123
		</junit>
1124
	</target>
1125

    
1126
	<target name="testharvester" depends="testprep"
1127
		description="Uses the ant junit task to test only the Harvester code">
1128
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1129
			haltonerror="off">
1130
			<classpath>
1131
				<path refid="compile.classpath" />
1132
				<fileset dir="${build.dir}">
1133
					<include name="${name}.jar" />
1134
					<include name="${name}-client.jar" />
1135
					<include name="harvester.jar" />
1136
					<include name="${name}-junittests.jar" />
1137
				</fileset>
1138
			</classpath>
1139
			<formatter type="plain" />
1140
			<batchtest fork="yes" todir="${build.dir}">
1141
				<fileset dir="${build.tests}">
1142
					<include name="**/harvesterClient/*.class" />
1143
				</fileset>
1144
			</batchtest>
1145
		</junit>
1146
	</target>
1147

    
1148
	<target name="gethttpclient" depends="prepare"
1149
		description="checks out and compiles morpho httpclient code">
1150
		<!--mkdir dir="${morphosourcedir}" -->
1151
		<cvs cvsRoot="${cvsroot}" package="morpho" dest="." />
1152
		<ant dir="${morphosourcedir}" inheritAll="false" target="jar" />
1153
	</target>
1154

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

    
1159
		<echo>
1160
			*********************************** Please run ant
1161
			gethttpclient first! ***********************************
1162
		</echo>
1163
		<!-- copy and compile the tests into a jar file -->
1164
		<mkdir dir="${build.metacatnettest}" />
1165
		<javac srcdir="${junitnettestsdir}"
1166
			destdir="${build.metacatnettest}" includes="**/*.java">
1167
			<classpath>
1168
				<path refid="compile.classpath" />
1169
				<fileset dir="${build.dir}">
1170
					<include name="${name}.jar" />
1171
				</fileset>
1172
			</classpath>
1173
		</javac>
1174

    
1175
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1176
			basedir="${build.metacatnettest}" includes="**/*.class" />
1177

    
1178
		<!-- use the ant "junit" task to run JUnit tests. -->
1179
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1180
			haltonerror="no">
1181
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1182
			<classpath>
1183
				<path refid="compile.classpath" />
1184
				<fileset dir="${build.dir}">
1185
					<include name="${name}.jar" />
1186
					<include name="${name}-junitnettests.jar" />
1187
				</fileset>
1188
			</classpath>
1189

    
1190
			<formatter type="plain" />
1191

    
1192
			<batchtest fork="yes" todir="${build.dir}">
1193
				<fileset dir="${build.metacatnettest}">
1194
					<include name="**/*.class" />
1195
				</fileset>
1196
			</batchtest>
1197
		</junit>
1198
	</target>
1199

    
1200
	<target name="cleanweb" depends="clean"
1201
		description="deletes tomcat web context dir and all its contents">
1202
		<delete dir="${installdir}" />
1203
	</target>
1204

    
1205

    
1206
	<target name="clean" depends="init"
1207
		description="deletes build dir and files that can be regenerated form the release">
1208
		<delete dir="${build.dir}" />
1209
		<delete dir="${dist.dir}" />
1210
	</target>
1211

    
1212
	<target name="localclean" depends="clean"
1213
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1214
		<delete file="lib/httpclient.jar" />
1215
		<delete file="lib/utilities.jar" />
1216
	</target>
1217

    
1218
	<target name="fullclean" depends="localclean"
1219
		description="deletes code and eml">
1220
		<delete includeEmptyDirs="true" failonerror="false">
1221
			<fileset dir="${style-common-cvsrelpath}">
1222
				<include name="${eml-css}" />
1223
				<include name="eml-*/*.xsl" />
1224
				<include name="eml-*" />
1225
			</fileset>
1226
			<fileset dir="${schema-cvsrelpath}">
1227
				<include name="eml-*/*.xsd" />
1228
			</fileset>
1229
			<fileset dir="${ecogrid-dir}">
1230
				<include name="build.properties" />
1231
				<include name="buildfiles/metacatImpl.xml" />
1232
			</fileset>
1233
		</delete>
1234
	</target>
1235

    
1236
	<target name="jdoc" depends="prepare"
1237
		description="generates javadoc documentation">
1238
		<javadoc packagenames="edu.ucsb.nceas.*"
1239
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1240
			version="true" use="true" windowtitle="${Name} API"
1241
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1242
			bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1243
			<classpath>
1244
				<path refid="compile.classpath" />
1245
			</classpath>
1246
		</javadoc>
1247
	</target>
1248

    
1249
	<target name="dist"
1250
		depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1251
		description="prepares a full release distribution">
1252
		<mkdir dir="${dist.dir}" />
1253
		<delete dir="${ver.dir}" />
1254
		<mkdir dir="${ver.dir}" />
1255
		<copy todir="${ver.dir}">
1256
			<fileset dir="."
1257
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1258
		</copy>
1259
		<copy todir="${ver.dir}" file="build.xml" />
1260
		<copy todir="${ver.dir}" file="build.properties" />
1261

    
1262
		<copy todir="${ver.dir}/docs" filtering="yes">
1263
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1264
		</copy>
1265
		<copy todir="${ver.dir}/docs" filtering="no">
1266
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1267
		</copy>
1268
		<copy todir="${ver.dir}/docs/dev">
1269
			<fileset dir="${build.dir}/docs" />
1270
		</copy>
1271
		<copy todir="${ver.dir}/src">
1272
			<fileset dir="${build.dir}/src" />
1273
		</copy>
1274

    
1275
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1276
		<copy todir="${ver.dir}/test/servertestfiles">
1277
			<fileset dir="./test/servertestfiles" />
1278
		</copy>
1279
	</target>
1280

    
1281
	<target name="distbin" depends="build-metacat,war-lsid"
1282
		description="prepares a binary distribution">
1283
		<copy todir="${dist.dir}">
1284
			<fileset dir="./src/scripts" />
1285
		</copy>
1286
		<delete file="./${name}-bin-${release}.zip" />
1287
		<zip zipfile="./${name}-bin-${release}.zip"
1288
			basedir="${dist.dir}" excludes="metacat-*/**" />
1289
		<delete file="./${name}-bin-${release}.tar.gz" />
1290
		<tar tarfile="./${name}-bin-${release}.tar"
1291
			basedir="${dist.dir}" excludes="metacat-*/**" />
1292
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1293
			src="./${name}-bin-${release}.tar" />
1294
		<delete file="./${name}-bin-${release}.tar" />
1295
	</target>
1296

    
1297
	<target name="distsrc" depends="dist"
1298
		description="prepares a source distribution">
1299
		<mkdir dir="${ver.src}" />
1300
		<copy todir="${ver.src}">
1301
			<fileset dir="./src" />
1302
		</copy>
1303
		<mkdir dir="${util.dir}" />
1304
		<copy todir="${util.dir}">
1305
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1306
		</copy>
1307

    
1308
		<mkdir dir="${ecogrid-dist-dir}" />
1309
		<copy todir="${ecogrid-dist-dir}">
1310
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1311
		</copy>
1312

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

    
1315
		<delete file="./${name}-src-${release}.zip" />
1316
		<zip zipfile="./${name}-src-${release}.zip"
1317
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1318
		<delete file="./${name}-src-${release}.tar.gz" />
1319
		<tar tarfile="./${name}-src-${release}.tar"
1320
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1321
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1322
			src="./${name}-src-${release}.tar" />
1323
		<delete file="./${name}-src-${release}.tar" />
1324
		<!--delete dir="${dist.dir}"/ -->
1325
	</target>
1326

    
1327
	<target name="deb-package" depends="distbin"
1328
		description="create a debian installation package">
1329
		<delete dir="${deb.pkg.dir}" />
1330
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1331
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1332
			<fileset dir="./src/scripts/debian"
1333
				includes="control postinst" />
1334
		</copy>
1335

    
1336
		<mkdir
1337
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1338
		<copy
1339
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1340
			filtering="yes">
1341
			<fileset dir="./src/scripts/debian"
1342
				excludes="control postinst" />
1343
		</copy>
1344
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1345

    
1346
		<copy file="${dist.dir}/knb.war"
1347
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1348
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1349
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1350

    
1351
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1352
			failonerror="true">
1353
			<arg line="--build debian" />
1354
		</exec>
1355

    
1356
		<move file="${pkg.dir}/debian.deb"
1357
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1358
	</target>
1359

    
1360
	<target name="stylesheettest">
1361
		<xslt in="${input}" out="eml.html"
1362
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1363
			<param name="displaymodule" expression="${displaymodule}" />
1364
			<param name="docid" expression="${input}" />
1365
			<param name="entitytype" expression="${entitytype}" />
1366
			<param name="entityindex" expression="${entityindex}" />
1367
			<outputproperty name="method" value="html" />
1368
			<outputproperty name="standalone" value="yes" />
1369
			<outputproperty name="encoding" value="iso8859_1" />
1370
			<outputproperty name="indent" value="yes" />
1371
		</xslt>
1372
	</target>
1373

    
1374

    
1375
	<target name="compilewebclient" depends="prepare">
1376
		<javac srcdir="${build.src}" destdir="${build.dest}"
1377
			includes="**/application/*.java" classpathref="webservicepath" />
1378
	</target>
1379

    
1380
	<target name="runwebclient" depends="compilewebclient">
1381
		<java
1382
			classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1383
			dir="${build.dest}" fork="yes" classpathref="webservicepath"
1384
			classpath="./lib/utilities.jar" failonerror="true">
1385
			<arg value="${serviceUrl}" />
1386
			<arg value="${docid}" />
1387
		</java>
1388
	</target>
1389

    
1390
	<target name="spatial_option" depends="prepare"
1391
		description=" -- compiles code for the spatial option">
1392

    
1393
		<echo message="Compiling the metatcat shapefile creator" />
1394
		<echo message="using the shapelib at: ${shapelib.dir}" />
1395
		<exec dir="." executable="g++" os="Linux, Unix"
1396
			failonerror="true">
1397
			<arg
1398
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1399
		</exec>
1400

    
1401
		<exec dir="." executable="g++" os="Linux, Unix"
1402
			failonerror="true">
1403
			<arg
1404
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1405
		</exec>
1406
	</target>
1407

    
1408
	<!-- LSID Authority support -->
1409
	<patternset id="lsid.jars">
1410
		<include name="axis.jar" />
1411
		<include name="commons-discovery-0.2.jar" />
1412
		<include name="jaxrpc.jar" />
1413
		<include name="lsid-client-1.1.1.jar" />
1414
		<include name="lsid-server-1.1.1.jar" />
1415
		<include name="saaj.jar" />
1416
		<include name="wsdl4j-1.5.1.jar" />
1417
		<include name="activation.jar" />
1418
		<include name="castor-0.9.5.jar" />
1419
		<include name="dnsjava-1.3.2.jar" />
1420
		<include name="mail.jar" />
1421
		<include name="commons-logging-1.0.4.jar" />
1422
		<!-- These jars may be needed but seem to not actually be,
1423
			so leaving them out for now
1424
			<include name="axis-ant.jar" />
1425
		-->
1426
		<!--<include name="GenCastor.class" />-->
1427
	</patternset>
1428
	<patternset id="lib.jars">
1429
		<include name="httpclient.jar" />
1430
		<include name="log4j-1.2.12.jar" />
1431
		<include name="utilities.jar" />
1432
		<include name="xercesImpl.jar" />
1433
		<include name="xalan.jar" />
1434
		<include name="xml-apis.jar" />
1435
	</patternset>
1436

    
1437
	<path id="lsid.classpath">
1438
		<fileset dir="${lsid.lib.dir}">
1439
			<patternset refid="lsid.jars" />
1440
		</fileset>
1441
		<fileset dir="${lib.dir}">
1442
			<patternset refid="lsid.jars" />
1443
		</fileset>
1444
		<fileset dir="${lib.dir}">
1445
			<include name="xalan.jar" />
1446
			<include name="xml-apis.jar" />
1447
		</fileset>
1448
		<fileset dir="${build.dir}">
1449
			<include name="metacat-client.jar" />
1450
		</fileset>
1451
	</path>
1452

    
1453
	<filterset id="configFilters">
1454
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1455
			value="${config.hostname}" / -->
1456
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1457
			value="${config.port}" / -->
1458
		<!-- MCD BYE filter token="METADATA_LABELS"
1459
			value="${config.metadataLabelLsid}" / -->
1460
		<!-- MCD BYE filter token="METACAT_SERVER"
1461
			value="${config.metacatserver}" / -->
1462
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1463
			value="${config.lsidauthority}" / -->
1464
	</filterset>
1465

    
1466
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1467
		description="Configure files prior to compilation">
1468
		<mkdir dir="${lsid.build.dir}" />
1469
		<!-- Copy the properties file into the build -->
1470
		<copy file="${conf.dir}/metacat-lsid.properties"
1471
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1472
			overwrite="true">
1473
			<filterset refid="configFilters" />
1474
		</copy>
1475
		<copy file="${conf.dir}/log4j.properties"
1476
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1477
			overwrite="true">
1478
			<filterset refid="configFilters" />
1479
		</copy>
1480
		<!-- Copy config files into the build -->
1481
		<copy todir="${lsid.build.dir}/WEB-INF">
1482
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1483
		</copy>
1484
		<!-- Copy the metadata configuration files into the build -->
1485
		<mkdir
1486
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1487
		<copy
1488
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1489
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1490
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1491
			<filterset refid="configFilters" />
1492
		</copy>
1493
		<!-- Copy services files into the build -->
1494
		<mkdir dir="${lsid.build.dir}/services" />
1495
		<copy todir="${lsid.build.dir}/services">
1496
			<fileset dir="${services.dir}" />
1497
			<filterset refid="configFilters" />
1498
		</copy>
1499
		<!-- Copy axis files into the build -->
1500
		<mkdir dir="${lsid.build.dir}" />
1501
		<copy todir="${lsid.build.dir}">
1502
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1503
		</copy>
1504
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1505
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1506
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1507
		</copy>
1508
	</target>
1509

    
1510
	<target name="compile-lsid" depends="prepare-lsid"
1511
		description="Compile Java sources">
1512
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1513
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1514
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1515
			deprecation="${compile.deprecation}"
1516
			optimize="${compile.optimize}">
1517
			<classpath refid="lsid.classpath" />
1518
		</javac>
1519
	</target>
1520

    
1521
	<target name="war-lsid" depends="compile-lsid"
1522
		description="Create a war file for the application">
1523
		<mkdir dir="${dist.dir}" />
1524
		<war destfile="${dist.dir}/${authority.context}.war"
1525
			webxml="${webinf.dir}/web.xml">
1526
			<fileset dir="${lsid.build.dir}" />
1527
			<lib dir="${lsid.lib.dir}">
1528
				<patternset refid="lsid.jars" />
1529
			</lib>
1530
			<lib dir="${lib.dir}">
1531
				<patternset refid="lib.jars" />
1532
			</lib>
1533
			<lib dir="${lib.dir}">
1534
				<include name="xalan.jar" />
1535
				<include name="xml-apis.jar" />
1536
			</lib>
1537
			<lib dir="${build.dir}">
1538
				<include name="metacat-client.jar" />
1539
			</lib>
1540
		</war>
1541
	</target>
1542

    
1543
	<target name="deploy-lsid" depends="war-lsid"
1544
		description="Deploy LSID war to servlet container">
1545
		<delete dir="${app.deploy.dir}/${authority.context}" />
1546
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1547
		<mkdir dir="${app.deploy.dir}" />
1548
		<copy todir="${app.deploy.dir}">
1549
			<fileset dir="${dist.dir}" />
1550
		</copy>
1551
	</target>
1552

    
1553
    <!-- Build the dataone service, but only if it is checked out as a
1554
         sibling of the current build directory. Requires maven2 to
1555
         be installed and on the path. -->
1556
    <target name="dataone-service" if="d1.available">
1557
        <property name="d1.jar" value="dataone-service-api-0.3.0.jar"/>
1558

    
1559
        <artifact:mvn pom="${d1.dir}/pom.xml" fork="true"
1560
                      mavenHome="${maven.home}">
1561
            <arg value="install"/>
1562
        </artifact:mvn>
1563
		<copy file="${d1.dir}/target/${d1.jar}" todir="${lib.dir}" />
1564
    </target>
1565
</project>
(5-5/6)