Project

General

Profile

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

    
36

    
37

    
38

    
39
	<!-- Determine if ecogrid should be installed-->
40
	<condition property="enable.ecogrid">
41
		<equals arg1="${install.ecogrid}" arg2="true" />
42
	</condition>
43

    
44
	<!-- Determine if perl should be built-->
45
	<condition property="build.perl">
46
		<equals arg1="${make.perl.code}" arg2="true" />
47
	</condition>
48

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

    
66
		<property name="debug" value="on" />
67
		<property name="morphosourcedir" value="../morpho" />
68
		<property name="utilitiesdir" value="../utilities" />
69
		<property name="installdir"
70
			value="${app.deploy.dir}/${metacat.context}" />
71

    
72
		<echo>*********** set jsdk to ${jsdk}</echo>
73
	</target>
74

    
75
	<target name="init" depends="config">
76
		<path id="compile.classpath">
77
			<pathelement location="${jsdk}" />
78
			<pathelement location="lib" />
79
			<fileset dir="lib">
80
				<include name="*.jar" />
81
			</fileset>
82
			<fileset dir="lib">
83
				<include name="xalan.jar" />
84
			</fileset>
85
			<fileset dir="lib/lsid_lib">
86
				<include name="*.jar" />
87
			</fileset>
88

    
89
			<!-- Include geoserver, geotools, et. al. -->
90
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
91
				<include name="*.jar" />
92
			</fileset>
93
			<pathelement
94
				location="lib/spatial/geoserver/WEB-INF/classes" />
95

    
96
			<!-- Include OAI-PMH -->
97
			<fileset dir="lib/oaipmh">
98
				<include name="*.jar" />
99
			</fileset>
100

    
101
		</path>
102

    
103
		<!-- It is less likely you'll need to make any changes from here down,
104
			but customization is possible -->
105
		<property name="name" value="metacat" />
106
		<property name="Name" value="MetaCat" />
107
		<property name="debugprefix" value="${Name}:" />
108
		<property name="release" value="${metacat.version}" />
109
		<property name="style-common-relpath" value="/style/common" />
110
		<property name="style-shared-relpath" value="/style/shared" />
111
		<property name="schema-relpath" value="/schema" />
112
		<property name="style-common-cvsrelpath"
113
			value="lib${style-common-relpath}" />
114
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
115
		<property name="style-skins-relpath" value="/style/skins" />
116
		<property name="util-module" value="utilities" />
117
		<property name="utilities-tag" value="UTILITIES_1_0_1_RC2" />
118
		<property name="eml-module" value="eml" />
119
		<property name="eml-version" value="2.0.0beta6" />
120
		<property name="eml-beta-tag"
121
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
122
		<property name="eml2_0_0-schema-tag"
123
			value="RELEASE_EML_2_0_0_UPDATE_1" />
124
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
125
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
126
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_0_9_0" />
127
		<property name="eml2_0_0namespace"
128
			value="eml://ecoinformatics.org/eml-2.0.0" />
129
		<property name="eml2_0_1namespace"
130
			value="eml://ecoinformatics.org/eml-2.0.1" />
131
		<property name="eml2_1_0namespace"
132
			value="eml://ecoinformatics.org/eml-2.1.0" />
133
		<property name="stmmlnamespace"
134
			value="http://www.xml-cml.org/schema/stmml" />
135
		<property name="eml-css" value="eml_xsl.css" />
136
		<property name="eml-module.default.css" value="default.css" />
137
		<property name="systemidserver" value="" />
138
		<property name="html-path" value="" />
139

    
140

    
141
		<!-- Config for registry variables -->
142
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
143
		<property name="scope" value="obfs" />
144
		<property name="responseForm" value="genericResponse.tmpl" />
145
		<property name="entryForm" value="entryForm.tmpl" />
146
		<property name="guide" value="genericGuide.tmpl" />
147
		<property name="loginForm" value="loginForm.tmpl" />
148
		<property name="confirmData" value="confirmData.tmpl" />
149
		<property name="deleteData" value="deleteData.tmpl" />
150
		<property name="genericHeader" value="genericHeader.tmpl" />
151
		<property name="genericFooter" value="genericFooter.tmpl" />
152

    
153
		<filter token="scope" value="${scope}" />
154
		<filter token="responseForm" value="${responseForm}" />
155
		<filter token="entryForm" value="${entryForm}" />
156
		<filter token="guide" value="${guide}" />
157
		<filter token="loginForm" value="${loginForm}" />
158
		<filter token="confirmData" value="${confirmData}" />
159
		<filter token="deleteData" value="${deleteData}" />
160
		<filter token="genericHeader" value="${genericHeader}" />
161
		<filter token="genericFooter" value="${genericFooter}" />
162
		<filter token="adminname" value="${adminname}" />
163
		<filter token="recipient" value="${recipient}" />
164
		<filter token="metacatVersion" value="${metacat.version}" />
165
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
166
		<filter token="build.context" value="${metacat.context}" />
167

    
168
		<filter token="docrooturl" value="./" />
169
		<filter token="mcuser" value="${mcuser}" />
170
		<filter token="mcpassword" value="${mcpassword}" />
171
		<filter token="mcanotheruser" value="${mcanotheruser}" />
172
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
173
		<filter token="eml-css" value="${eml-css}" />
174
		<filter token="style-skins-relpath"
175
			value="${style-skins-relpath}" />
176
		<filter token="style-common-relpath"
177
			value="${style-common-relpath}" />
178

    
179
		<filter token="eml-version" value="${eml-version}" />
180
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
181
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
182
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
183
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
184
		<filter token="debugprefix" value="${debugprefix}" />
185

    
186
		<filter token="defaultStage" value="${defaultStage}" />
187
		<filter token="defaultHeader" value="${defaultHeader}" />
188
		<filter token="defaultFooter" value="${defaultFooter}" />
189
		<filter token="defaultChangePass" value="${defaultChangePass}" />
190
		<filter token="defaultResetPass" value="${defaultResetPass}" />
191
		<filter token="changePassSuccess" value="${changePassSuccess}" />
192
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
193
		<filter token="registerFailed" value="${registerFailed}" />
194
		<filter token="registerLter" value="${registerLter}" />
195
		<filter token="registerMatch" value="${registerMatch}" />
196
		<filter token="registerSuccess" value="${registerSuccess}" />
197
		<filter token="register" value="${register}" />
198
		<filter token="searchResults" value="${searchResults}" />
199
		<filter token="ldapMainServerFailure"
200
			value="${ldapMainServerFailure}" />
201
		<filter token="lter-user" value="${lteruser}" />
202
		<filter token="lter-pass" value="${lterpassword}" />
203
		<filter token="pisco-user" value="${piscouser}" />
204
		<filter token="pisco-pass" value="${piscopassword}" />
205

    
206

    
207
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
208
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
209
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
210

    
211
		<property name="srcdir" value="./src" />
212
		<property name="lib.dir" value="./lib" />
213
		<property name="docdir" value="./docs" />
214
		<property name="cgidir" value="./cgi-bin" />
215
		<property name="testdir" value="./test" />
216
		<property name="testtorun" value="BuildIndexTest" />
217
		<property name="junittestsdir"
218
			value="./test/edu/ucsb/nceas/metacattest" />
219
		<property name="junitnettestsdir"
220
			value="./test/edu/ucsb/nceas/metacatnettest" />
221
		<property name="build.dir" value="./build" />
222
		<property name="build.src" value="${build.dir}/src" />
223
		<property name="build.dest" value="${build.dir}/classes" />
224
		<property name="build.samples" value="${build.dir}/samples" />
225
		<property name="build.tests" value="${build.dir}/tests" />
226
		<property name="build.tmp" value="${build.dir}/tmp" />
227
		<property name="build.metacattest"
228
			value="${build.tests}/metacattest" />
229
		<property name="build.metacatnettest"
230
			value="${build.tests}/metacatnettest" />
231
		<property name="build.data" value="${build.dir}/data" />
232
		<property name="build.javadocs" value="${build.dir}/docs/api" />
233
		<property name="build.war" value="${build.dir}/war" />
234
		<property name="dist.dir" value="dist" />
235
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
236
		<property name="ver.src" value="${ver.dir}/src" />
237
		<property name="util.dir" value="${dist.dir}/${util-module}" />
238
		<property name="test.dir" value="${dist.dir}/test" />
239
		<!-- directories for creating a Harvest List Editor distribution -->
240
		<property name="dist.dir.hle" value="disthle" />
241
		<property name="ver.dir.hle"
242
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
243
		<property name="pkg.dir" value="./package" />
244
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
245

    
246
		<property name="ecogrid-target-name" value="metacatImpl" />
247
		<property name="ecogrid-module-dest-dir" value=".." />
248
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
249
		<property name="ecogrid-dist-dir"
250
			value="${dist.dir}/${ecogrid-module}" />
251
		<property name="ecogrid-dir"
252
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
253

    
254
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
255

    
256
		<!-- set up svn -->
257
		<property name="svnant.lib" value="lib" />
258
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
259
		<property name="svnClientAdapter.jar"
260
			value="${svnant.lib}/svnClientAdapter.jar" />
261
		<property name="svnjavahl.jar"
262
			value="${svnant.lib}/svnjavahl.jar" />
263
		<property name="svn.utilitiesUrl"
264
			value="https://code.ecoinformatics.org/code/utilities/tags/${utilities-tag}" />
265
		<property name="svn.ecogridUrl"
266
			value="https://code.ecoinformatics.org/code/seek/trunk/projects/ecogrid/" />
267
		<!--  property name="svn.utilitiesExportPath" value="${knbdir}" / -->
268

    
269
		<!-- load the svn task -->
270
		<path id="svn.classpath">
271
			<pathelement location="${svnjavahl.jar}" />
272
			<pathelement location="${svnant.jar}" />
273
			<pathelement location="${svnClientAdapter.jar}" />
274
		</path>
275
		<taskdef resource="svntask.properties"
276
			classpathref="svn.classpath" />
277

    
278
		<condition property="utilities.required">
279
			<or>
280
				<not>
281
					<available file="lib/httpclient.jar" />
282
				</not>
283
				<not>
284
					<available file="lib/utilities.jar" />
285
				</not>
286
				<not>
287
					<available file="${utilitiesdir}" type="dir" />
288
				</not>
289
			</or>
290
		</condition>
291
		<!-- peer.utilities.required is used when there is no utilities 
292
			directory at ${utilitiesdir} -->
293
		<condition property="peer.utilities.required">
294
			<or>
295
				<not>
296
					<available file="${utilitiesdir}" type="dir" />
297
				</not>
298
			</or>
299
		</condition>
300
		<condition property="eml.required">
301
			<or>
302
				<not>
303
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
304
				</not>
305
				<not>
306
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
307
				</not>
308
				<not>
309
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
310
				</not>
311
				<not>
312
					<available
313
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
314
				</not>
315
			</or>
316
		</condition>
317

    
318
		<condition property="ecogrid.required">
319
			<or>
320
				<not>
321
					<available file="${ecogrid-dir}/build.properties" />
322
				</not>
323
				<not>
324
					<available
325
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
326
				</not>
327
			</or>
328
		</condition>
329

    
330
	</target>
331

    
332
	<target name="prepare" depends="init">
333
		<mkdir dir="${build.dir}" />
334
		<mkdir dir="${build.src}" />
335
		<mkdir dir="${build.dest}" />
336
		<mkdir dir="${build.javadocs}" />
337
		<mkdir dir="${build.tmp}" />
338

    
339
		<copy todir="${build.src}" filtering="yes">
340
			<fileset dir="${srcdir}">
341
				<include name="edu/**" />
342
				<include name="com/**" />
343
				<include name="org/**" />
344
				<!-- include name="java/**" / -->
345
				<include name="**/*.sql" />
346
				<exclude name="**/CVS*" />
347
				<exclude name="**/.#*" />
348
				<exclude name="edu/ucsb/nceas/metacat/workflow/WorkflowJob.java" />
349
				<exclude name="edu/ucsb/nceas/metacat/workflow/WorkflowScheduler.java" />
350
				<exclude name="edu/ucsb/nceas/metacat/workflow/WorkflowSchedulerServlet.java" />
351
			</fileset>
352
		</copy>
353
		<available file="lib/style/common/emlb6toeml2" type="dir"
354
			property="styles.not.needed" />
355
	</target>
356

    
357
	<taskdef resource="axis-tasks.properties"
358
		classpathref="compile.classpath" />
359

    
360
	<target name="generateStubs" depends="prepare">
361
		<echo
362
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
363
		<axis-wsdl2java verbose="true" output="${srcdir}"
364
			url="/tmp/KeplerWebService.wsdl" />
365
	</target>
366

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

    
370
		<javac srcdir="${build.src}" destdir="${build.dest}"
371
			debug="${debug}"
372
			excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
373
			<classpath>
374
				<path refid="compile.classpath" />
375
			</classpath>
376
		</javac>
377
	</target>
378

    
379
	<target name="jar" depends="compile,geteml"
380
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
381

    
382
		<delete file="${build.dir}/${name}.jar" />
383
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
384
			excludes="**/protocols/ **/harvesterClient/" />
385
	</target>
386

    
387
	<target name="protocol" depends="compile"
388
		description="Compiles and jars protocol java code to protocol.jar in build dir">
389
		<delete file="${build.dir}/protocol.jar" />
390
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
391
			includes="**/protocols/" />
392
	</target>
393

    
394
	<target name="utilities" depends="config,getpeerutilities"
395
		if="utilities.required">
396
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
397
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
398
		<copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
399
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
400
	</target>
401

    
402
	<target name="getpeerutilities" depends="prepare"
403
		if="peer.utilities.required"
404
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
405
		<echo message="Exporting utiities files from svn repository:" />
406
		<!-- input message="Please enter svn repo username:" addproperty="svn.username" / -->
407
		<!-- input message="Please enter svn repo password:" addproperty="svn.password" / -->
408
		<!--  svn username="${svn.username}" password="${svn.password}" -->
409
		<svn>
410
			<export srcUrl="${svn.utilitiesUrl}"
411
				destPath="${utilitiesdir}" />
412
		</svn>
413

    
414
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
415
	</target>
416

    
417
	<target name="getutilities" depends="prepare"
418
		description="Checks utility out of svn and copies it to your metacat cvs sandbox">
419
		<echo>Enter CVS password:</echo>
420
		<cvs cvsRoot="${cvsroot}" package="${util-module}"
421
			tag="${utilities-tag}" dest="${build.tmp}" />
422
	</target>
423

    
424
	<target name="client" depends="utilities, prepare"
425
		description="Compiles metacat-client java code to build dir">
426
		<javac srcdir="${build.src}" destdir="${build.dest}"
427
			includes="edu/ucsb/nceas/metacat/client/*">
428
			<classpath>
429
				<path refid="compile.classpath" />
430
			</classpath>
431
		</javac>
432
	</target>
433

    
434
	<target name="clientjar" depends="client"
435
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
436
		<delete file="${build.dir}/${name}-client.jar" />
437
		<jar jarfile="${build.dir}/${name}-client.jar"
438
			basedir="${build.dest}" includes="**/metacat/client/" />
439
	</target>
440

    
441
	<target name="advancedsearchjar" depends="compile"
442
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
443
		<delete file="${build.dir}/advancedsearch.jar" />
444
		<jar jarfile="${build.dir}/advancedsearch.jar"
445
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
446
	</target>
447

    
448
	<target name="harvester" depends="client"
449
		description="Compiles harvester java code to build dir">
450
		<javac srcdir="${build.src}" destdir="${build.dest}"
451
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
452
			<classpath>
453
				<path refid="compile.classpath" />
454
			</classpath>
455
		</javac>
456
	</target>
457

    
458
	<target name="harvesterjar" depends="harvester"
459
		description="Compiles and jars harvester java code to harvester.jar in build dir">
460
		<delete file="${build.dir}/harvester.jar" />
461
		<jar jarfile="${build.dir}/harvester.jar"
462
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
463
	</target>
464

    
465
	<target name="harvestListEditorDist" depends="harvesterjar"
466
		description="Prepares a distribution of the Harvest List Editor tool">
467
		<mkdir dir="${dist.dir.hle}" />
468
		<delete dir="${ver.dir.hle}" />
469
		<mkdir dir="${ver.dir.hle}" />
470
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
471
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
472
		<copy todir="${ver.dir.hle}"
473
			file="lib/harvester/harvestList.xsd" />
474
		<copy todir="${ver.dir.hle}"
475
			file="lib/harvester/harvestListEditor.bat" />
476
		<copy todir="${ver.dir.hle}"
477
			file="lib/harvester/harvestListEditor.sh" />
478
		<delete file="./harvest-list-editor-${release}.zip" />
479
		<zip zipfile="./harvest-list-editor-${release}.zip"
480
			basedir="${ver.dir.hle}" />
481
		<delete file="./harvest-list-editor-${release}.tar.gz" />
482
		<tar tarfile="./harvest-list-editor-${release}.tar"
483
			basedir="${ver.dir.hle}" />
484
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
485
			src="./harvest-list-editor-${release}.tar" />
486
		<delete file="./harvest-list-editor-${release}.tar" />
487
	</target>
488

    
489
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
490
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
491

    
492
	<target name="getemlpre2" depends="prepare" if="eml.required"
493
		description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
494
		<echo>Enter CVS password:</echo>
495
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
496
			tag="${eml-beta-tag}" dest="${build.tmp}/eml_${eml-beta-tag}" />
497
		<mkdir dir="lib/dtd" />
498
		<copy todir="lib/dtd" filtering="yes">
499
			<fileset
500
				dir="${build.tmp}/eml_${eml-beta-tag}/${eml-module}">
501
				<include name="*.dtd" />
502
			</fileset>
503
			<mapper type="glob" from="eml-*.dtd"
504
				to="eml-*-${eml-version}.dtd" />
505
		</copy>
506

    
507
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
508
			<fileset
509
				dir="${build.tmp}/eml_${eml-beta-tag}/${eml-module}/style">
510
				<include name="**/*.xsl" />
511
			</fileset>
512
		</copy>
513
	</target>
514

    
515
	<target name="geteml2+" depends="prepare" if="eml.required"
516
		description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
517
		<echo>Enter CVS password:</echo>
518
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
519
			tag="${eml2_0_0-schema-tag}"
520
			dest="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
521
		<mkdir dir="lib/schema/eml-2.0.0" />
522
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
523
			<fileset
524
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}/${eml-module}">
525
				<include name="*.xsd" />
526
			</fileset>
527

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

    
534
		</copy>
535
		<!-- <antcall target="copyxsl">
536
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
537
			<param name="dirname" value="eml-2.0.0" />
538
			</antcall> -->
539

    
540
		<!-- Checkout eml201 for given schema tag-->
541
		<echo>Enter CVS password:</echo>
542
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
543
			tag="${eml2_0_1-schema-tag}"
544
			dest="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
545
		<mkdir dir="lib/schema/eml-2.0.1" />
546
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
547
			<fileset
548
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}/${eml-module}">
549
				<include name="*.xsd" />
550
			</fileset>
551
		</copy>
552

    
553
		<!-- Checkout eml201 again for given style sheet tag-->
554
		<!-- echo>Enter CVS password: </echo>
555
			<cvs cvsRoot="${cvsroot}"
556
			package="${eml-module}"
557
			tag="${eml2_0_1-style-tag}"
558
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
559
			<antcall target="copyxsl">
560
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
561
			<param name="dirname" value="eml-2.0.1" />
562
			</antcall -->
563

    
564
		<!-- Checkout eml210 for given schema tag-->
565
		<echo>Enter CVS password:</echo>
566
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
567
			tag="${eml2_1_0-schema-tag}"
568
			dest="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
569
		<mkdir dir="lib/schema/eml-2.1.0" />
570
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
571
			<fileset
572
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}/${eml-module}">
573
				<include name="*.xsd" />
574
			</fileset>
575
		</copy>
576

    
577
		<!-- Checkout eml210 for given style sheet tag-->
578
		<echo>Enter CVS password:</echo>
579
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
580
			tag="${eml2-style-tag}" dest="${build.tmp}/eml_${eml2-style-tag}" />
581
		<antcall target="copyxsl">
582
			<param name="cvs.tagname" value="${eml2-style-tag}" />
583
			<!-- param name="dirname" value="eml-2.1.0" / -->
584
			<param name="dirname" value="eml-2" />
585
		</antcall>
586
	</target>
587

    
588
	<target name="copyxsl"
589
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
590

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

    
593
		<copy todir="${style-common-cvsrelpath}/${dirname}"
594
			filtering="yes">
595
			<fileset
596
				dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
597
				<include name="**/*.xsl" />
598
			</fileset>
599
		</copy>
600

    
601

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

    
608
	</target>
609

    
610
	<target name="correctEML201Docs" depends="jar"
611
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
612
		<copy todir="${build.dir}" file="lib/metacat.properties"
613
			filtering="yes" />
614
		<java
615
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
616
			<classpath>
617
				<path refid="compile.classpath" />
618
				<fileset dir="${build.dir}">
619
					<include name="${name}.jar" />
620
				</fileset>
621
			</classpath>
622
		</java>
623
	</target>
624

    
625
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
626
		description="Installs spatial option for metacat">
627

    
628
		<property name="spatial.dir" value="./lib/spatial" />
629
		<property name="spatial.geoserver.dir"
630
			value="${spatial.dir}/geoserver" />
631
		<property name="spatial.webinf-mods"
632
			value="${spatial.dir}/WEB-INF" />
633

    
634
		<!-- Copy geoserver libs into ${war.lib} -->
635
		<copy todir="${war.lib}" filtering="no">
636
			<fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
637
				<include name="**" />
638
			</fileset>
639
		</copy>
640

    
641
		<!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
642
		<copy todir="${war.webinf}" filtering="no">
643
			<fileset dir="${spatial.geoserver.dir}/WEB-INF">
644
				<exclude name="lib/**" />
645
				<exclude name="web.xml" />
646
			</fileset>
647
		</copy>
648

    
649
		<!-- Copy the rest of the geoserver codebase into ${war.context} -->
650
		<copy todir="${war.context}" filtering="no">
651
			<fileset dir="${spatial.geoserver.dir}">
652
				<exclude name="WEB-INF/**" />
653
				<exclude name="index.jsp" />
654
			</fileset>
655
		</copy>
656

    
657
		<!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
658
		<copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
659
			tofile="${war.context}/geoserver.jsp" overwrite="true"
660
			filtering="no" />
661

    
662
		<!-- Copy the rest of the modified geoserver web-inf files
663
			<copy todir="${war.webinf}" filtering="no">
664
			<fileset dir="${spatial.webinf-mods}">
665
			<exclude name="web.xml.combined"/>
666
			</fileset>
667
			</copy> -->
668

    
669
	</target>
670

    
671
	<target name="install" depends="build-metacat"
672
		description="* Full Install For Development *">
673
		<copy file="${dist.dir}/${metacat.context}.war"
674
			todir="${app.deploy.dir}" />
675
		<delete dir="${app.deploy.dir}/${metacat.context}" />
676
		<tstamp>
677
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
678
		</tstamp>
679
		<echo>Dev install completed at ${NOW}</echo>
680
	</target>
681

    
682
	<target name="build-metacat" depends="install-ecogrid"
683
		description="Build Metacat">
684
	</target>
685

    
686
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
687
		if="enable.ecogrid" description="Install Ecogrid Compentent">
688
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
689
			inheritall="false">
690
			<property name="context" value="${metacat.context}" />
691
			<property name="target" value="${ecogrid-target-name}" />
692
			<!-- property name="metacat.dir" value="."/ -->
693
		</ant>
694
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
695
			inheritall="false">
696
			<property name="context" value="${metacat.context}" />
697
			<property name="target" value="${ecogrid-target-name}" />
698
			<!-- property name="metacat.dir" value="."/ -->
699
		</ant>
700
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
701
			<webinf dir="${ecogrid-dir}/lib">
702
			<include name="server-config.wsdd"/>
703
			</webinf>
704
			</war -->
705
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
706
			todir="${dist.dir}" overwrite="true" />
707

    
708

    
709
	</target>
710

    
711
	<target name="get-ecogrid" depends="init"
712
		description="Check out ecogrid module" if="ecogrid.required">
713
		<svn>
714
			<export srcUrl="${svn.ecogridUrl}"
715
				destPath="${ecogrid-dir}" />
716
		</svn>
717
	</target>
718

    
719
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
720
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
721
		<property name="context" value="${metacat.context}"/>
722
		<property name="target" value="${ecogrid-target-name}"/>
723
		<property name="metacat.dir" value="."/>
724
		<property name="hostname" value="${ecogrid.hostname}"/>
725
		<property name="port" value="${config.port}"/>
726
		</ant>
727
		</target -->
728

    
729
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
730
		description="Automately generate wsdd for ecogrid service">
731
		<delete
732
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
733
	</target>
734

    
735
	<!-- target name="install-registry" depends="init,getConversionXSL"
736
		description="Install Registry">
737
		
738
		<mkdir dir="${inst.cgi.dir}" />
739
		<copy file="${srcdir}/perl/register-dataset.cgi"
740
		todir="${inst.cgi.dir}"/>
741
		<chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
742
		
743
		<! - - TODO SCW: set the permissions on this folder to be writable by the apache user - - >
744
		<mkdir dir="${temp-dir}" />
745
		<! - - TODO SCW: use relative paths to grab these instead of copying to tmp,
746
		used in readDocumentFromMetacat - - >
747
		<copy todir="${temp-dir}" filtering="yes">
748
		<fileset dir="lib/style/common/emlb6toeml2">
749
		<include name="*.xsl"/>
750
		<include name="*.xml"/>
751
		</fileset>
752
		</copy>
753
		
754
		<echo message="Install Registry completed." />
755
		</target -->
756

    
757
	<!-- target name="install-ldap" depends="init"
758
		description="Install Metacat LDAP Access">
759
		
760
		<mkdir dir="${inst.cgi.dir}" />
761
		<copy file="${srcdir}/perl/ldapweb.cgi"
762
		todir="${inst.cgi.dir}" />
763
		<chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
764
		<mkdir dir="${templates.dir}" />
765
		<copy todir="${templates.dir}">
766
		<fileset dir="lib/style/common/templates">
767
		< ! - - SCW: Copy all files - - >
768
		</fileset>
769
		</copy>
770
		<echo message="ldapweb install complete." />
771
		</target -->
772

    
773

    
774
	<target name="install-skin" depends="init"
775
		description="Install a Skin">
776

    
777
		<input message="Please enter name of the skin"
778
			addproperty="skin-name" />
779

    
780
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
781
		<copy todir="${installdir}/style/skins/${skin-name}"
782
			filtering="yes">
783
			<fileset dir="lib/style/skins/${skin-name}">
784
				<exclude name="**/*.png" />
785
				<exclude name="**/*.gif" />
786
				<exclude name="**/*.jpg" />
787
				<exclude name="**/CVS*" />
788
				<exclude name="**/.#*" />
789
			</fileset>
790
		</copy>
791
		<copy todir="${installdir}/style/skins/${skin-name}"
792
			filtering="no">
793
			<fileset dir="lib/style/skins/${skin-name}">
794
				<include name="**/*.png" />
795
				<include name="**/*.gif" />
796
				<include name="**/*.jpg" />
797
				<exclude name="**/CVS*" />
798
				<exclude name="**/.#*" />
799
			</fileset>
800
		</copy>
801
		<copy todir="${installdir}/style/common" filtering="yes">
802
			<fileset dir="lib/style/common">
803
				<include name="*.js" />
804
				<include name="*.jsp" />
805
				<include name="*.css" />
806
				<exclude name="*.png" />
807
				<exclude name="*.gif" />
808
				<exclude name="*.jpg" />
809
				<exclude name="**/CVS*" />
810
				<exclude name="**/.#*" />
811
			</fileset>
812
		</copy>
813
		<!--
814
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
815
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
816
			<fileset dir="lib/style/skins/${skin-name}/images">
817
			<include name="*.png"/>
818
			<include name="*.gif"/>
819
			<include name="*.jpg"/>
820
			</fileset>
821
			</copy>
822
		-->
823

    
824
		<echo message="Install Skin completed." />
825
	</target>
826

    
827
	<target name="war" depends="warPrepare,install-spatial"
828
		description="Create a web archive (WAR) for servlet deployment">
829
		<mkdir dir="${dist.dir}" />
830
		<war destfile="${dist.dir}/${metacat.context}.war"
831
			webxml="${build.war}/web.xml">
832
			<fileset dir="${war.context}" />
833
			<lib dir="${war.lib}" />
834
			<webinf dir="${war.webinf}" />
835
		</war>
836
	</target>
837

    
838
	<target name="warPrepare"
839
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
840
		description="Prepare files for creating a web archive (WAR)">
841

    
842
		<property name="war.lib" value="${build.war}/lib" />
843
		<property name="war.webinf" value="${build.war}/WEB-INF" />
844
		<property name="war.context"
845
			value="${build.war}/${metacat.context}" />
846
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
847
		<property name="war.webinf.scripts"
848
			value="${war.webinf}/scripts" />
849
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
850
		<property name="war.context.docs" value="${war.context}/docs" />
851
		<property name="war.context.temp" value="${war.context}/temp" />
852
		<property name="war.context.templates"
853
			value="${war.context}${style-common-relpath}/templates" />
854
		<mkdir dir="${war.lib}" />
855
		<mkdir dir="${war.webinf}" />
856
		<mkdir dir="${war.context}" />
857
		<mkdir dir="${war.webinf.sql}" />
858
		<mkdir dir="${war.context.cgi}" />
859
		<mkdir dir="${war.context.docs}" />
860
		<mkdir dir="${war.context.temp}" />
861
		<mkdir dir="${war.context.templates}" />
862

    
863
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
864
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
865
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
866
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
867
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
868
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
869
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
870
		<copy todir="${war.lib}" filtering="no">
871
			<fileset dir="lib">
872
				<!--
873
					<not>
874
					<filename name="${jdbc-jar-name}"/>
875
					</not>
876
				-->
877
				<include name="*.jar" />
878
			</fileset>
879
			<fileset dir="lib">
880
				<include name="xalan.jar" />
881
				<include name="gwt*.jar" />
882
			</fileset>
883
			<fileset dir="lib/oaipmh">
884
				<include name="oaicat.jar" />
885
			</fileset>
886
		</copy>
887
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
888
			tofile="${build.war}/web.xml" / -->
889
		<!-- MCD added next - Remove the tomcat5 reference-->
890
		<copy file="lib/web.xml.tomcat5" tofile="${build.war}/web.xml" />
891
		<copy file="lib/metacat.properties" todir="${war.webinf}"
892
			filtering="yes" />
893
		<copy file="lib/metacat.properties.metadata.xml"
894
			todir="${war.webinf}" filtering="no" />
895
		<copy file="lib/org.properties.metadata.xml"
896
			todir="${war.webinf}" filtering="no" />
897
		<copy file="lib/auth.properties.metadata.xml"
898
			todir="${war.webinf}" filtering="no" />
899
		<copy todir="${war.webinf}" filtering="yes">
900
			<fileset dir="lib">
901
				<include name="skin.configs/**" />
902
			</fileset>
903
		</copy>
904
		<copy file="lib/log4j.properties" todir="${war.webinf}"
905
			filtering="yes" />
906
		<copy todir="${war.context}" filtering="no">
907
			<fileset dir="lib">
908
				<include name="**/*.jpg" />
909
				<include name="**/*.png" />
910
				<include name="**/*.gif" />
911
				<include name="LiveMap_30/**" />
912
				<include name="oaipmh/**" />
913
			</fileset>
914
		</copy>
915
		<copy todir="${war.context}" filtering="yes">
916
			<fileset dir="lib">
917
				<exclude name="*.jar" />
918
				<exclude name="*.properties" />
919
				<exclude name="*.metadata.xml" />
920
				<exclude name="web.xml" />
921
				<exclude name="**/*.jpg" />
922
				<exclude name="**/*.png" />
923
				<exclude name="**/*.gif" />
924
				<exclude name="lsid_lib/**" />
925
				<exclude name="lsid_conf/**" />
926
				<exclude name="LiveMap_30/**" />
927
				<exclude name="oaipmh/**" />
928
				<exclude name="skin.configs/**" />
929
				<exclude name="spatial/geoserver/**" />
930
				<exclude name="spatial/WEB-INF/**" />
931
			</fileset>
932
		</copy>
933
		<copy todir="${war.context.docs}" filtering="yes">
934
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
935
		</copy>
936
		<copy todir="${war.context.docs}" filtering="no">
937
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
938
		</copy>
939
		<copy todir="${war.webinf.sql}" filtering="yes">
940
			<fileset dir="src">
941
				<include name="**/*.sql" />
942
			</fileset>
943
		</copy>
944
		<copy todir="${war.webinf.scripts}" filtering="yes">
945
			<fileset dir="src/scripts" />
946
		</copy>
947
		<copy todir="${war.webinf.scripts}"
948
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
949
			failonerror="false" />
950

    
951
		<copy file="src/perl/register-dataset.cgi"
952
			todir="${war.context.cgi}" />
953
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
954
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
955

    
956
		<!-- registry cgi section -->
957
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
958
			used in readDocumentFromMetacat -->
959
		<!-- TODO MCD copy temp files to actual location using config util?? -->
960
		<copy todir="${war.context.temp}" filtering="yes">
961
			<fileset dir="lib/style/common/emlb6toeml2">
962
				<include name="*.xsl" />
963
				<include name="*.xml" />
964
			</fileset>
965
		</copy>
966
		<available file="lib/style/common/emlb6toeml2" type="dir"
967
			property="styles.not.needed" />
968

    
969
		<!-- ldap cgi section -->
970
		<copy todir="${war.context.templates}">
971
			<fileset dir="lib/style/common/templates">
972
				<!-- SCW: Copy all files -->
973
			</fileset>
974
		</copy>
975
	</target>
976

    
977
	<target name="cgiPrepare" if="build.perl">
978
		<exec dir="src/perl/Metacat/" executable="make">
979
			<arg value="clean" />
980
		</exec>
981
		<exec dir="src/perl/Metacat/" executable="perl">
982
			<arg value="Makefile.PL" />
983
		</exec>
984
		<exec dir="src/perl/Metacat/" executable="make" />
985
	</target>
986

    
987
	<target name="testPrepare"
988
		description="Copies test files into the war directories">
989
		<echo>in testPrepare</echo>
990
		<property name="war.context.test"
991
			value="${build.war}/${metacat.context}/test" />
992
		<mkdir dir="${war.context.test}" />
993
		<copy todir="${war.context.test}" filtering="yes">
994
			<fileset dir="test/servertestfiles">
995
				<include name="*/**" />
996
			</fileset>
997
		</copy>
998
	</target>
999

    
1000
	<target name="getConversionXSL" depends="prepare"
1001
		unless="styles.not.needed"
1002
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1003

    
1004
		<echo>Enter CVS password:</echo>
1005
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
1006
			tag="${eml2-style-tag}" dest="${build.tmp}/eml_${eml2-style-tag}" />
1007

    
1008
		<mkdir dir="lib/style/common/emlb6toeml2" />
1009
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1010
			<fileset
1011
				dir="${build.tmp}/eml_${eml2-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
1012
				<include name="*.xsl" />
1013
				<include name="*.xml" />
1014
			</fileset>
1015
		</copy>
1016
	</target>
1017

    
1018
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1019
		<mkdir dir="${build.tests}" />
1020
		<copy todir="${build.tests}" filtering="yes">
1021
			<fileset dir="${testdir}">
1022
				<include name="edu/**" />
1023
			</fileset>
1024
		</copy>
1025
		<copy todir="${build.tests}" file="${testdir}/test.properties"
1026
			filtering="yes" />
1027

    
1028
		<!-- copy and compile the tests into a jar file -->
1029
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1030
			debug="on" includes="**/*.java">
1031
			<classpath>
1032
				<path refid="compile.classpath" />
1033
				<fileset dir="${build.dir}">
1034
					<include name="${name}.jar" />
1035
					<include name="${name}-client.jar" />
1036
					<include name="harvester.jar" />
1037
				</fileset>
1038
			</classpath>
1039
		</javac>
1040

    
1041
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1042
			basedir="${build.tests}" includes="**/*.class" />
1043
	</target>
1044

    
1045
	<target name="test" depends="testprep"
1046
		description="Uses the ant junit task to run all JUnit tests">
1047

    
1048
		<!-- use the ant "junit" task to run JUnit tests. -->
1049
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1050
			haltonerror="no">
1051
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1052
			<classpath>
1053
				<path refid="compile.classpath" />
1054
				<fileset dir="${build.dir}">
1055
					<include name="${name}.jar" />
1056
					<include name="${name}-client.jar" />
1057
					<include name="harvester.jar" />
1058
					<include name="${name}-junittests.jar" />
1059
				</fileset>
1060
			</classpath>
1061

    
1062
			<formatter type="plain" />
1063

    
1064
			<batchtest fork="yes" todir="${build.dir}">
1065
				<fileset dir="${build.tests}">
1066
					<include name="**/*.class" />
1067
					<exclude name="**/MCTestCase.class" />
1068
					<exclude name="**/ClientViewHelperTest.class" />
1069
				</fileset>
1070
			</batchtest>
1071
		</junit>
1072
	</target>
1073

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

    
1077
		<echo>testtorun: ${testtorun}</echo>
1078

    
1079
		<!-- use the ant "junit" task to run JUnit tests. -->
1080
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1081
			haltonerror="no" showoutput="yes">
1082
			<!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1083
			<classpath>
1084
				<path refid="compile.classpath" />
1085
				<fileset dir="${build.dir}">
1086
					<include name="${name}.jar" />
1087
					<include name="${name}-client.jar" />
1088
					<include name="harvester.jar" />
1089
					<include name="${name}-junittests.jar" />
1090
				</fileset>
1091
			</classpath>
1092

    
1093
			<formatter type="plain" />
1094

    
1095
			<batchtest fork="yes" todir="${build.dir}">
1096
				<fileset dir="${build.tests}">
1097
					<include name="**/${testtorun}.class" />
1098
				</fileset>
1099
			</batchtest>
1100
		</junit>
1101
	</target>
1102

    
1103
	<target name="testharvester" depends="testprep"
1104
		description="Uses the ant junit task to test only the Harvester code">
1105
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1106
			haltonerror="off">
1107
			<classpath>
1108
				<path refid="compile.classpath" />
1109
				<fileset dir="${build.dir}">
1110
					<include name="${name}.jar" />
1111
					<include name="${name}-client.jar" />
1112
					<include name="harvester.jar" />
1113
					<include name="${name}-junittests.jar" />
1114
				</fileset>
1115
			</classpath>
1116
			<formatter type="plain" />
1117
			<batchtest fork="yes" todir="${build.dir}">
1118
				<fileset dir="${build.tests}">
1119
					<include name="**/harvesterClient/*.class" />
1120
				</fileset>
1121
			</batchtest>
1122
		</junit>
1123
	</target>
1124

    
1125
	<target name="gethttpclient" depends="prepare"
1126
		description="checks out and compiles morpho httpclient code">
1127
		<!--mkdir dir="${morphosourcedir}" -->
1128
		<cvs cvsRoot="${cvsroot}" package="morpho" dest="." />
1129
		<ant dir="${morphosourcedir}" inheritAll="false" target="jar" />
1130
	</target>
1131

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

    
1136
		<echo>
1137
			*********************************** Please run ant
1138
			gethttpclient first! ***********************************
1139
		</echo>
1140
		<!-- copy and compile the tests into a jar file -->
1141
		<mkdir dir="${build.metacatnettest}" />
1142
		<javac srcdir="${junitnettestsdir}"
1143
			destdir="${build.metacatnettest}" includes="**/*.java">
1144
			<classpath>
1145
				<path refid="compile.classpath" />
1146
				<fileset dir="${build.dir}">
1147
					<include name="${name}.jar" />
1148
				</fileset>
1149
			</classpath>
1150
		</javac>
1151

    
1152
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1153
			basedir="${build.metacatnettest}" includes="**/*.class" />
1154

    
1155
		<!-- use the ant "junit" task to run JUnit tests. -->
1156
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1157
			haltonerror="no">
1158
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1159
			<classpath>
1160
				<path refid="compile.classpath" />
1161
				<fileset dir="${build.dir}">
1162
					<include name="${name}.jar" />
1163
					<include name="${name}-junitnettests.jar" />
1164
				</fileset>
1165
			</classpath>
1166

    
1167
			<formatter type="plain" />
1168

    
1169
			<batchtest fork="yes" todir="${build.dir}">
1170
				<fileset dir="${build.metacatnettest}">
1171
					<include name="**/*.class" />
1172
				</fileset>
1173
			</batchtest>
1174
		</junit>
1175
	</target>
1176

    
1177
	<target name="cleanweb" depends="clean"
1178
		description="deletes tomcat web context dir and all its contents">
1179
		<delete dir="${installdir}" />
1180
	</target>
1181

    
1182

    
1183
	<target name="clean" depends="init"
1184
		description="deletes build dir and files that can be regenerated form the release">
1185
		<delete dir="${build.dir}" />
1186
		<delete dir="${dist.dir}" />
1187
	</target>
1188

    
1189
	<target name="localclean" depends="clean"
1190
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1191
		<delete file="lib/httpclient.jar" />
1192
		<delete file="lib/utilities.jar" />
1193
	</target>
1194

    
1195
	<target name="fullclean" depends="localclean"
1196
		description="deletes code and eml">
1197
		<delete includeEmptyDirs="true" failonerror="false">
1198
			<fileset dir="${style-common-cvsrelpath}">
1199
				<include name="${eml-css}" />
1200
				<include name="eml-*/*.xsl" />
1201
				<include name="eml-*" />
1202
			</fileset>
1203
			<fileset dir="${schema-cvsrelpath}">
1204
				<include name="eml-*/*.xsd" />
1205
			</fileset>
1206
			<fileset dir="${ecogrid-dir}">
1207
				<include name="build.properties" />
1208
				<include name="buildfiles/metacatImpl.xml" />
1209
			</fileset>
1210
		</delete>
1211
	</target>
1212

    
1213
	<target name="jdoc" depends="prepare"
1214
		description="generates javadoc documentation">
1215
		<javadoc packagenames="edu.ucsb.nceas.*"
1216
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1217
			version="true" use="true" windowtitle="${Name} API"
1218
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1219
			bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1220
			<classpath>
1221
				<path refid="compile.classpath" />
1222
			</classpath>
1223
		</javadoc>
1224
	</target>
1225

    
1226
	<target name="dist"
1227
		depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1228
		description="prepares a full release distribution">
1229
		<mkdir dir="${dist.dir}" />
1230
		<delete dir="${ver.dir}" />
1231
		<mkdir dir="${ver.dir}" />
1232
		<copy todir="${ver.dir}">
1233
			<fileset dir="."
1234
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1235
		</copy>
1236
		<copy todir="${ver.dir}" file="build.xml" />
1237
		<copy todir="${ver.dir}" file="build.properties" />
1238

    
1239
		<copy todir="${ver.dir}/docs" filtering="yes">
1240
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1241
		</copy>
1242
		<copy todir="${ver.dir}/docs" filtering="no">
1243
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1244
		</copy>
1245
		<copy todir="${ver.dir}/docs/dev">
1246
			<fileset dir="${build.dir}/docs" />
1247
		</copy>
1248
		<copy todir="${ver.dir}/src">
1249
			<fileset dir="${build.dir}/src" />
1250
		</copy>
1251

    
1252
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1253
		<copy todir="${ver.dir}/test/servertestfiles">
1254
			<fileset dir="./test/servertestfiles" />
1255
		</copy>
1256
	</target>
1257

    
1258
	<target name="distbin" depends="build-metacat,war-lsid"
1259
		description="prepares a binary distribution">
1260
		<copy todir="${dist.dir}">
1261
			<fileset dir="./src/scripts" />
1262
		</copy>
1263
		<delete file="./${name}-bin-${release}.zip" />
1264
		<zip zipfile="./${name}-bin-${release}.zip"
1265
			basedir="${dist.dir}" excludes="metacat-*/**" />
1266
		<delete file="./${name}-bin-${release}.tar.gz" />
1267
		<tar tarfile="./${name}-bin-${release}.tar"
1268
			basedir="${dist.dir}" excludes="metacat-*/**" />
1269
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1270
			src="./${name}-bin-${release}.tar" />
1271
		<delete file="./${name}-bin-${release}.tar" />
1272
	</target>
1273

    
1274
	<target name="distsrc" depends="dist"
1275
		description="prepares a source distribution">
1276
		<mkdir dir="${ver.src}" />
1277
		<copy todir="${ver.src}">
1278
			<fileset dir="./src" />
1279
		</copy>
1280
		<mkdir dir="${util.dir}" />
1281
		<copy todir="${util.dir}">
1282
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1283
		</copy>
1284

    
1285
		<mkdir dir="${ecogrid-dist-dir}" />
1286
		<copy todir="${ecogrid-dist-dir}">
1287
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1288
		</copy>
1289

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

    
1292
		<delete file="./${name}-src-${release}.zip" />
1293
		<zip zipfile="./${name}-src-${release}.zip"
1294
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1295
		<delete file="./${name}-src-${release}.tar.gz" />
1296
		<tar tarfile="./${name}-src-${release}.tar"
1297
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1298
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1299
			src="./${name}-src-${release}.tar" />
1300
		<delete file="./${name}-src-${release}.tar" />
1301
		<!--delete dir="${dist.dir}"/ -->
1302
	</target>
1303

    
1304
	<target name="deb-package" depends="distbin"
1305
		description="create a debian installation package">
1306
		<delete dir="${deb.pkg.dir}" />
1307
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1308
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1309
			<fileset dir="./src/scripts/debian"
1310
				includes="control postinst" />
1311
		</copy>
1312

    
1313
		<mkdir
1314
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1315
		<copy
1316
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1317
			filtering="yes">
1318
			<fileset dir="./src/scripts/debian"
1319
				excludes="control postinst" />
1320
		</copy>
1321
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1322

    
1323
		<copy file="${dist.dir}/knb.war"
1324
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1325
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1326
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1327

    
1328
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1329
			failonerror="true">
1330
			<arg line="--build debian" />
1331
		</exec>
1332

    
1333
		<move file="${pkg.dir}/debian.deb"
1334
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1335
	</target>
1336

    
1337
	<target name="stylesheettest">
1338
		<xslt in="${input}" out="eml.html"
1339
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1340
			<param name="displaymodule" expression="${displaymodule}" />
1341
			<param name="docid" expression="${input}" />
1342
			<param name="entitytype" expression="${entitytype}" />
1343
			<param name="entityindex" expression="${entityindex}" />
1344
			<outputproperty name="method" value="html" />
1345
			<outputproperty name="standalone" value="yes" />
1346
			<outputproperty name="encoding" value="iso8859_1" />
1347
			<outputproperty name="indent" value="yes" />
1348
		</xslt>
1349
	</target>
1350

    
1351

    
1352
	<target name="compilewebclient" depends="prepare">
1353
		<javac srcdir="${build.src}" destdir="${build.dest}"
1354
			includes="**/application/*.java" classpathref="webservicepath" />
1355
	</target>
1356

    
1357
	<target name="runwebclient" depends="compilewebclient">
1358
		<java
1359
			classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1360
			dir="${build.dest}" fork="yes" classpathref="webservicepath"
1361
			classpath="./lib/utilities.jar" failonerror="true">
1362
			<arg value="${serviceUrl}" />
1363
			<arg value="${docid}" />
1364
		</java>
1365
	</target>
1366

    
1367
	<target name="spatial_option" depends="prepare"
1368
		description=" -- compiles code for the spatial option">
1369

    
1370
		<echo message="Compiling the metatcat shapefile creator" />
1371
		<echo message="using the shapelib at: ${shapelib.dir}" />
1372
		<exec dir="." executable="g++" os="Linux, Unix"
1373
			failonerror="true">
1374
			<arg
1375
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1376
		</exec>
1377

    
1378
		<exec dir="." executable="g++" os="Linux, Unix"
1379
			failonerror="true">
1380
			<arg
1381
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1382
		</exec>
1383
	</target>
1384

    
1385
	<!-- LSID Authority support -->
1386
	<patternset id="lsid.jars">
1387
		<include name="axis.jar" />
1388
		<include name="commons-discovery-0.2.jar" />
1389
		<include name="jaxrpc.jar" />
1390
		<include name="lsid-client-1.1.1.jar" />
1391
		<include name="lsid-server-1.1.1.jar" />
1392
		<include name="saaj.jar" />
1393
		<include name="wsdl4j-1.5.1.jar" />
1394
		<include name="activation.jar" />
1395
		<include name="castor-0.9.5.jar" />
1396
		<include name="dnsjava-1.3.2.jar" />
1397
		<include name="mail.jar" />
1398
		<include name="commons-logging-1.0.4.jar" />
1399
		<!-- These jars may be needed but seem to not actually be,
1400
			so leaving them out for now
1401
			<include name="axis-ant.jar" />
1402
		-->
1403
		<!--<include name="GenCastor.class" />-->
1404
	</patternset>
1405
	<patternset id="lib.jars">
1406
		<include name="httpclient.jar" />
1407
		<include name="log4j-1.2.12.jar" />
1408
		<include name="utilities.jar" />
1409
		<include name="xercesImpl.jar" />
1410
		<include name="xalan.jar" />
1411
		<include name="xml-apis.jar" />
1412
	</patternset>
1413

    
1414
	<path id="lsid.classpath">
1415
		<fileset dir="${lsid.lib.dir}">
1416
			<patternset refid="lsid.jars" />
1417
		</fileset>
1418
		<fileset dir="${lib.dir}">
1419
			<patternset refid="lsid.jars" />
1420
		</fileset>
1421
		<fileset dir="${lib.dir}">
1422
			<include name="xalan.jar" />
1423
			<include name="xml-apis.jar" />
1424
		</fileset>
1425
		<fileset dir="${build.dir}">
1426
			<include name="metacat-client.jar" />
1427
		</fileset>
1428
	</path>
1429

    
1430
	<filterset id="configFilters">
1431
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1432
			value="${config.hostname}" / -->
1433
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1434
			value="${config.port}" / -->
1435
		<!-- MCD BYE filter token="METADATA_LABELS"
1436
			value="${config.metadataLabelLsid}" / -->
1437
		<!-- MCD BYE filter token="METACAT_SERVER"
1438
			value="${config.metacatserver}" / -->
1439
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1440
			value="${config.lsidauthority}" / -->
1441
	</filterset>
1442

    
1443
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1444
		description="Configure files prior to compilation">
1445
		<mkdir dir="${lsid.build.dir}" />
1446
		<!-- Copy the properties file into the build -->
1447
		<copy file="${conf.dir}/metacat-lsid.properties"
1448
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1449
			overwrite="true">
1450
			<filterset refid="configFilters" />
1451
		</copy>
1452
		<copy file="${conf.dir}/log4j.properties"
1453
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1454
			overwrite="true">
1455
			<filterset refid="configFilters" />
1456
		</copy>
1457
		<!-- Copy config files into the build -->
1458
		<copy todir="${lsid.build.dir}/WEB-INF">
1459
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1460
		</copy>
1461
		<!-- Copy the metadata configuration files into the build -->
1462
		<mkdir
1463
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1464
		<copy
1465
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1466
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1467
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1468
			<filterset refid="configFilters" />
1469
		</copy>
1470
		<!-- Copy services files into the build -->
1471
		<mkdir dir="${lsid.build.dir}/services" />
1472
		<copy todir="${lsid.build.dir}/services">
1473
			<fileset dir="${services.dir}" />
1474
			<filterset refid="configFilters" />
1475
		</copy>
1476
		<!-- Copy axis files into the build -->
1477
		<mkdir dir="${lsid.build.dir}" />
1478
		<copy todir="${lsid.build.dir}">
1479
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1480
		</copy>
1481
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1482
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1483
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1484
		</copy>
1485
	</target>
1486

    
1487
	<target name="compile-lsid" depends="prepare-lsid"
1488
		description="Compile Java sources">
1489
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1490
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1491
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1492
			deprecation="${compile.deprecation}"
1493
			optimize="${compile.optimize}">
1494
			<classpath refid="lsid.classpath" />
1495
		</javac>
1496
	</target>
1497

    
1498
	<target name="war-lsid" depends="compile-lsid"
1499
		description="Create a war file for the application">
1500
		<mkdir dir="${dist.dir}" />
1501
		<war destfile="${dist.dir}/${authority.context}.war"
1502
			webxml="${webinf.dir}/web.xml">
1503
			<fileset dir="${lsid.build.dir}" />
1504
			<lib dir="${lsid.lib.dir}">
1505
				<patternset refid="lsid.jars" />
1506
			</lib>
1507
			<lib dir="${lib.dir}">
1508
				<patternset refid="lib.jars" />
1509
			</lib>
1510
			<lib dir="${lib.dir}">
1511
				<include name="xalan.jar" />
1512
				<include name="xml-apis.jar" />
1513
			</lib>
1514
			<lib dir="${build.dir}">
1515
				<include name="metacat-client.jar" />
1516
			</lib>
1517
		</war>
1518
	</target>
1519

    
1520
	<target name="deploy-lsid" depends="war-lsid"
1521
		description="Deploy LSID war to servlet container">
1522
		<delete dir="${app.deploy.dir}/${authority.context}" />
1523
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1524
		<mkdir dir="${app.deploy.dir}" />
1525
		<copy todir="${app.deploy.dir}">
1526
			<fileset dir="${dist.dir}" />
1527
		</copy>
1528
	</target>
1529
</project>
(5-5/6)