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-10-02 13:12:13 -0700 (Fri, 02 Oct 2009) $'
11
	*    '$Revision: 5073 $'
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="/tags/UTILITIES_1_0_1_RC2" / -->
118
		<property name="utilities-tag" value="trunk" />
119
		<property name="eml-module" value="eml" />
120
		<property name="eml-version" value="2.0.0beta6" />
121
		<property name="eml-beta-tag"
122
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
123
		<property name="eml2_0_0-schema-tag"
124
			value="RELEASE_EML_2_0_0_UPDATE_1" />
125
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
126
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
127
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_0_9_0" />
128
		<property name="eml2_0_0namespace"
129
			value="eml://ecoinformatics.org/eml-2.0.0" />
130
		<property name="eml2_0_1namespace"
131
			value="eml://ecoinformatics.org/eml-2.0.1" />
132
		<property name="eml2_1_0namespace"
133
			value="eml://ecoinformatics.org/eml-2.1.0" />
134
		<property name="stmmlnamespace"
135
			value="http://www.xml-cml.org/schema/stmml" />
136
		<property name="eml-css" value="eml_xsl.css" />
137
		<property name="eml-module.default.css" value="default.css" />
138
		<property name="systemidserver" value="" />
139
		<property name="html-path" value="" />
140

    
141

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

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

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

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

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

    
207

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

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

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

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

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

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

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

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

    
331
	</target>
332

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

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

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

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

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

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

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

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

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

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

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

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

    
416
	<target name="getutilities" depends="prepare"
417
		description="Checks utility out of svn and copies it to your metacat cvs sandbox">
418
		<svn>
419
			<export srcUrl="${svn.utilitiesUrl}"
420
				destPath="${utilitiesdir}" />
421
		</svn>
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-skin" depends="init"
736
		description="Install a Skin">
737

    
738
		<input message="Please enter name of the skin"
739
			addproperty="skin-name" />
740

    
741
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
742
		<copy todir="${installdir}/style/skins/${skin-name}"
743
			filtering="yes">
744
			<fileset dir="lib/style/skins/${skin-name}">
745
				<exclude name="**/*.png" />
746
				<exclude name="**/*.gif" />
747
				<exclude name="**/*.jpg" />
748
				<exclude name="**/CVS*" />
749
				<exclude name="**/.#*" />
750
			</fileset>
751
		</copy>
752
		<copy todir="${installdir}/style/skins/${skin-name}"
753
			filtering="no">
754
			<fileset dir="lib/style/skins/${skin-name}">
755
				<include name="**/*.png" />
756
				<include name="**/*.gif" />
757
				<include name="**/*.jpg" />
758
				<exclude name="**/CVS*" />
759
				<exclude name="**/.#*" />
760
			</fileset>
761
		</copy>
762
		<copy todir="${installdir}/style/common" filtering="yes">
763
			<fileset dir="lib/style/common">
764
				<include name="*.js" />
765
				<include name="*.jsp" />
766
				<include name="*.css" />
767
				<exclude name="*.png" />
768
				<exclude name="*.gif" />
769
				<exclude name="*.jpg" />
770
				<exclude name="**/CVS*" />
771
				<exclude name="**/.#*" />
772
			</fileset>
773
		</copy>
774
		<!--
775
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
776
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
777
			<fileset dir="lib/style/skins/${skin-name}/images">
778
			<include name="*.png"/>
779
			<include name="*.gif"/>
780
			<include name="*.jpg"/>
781
			</fileset>
782
			</copy>
783
		-->
784

    
785
		<echo message="Install Skin completed." />
786
	</target>
787

    
788
	<target name="war" depends="warPrepare,install-spatial"
789
		description="Create a web archive (WAR) for servlet deployment">
790
		<mkdir dir="${dist.dir}" />
791
		<war destfile="${dist.dir}/${metacat.context}.war"
792
			webxml="${build.war}/web.xml">
793
			<fileset dir="${war.context}" />
794
			<lib dir="${war.lib}" />
795
			<webinf dir="${war.webinf}" />
796
		</war>
797
	</target>
798

    
799
	<target name="warPrepare"
800
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
801
		description="Prepare files for creating a web archive (WAR)">
802

    
803
		<property name="war.lib" value="${build.war}/lib" />
804
		<property name="war.webinf" value="${build.war}/WEB-INF" />
805
		<property name="war.context"
806
			value="${build.war}/${metacat.context}" />
807
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
808
		<property name="war.webinf.scripts"
809
			value="${war.webinf}/scripts" />
810
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
811
		<property name="war.context.docs" value="${war.context}/docs" />
812
		<property name="war.context.temp" value="${war.context}/temp" />
813
		<property name="war.context.templates"
814
			value="${war.context}${style-common-relpath}/templates" />
815
		<mkdir dir="${war.lib}" />
816
		<mkdir dir="${war.webinf}" />
817
		<mkdir dir="${war.context}" />
818
		<mkdir dir="${war.webinf.sql}" />
819
		<mkdir dir="${war.context.cgi}" />
820
		<mkdir dir="${war.context.docs}" />
821
		<mkdir dir="${war.context.temp}" />
822
		<mkdir dir="${war.context.templates}" />
823

    
824
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
825
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
826
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
827
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
828
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
829
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
830
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
831
		<copy todir="${war.lib}" filtering="no">
832
			<fileset dir="lib">
833
				<!--
834
					<not>
835
					<filename name="${jdbc-jar-name}"/>
836
					</not>
837
				-->
838
				<include name="*.jar" />
839
			</fileset>
840
			<fileset dir="lib">
841
				<include name="xalan.jar" />
842
				<include name="gwt*.jar" />
843
			</fileset>
844
			<fileset dir="lib/oaipmh">
845
				<include name="oaicat.jar" />
846
			</fileset>
847
		</copy>
848
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
849
			tofile="${build.war}/web.xml" / -->
850
		<!-- MCD added next - Remove the tomcat5 reference-->
851
		<copy file="lib/web.xml.tomcat5" tofile="${build.war}/web.xml" />
852
		<copy file="lib/metacat.properties" todir="${war.webinf}"
853
			filtering="yes" />
854
		<copy file="lib/metacat.properties.metadata.xml"
855
			todir="${war.webinf}" filtering="no" />
856
		<copy file="lib/org.properties.metadata.xml"
857
			todir="${war.webinf}" filtering="no" />
858
		<copy file="lib/auth.properties.metadata.xml"
859
			todir="${war.webinf}" filtering="no" />
860
		<copy todir="${war.webinf}" filtering="yes">
861
			<fileset dir="lib">
862
				<include name="skin.configs/**" />
863
			</fileset>
864
		</copy>
865
		<copy file="lib/log4j.properties" todir="${war.webinf}"
866
			filtering="yes" />
867
		<copy todir="${war.context}" filtering="no">
868
			<fileset dir="lib">
869
				<include name="**/*.jpg" />
870
				<include name="**/*.png" />
871
				<include name="**/*.gif" />
872
				<include name="LiveMap_30/**" />
873
				<include name="oaipmh/**" />
874
			</fileset>
875
		</copy>
876
		<copy todir="${war.context}" filtering="yes">
877
			<fileset dir="lib">
878
				<exclude name="*.jar" />
879
				<exclude name="*.properties" />
880
				<exclude name="*.metadata.xml" />
881
				<exclude name="web.xml" />
882
				<exclude name="**/*.jpg" />
883
				<exclude name="**/*.png" />
884
				<exclude name="**/*.gif" />
885
				<exclude name="lsid_lib/**" />
886
				<exclude name="lsid_conf/**" />
887
				<exclude name="LiveMap_30/**" />
888
				<exclude name="oaipmh/**" />
889
				<exclude name="skin.configs/**" />
890
				<exclude name="spatial/geoserver/**" />
891
				<exclude name="spatial/WEB-INF/**" />
892
			</fileset>
893
		</copy>
894
		<copy todir="${war.context.docs}" filtering="yes">
895
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
896
		</copy>
897
		<copy todir="${war.context.docs}" filtering="no">
898
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
899
		</copy>
900
		<copy todir="${war.webinf.sql}" filtering="yes">
901
			<fileset dir="src">
902
				<include name="**/*.sql" />
903
			</fileset>
904
		</copy>
905
		<copy todir="${war.webinf.scripts}" filtering="yes">
906
			<fileset dir="src/scripts" />
907
		</copy>
908
		<copy todir="${war.webinf.scripts}"
909
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
910
			failonerror="false" />
911

    
912
		<copy file="src/perl/register-dataset.cgi"
913
			todir="${war.context.cgi}" />
914
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
915
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
916

    
917
		<!-- registry cgi section -->
918
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
919
			used in readDocumentFromMetacat -->
920
		<!-- TODO MCD copy temp files to actual location using config util?? -->
921
		<copy todir="${war.context.temp}" filtering="yes">
922
			<fileset dir="lib/style/common/emlb6toeml2">
923
				<include name="*.xsl" />
924
				<include name="*.xml" />
925
			</fileset>
926
		</copy>
927
		<available file="lib/style/common/emlb6toeml2" type="dir"
928
			property="styles.not.needed" />
929

    
930
		<!-- ldap cgi section -->
931
		<copy todir="${war.context.templates}">
932
			<fileset dir="lib/style/common/templates">
933
				<!-- SCW: Copy all files -->
934
			</fileset>
935
		</copy>
936
	</target>
937

    
938
	<target name="cgiPrepare" if="build.perl">
939
		<exec dir="src/perl/Metacat/" executable="make">
940
			<arg value="clean" />
941
		</exec>
942
		<exec dir="src/perl/Metacat/" executable="perl">
943
			<arg value="Makefile.PL" />
944
		</exec>
945
		<exec dir="src/perl/Metacat/" executable="make" />
946
	</target>
947

    
948
	<target name="testPrepare"
949
		description="Copies test files into the war directories">
950
		<echo>in testPrepare</echo>
951
		<property name="war.context.test"
952
			value="${build.war}/${metacat.context}/test" />
953
		<mkdir dir="${war.context.test}" />
954
		<copy todir="${war.context.test}" filtering="yes">
955
			<fileset dir="test/servertestfiles">
956
				<include name="*/**" />
957
			</fileset>
958
		</copy>
959
	</target>
960

    
961
	<target name="getConversionXSL" depends="prepare"
962
		unless="styles.not.needed"
963
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
964

    
965
		<echo>Enter CVS password:</echo>
966
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
967
			tag="${eml2-style-tag}" dest="${build.tmp}/eml_${eml2-style-tag}" />
968

    
969
		<mkdir dir="lib/style/common/emlb6toeml2" />
970
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
971
			<fileset
972
				dir="${build.tmp}/eml_${eml2-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
973
				<include name="*.xsl" />
974
				<include name="*.xml" />
975
			</fileset>
976
		</copy>
977
	</target>
978

    
979
	<target name="testprep" depends="jar,clientjar,harvesterjar">
980
		<mkdir dir="${build.tests}" />
981
		<copy todir="${build.tests}" filtering="yes">
982
			<fileset dir="${testdir}">
983
				<include name="edu/**" />
984
			</fileset>
985
		</copy>
986
		<copy todir="${build.tests}" file="${testdir}/test.properties"
987
			filtering="yes" />
988

    
989
		<!-- copy and compile the tests into a jar file -->
990
		<javac srcdir="${build.tests}" destdir="${build.tests}"
991
			debug="on" includes="**/*.java">
992
			<classpath>
993
				<path refid="compile.classpath" />
994
				<fileset dir="${build.dir}">
995
					<include name="${name}.jar" />
996
					<include name="${name}-client.jar" />
997
					<include name="harvester.jar" />
998
				</fileset>
999
			</classpath>
1000
		</javac>
1001

    
1002
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1003
			basedir="${build.tests}" includes="**/*.class" />
1004
	</target>
1005

    
1006
	<target name="test" depends="testprep"
1007
		description="Uses the ant junit task to run all JUnit tests">
1008

    
1009
		<!-- use the ant "junit" task to run JUnit tests. -->
1010
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1011
			haltonerror="no">
1012
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1013
			<classpath>
1014
				<path refid="compile.classpath" />
1015
				<fileset dir="${build.dir}">
1016
					<include name="${name}.jar" />
1017
					<include name="${name}-client.jar" />
1018
					<include name="harvester.jar" />
1019
					<include name="${name}-junittests.jar" />
1020
				</fileset>
1021
			</classpath>
1022

    
1023
			<formatter type="plain" />
1024

    
1025
			<batchtest fork="yes" todir="${build.dir}">
1026
				<fileset dir="${build.tests}">
1027
					<include name="**/*.class" />
1028
					<exclude name="**/MCTestCase.class" />
1029
					<exclude name="**/ClientViewHelperTest.class" />
1030
				</fileset>
1031
			</batchtest>
1032
		</junit>
1033
	</target>
1034

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

    
1038
		<echo>testtorun: ${testtorun}</echo>
1039

    
1040
		<!-- use the ant "junit" task to run JUnit tests. -->
1041
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1042
			haltonerror="no" showoutput="yes">
1043
			<!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1044
			<classpath>
1045
				<path refid="compile.classpath" />
1046
				<fileset dir="${build.dir}">
1047
					<include name="${name}.jar" />
1048
					<include name="${name}-client.jar" />
1049
					<include name="harvester.jar" />
1050
					<include name="${name}-junittests.jar" />
1051
				</fileset>
1052
			</classpath>
1053

    
1054
			<formatter type="plain" />
1055

    
1056
			<batchtest fork="yes" todir="${build.dir}">
1057
				<fileset dir="${build.tests}">
1058
					<include name="**/${testtorun}.class" />
1059
				</fileset>
1060
			</batchtest>
1061
		</junit>
1062
	</target>
1063

    
1064
	<target name="testharvester" depends="testprep"
1065
		description="Uses the ant junit task to test only the Harvester code">
1066
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1067
			haltonerror="off">
1068
			<classpath>
1069
				<path refid="compile.classpath" />
1070
				<fileset dir="${build.dir}">
1071
					<include name="${name}.jar" />
1072
					<include name="${name}-client.jar" />
1073
					<include name="harvester.jar" />
1074
					<include name="${name}-junittests.jar" />
1075
				</fileset>
1076
			</classpath>
1077
			<formatter type="plain" />
1078
			<batchtest fork="yes" todir="${build.dir}">
1079
				<fileset dir="${build.tests}">
1080
					<include name="**/harvesterClient/*.class" />
1081
				</fileset>
1082
			</batchtest>
1083
		</junit>
1084
	</target>
1085

    
1086
	<target name="gethttpclient" depends="prepare"
1087
		description="checks out and compiles morpho httpclient code">
1088
		<!--mkdir dir="${morphosourcedir}" -->
1089
		<cvs cvsRoot="${cvsroot}" package="morpho" dest="." />
1090
		<ant dir="${morphosourcedir}" inheritAll="false" target="jar" />
1091
	</target>
1092

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

    
1097
		<echo>
1098
			*********************************** Please run ant
1099
			gethttpclient first! ***********************************
1100
		</echo>
1101
		<!-- copy and compile the tests into a jar file -->
1102
		<mkdir dir="${build.metacatnettest}" />
1103
		<javac srcdir="${junitnettestsdir}"
1104
			destdir="${build.metacatnettest}" includes="**/*.java">
1105
			<classpath>
1106
				<path refid="compile.classpath" />
1107
				<fileset dir="${build.dir}">
1108
					<include name="${name}.jar" />
1109
				</fileset>
1110
			</classpath>
1111
		</javac>
1112

    
1113
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1114
			basedir="${build.metacatnettest}" includes="**/*.class" />
1115

    
1116
		<!-- use the ant "junit" task to run JUnit tests. -->
1117
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1118
			haltonerror="no">
1119
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1120
			<classpath>
1121
				<path refid="compile.classpath" />
1122
				<fileset dir="${build.dir}">
1123
					<include name="${name}.jar" />
1124
					<include name="${name}-junitnettests.jar" />
1125
				</fileset>
1126
			</classpath>
1127

    
1128
			<formatter type="plain" />
1129

    
1130
			<batchtest fork="yes" todir="${build.dir}">
1131
				<fileset dir="${build.metacatnettest}">
1132
					<include name="**/*.class" />
1133
				</fileset>
1134
			</batchtest>
1135
		</junit>
1136
	</target>
1137

    
1138
	<target name="cleanweb" depends="clean"
1139
		description="deletes tomcat web context dir and all its contents">
1140
		<delete dir="${installdir}" />
1141
	</target>
1142

    
1143

    
1144
	<target name="clean" depends="init"
1145
		description="deletes build dir and files that can be regenerated form the release">
1146
		<delete dir="${build.dir}" />
1147
		<delete dir="${dist.dir}" />
1148
	</target>
1149

    
1150
	<target name="localclean" depends="clean"
1151
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1152
		<delete file="lib/httpclient.jar" />
1153
		<delete file="lib/utilities.jar" />
1154
	</target>
1155

    
1156
	<target name="fullclean" depends="localclean"
1157
		description="deletes code and eml">
1158
		<delete includeEmptyDirs="true" failonerror="false">
1159
			<fileset dir="${style-common-cvsrelpath}">
1160
				<include name="${eml-css}" />
1161
				<include name="eml-*/*.xsl" />
1162
				<include name="eml-*" />
1163
			</fileset>
1164
			<fileset dir="${schema-cvsrelpath}">
1165
				<include name="eml-*/*.xsd" />
1166
			</fileset>
1167
			<fileset dir="${ecogrid-dir}">
1168
				<include name="build.properties" />
1169
				<include name="buildfiles/metacatImpl.xml" />
1170
			</fileset>
1171
		</delete>
1172
	</target>
1173

    
1174
	<target name="jdoc" depends="prepare"
1175
		description="generates javadoc documentation">
1176
		<javadoc packagenames="edu.ucsb.nceas.*"
1177
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1178
			version="true" use="true" windowtitle="${Name} API"
1179
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1180
			bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1181
			<classpath>
1182
				<path refid="compile.classpath" />
1183
			</classpath>
1184
		</javadoc>
1185
	</target>
1186

    
1187
	<target name="dist"
1188
		depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1189
		description="prepares a full release distribution">
1190
		<mkdir dir="${dist.dir}" />
1191
		<delete dir="${ver.dir}" />
1192
		<mkdir dir="${ver.dir}" />
1193
		<copy todir="${ver.dir}">
1194
			<fileset dir="."
1195
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1196
		</copy>
1197
		<copy todir="${ver.dir}" file="build.xml" />
1198
		<copy todir="${ver.dir}" file="build.properties" />
1199

    
1200
		<copy todir="${ver.dir}/docs" filtering="yes">
1201
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1202
		</copy>
1203
		<copy todir="${ver.dir}/docs" filtering="no">
1204
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1205
		</copy>
1206
		<copy todir="${ver.dir}/docs/dev">
1207
			<fileset dir="${build.dir}/docs" />
1208
		</copy>
1209
		<copy todir="${ver.dir}/src">
1210
			<fileset dir="${build.dir}/src" />
1211
		</copy>
1212

    
1213
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1214
		<copy todir="${ver.dir}/test/servertestfiles">
1215
			<fileset dir="./test/servertestfiles" />
1216
		</copy>
1217
	</target>
1218

    
1219
	<target name="distbin" depends="build-metacat,war-lsid"
1220
		description="prepares a binary distribution">
1221
		<copy todir="${dist.dir}">
1222
			<fileset dir="./src/scripts" />
1223
		</copy>
1224
		<delete file="./${name}-bin-${release}.zip" />
1225
		<zip zipfile="./${name}-bin-${release}.zip"
1226
			basedir="${dist.dir}" excludes="metacat-*/**" />
1227
		<delete file="./${name}-bin-${release}.tar.gz" />
1228
		<tar tarfile="./${name}-bin-${release}.tar"
1229
			basedir="${dist.dir}" excludes="metacat-*/**" />
1230
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1231
			src="./${name}-bin-${release}.tar" />
1232
		<delete file="./${name}-bin-${release}.tar" />
1233
	</target>
1234

    
1235
	<target name="distsrc" depends="dist"
1236
		description="prepares a source distribution">
1237
		<mkdir dir="${ver.src}" />
1238
		<copy todir="${ver.src}">
1239
			<fileset dir="./src" />
1240
		</copy>
1241
		<mkdir dir="${util.dir}" />
1242
		<copy todir="${util.dir}">
1243
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1244
		</copy>
1245

    
1246
		<mkdir dir="${ecogrid-dist-dir}" />
1247
		<copy todir="${ecogrid-dist-dir}">
1248
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1249
		</copy>
1250

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

    
1253
		<delete file="./${name}-src-${release}.zip" />
1254
		<zip zipfile="./${name}-src-${release}.zip"
1255
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1256
		<delete file="./${name}-src-${release}.tar.gz" />
1257
		<tar tarfile="./${name}-src-${release}.tar"
1258
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1259
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1260
			src="./${name}-src-${release}.tar" />
1261
		<delete file="./${name}-src-${release}.tar" />
1262
		<!--delete dir="${dist.dir}"/ -->
1263
	</target>
1264

    
1265
	<target name="deb-package" depends="distbin"
1266
		description="create a debian installation package">
1267
		<delete dir="${deb.pkg.dir}" />
1268
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1269
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1270
			<fileset dir="./src/scripts/debian"
1271
				includes="control postinst" />
1272
		</copy>
1273

    
1274
		<mkdir
1275
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1276
		<copy
1277
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1278
			filtering="yes">
1279
			<fileset dir="./src/scripts/debian"
1280
				excludes="control postinst" />
1281
		</copy>
1282
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1283

    
1284
		<copy file="${dist.dir}/knb.war"
1285
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1286
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1287
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1288

    
1289
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1290
			failonerror="true">
1291
			<arg line="--build debian" />
1292
		</exec>
1293

    
1294
		<move file="${pkg.dir}/debian.deb"
1295
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1296
	</target>
1297

    
1298
	<target name="stylesheettest">
1299
		<xslt in="${input}" out="eml.html"
1300
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1301
			<param name="displaymodule" expression="${displaymodule}" />
1302
			<param name="docid" expression="${input}" />
1303
			<param name="entitytype" expression="${entitytype}" />
1304
			<param name="entityindex" expression="${entityindex}" />
1305
			<outputproperty name="method" value="html" />
1306
			<outputproperty name="standalone" value="yes" />
1307
			<outputproperty name="encoding" value="iso8859_1" />
1308
			<outputproperty name="indent" value="yes" />
1309
		</xslt>
1310
	</target>
1311

    
1312

    
1313
	<target name="compilewebclient" depends="prepare">
1314
		<javac srcdir="${build.src}" destdir="${build.dest}"
1315
			includes="**/application/*.java" classpathref="webservicepath" />
1316
	</target>
1317

    
1318
	<target name="runwebclient" depends="compilewebclient">
1319
		<java
1320
			classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1321
			dir="${build.dest}" fork="yes" classpathref="webservicepath"
1322
			classpath="./lib/utilities.jar" failonerror="true">
1323
			<arg value="${serviceUrl}" />
1324
			<arg value="${docid}" />
1325
		</java>
1326
	</target>
1327

    
1328
	<target name="spatial_option" depends="prepare"
1329
		description=" -- compiles code for the spatial option">
1330

    
1331
		<echo message="Compiling the metatcat shapefile creator" />
1332
		<echo message="using the shapelib at: ${shapelib.dir}" />
1333
		<exec dir="." executable="g++" os="Linux, Unix"
1334
			failonerror="true">
1335
			<arg
1336
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1337
		</exec>
1338

    
1339
		<exec dir="." executable="g++" os="Linux, Unix"
1340
			failonerror="true">
1341
			<arg
1342
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1343
		</exec>
1344
	</target>
1345

    
1346
	<!-- LSID Authority support -->
1347
	<patternset id="lsid.jars">
1348
		<include name="axis.jar" />
1349
		<include name="commons-discovery-0.2.jar" />
1350
		<include name="jaxrpc.jar" />
1351
		<include name="lsid-client-1.1.1.jar" />
1352
		<include name="lsid-server-1.1.1.jar" />
1353
		<include name="saaj.jar" />
1354
		<include name="wsdl4j-1.5.1.jar" />
1355
		<include name="activation.jar" />
1356
		<include name="castor-0.9.5.jar" />
1357
		<include name="dnsjava-1.3.2.jar" />
1358
		<include name="mail.jar" />
1359
		<include name="commons-logging-1.0.4.jar" />
1360
		<!-- These jars may be needed but seem to not actually be,
1361
			so leaving them out for now
1362
			<include name="axis-ant.jar" />
1363
		-->
1364
		<!--<include name="GenCastor.class" />-->
1365
	</patternset>
1366
	<patternset id="lib.jars">
1367
		<include name="httpclient.jar" />
1368
		<include name="log4j-1.2.12.jar" />
1369
		<include name="utilities.jar" />
1370
		<include name="xercesImpl.jar" />
1371
		<include name="xalan.jar" />
1372
		<include name="xml-apis.jar" />
1373
	</patternset>
1374

    
1375
	<path id="lsid.classpath">
1376
		<fileset dir="${lsid.lib.dir}">
1377
			<patternset refid="lsid.jars" />
1378
		</fileset>
1379
		<fileset dir="${lib.dir}">
1380
			<patternset refid="lsid.jars" />
1381
		</fileset>
1382
		<fileset dir="${lib.dir}">
1383
			<include name="xalan.jar" />
1384
			<include name="xml-apis.jar" />
1385
		</fileset>
1386
		<fileset dir="${build.dir}">
1387
			<include name="metacat-client.jar" />
1388
		</fileset>
1389
	</path>
1390

    
1391
	<filterset id="configFilters">
1392
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1393
			value="${config.hostname}" / -->
1394
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1395
			value="${config.port}" / -->
1396
		<!-- MCD BYE filter token="METADATA_LABELS"
1397
			value="${config.metadataLabelLsid}" / -->
1398
		<!-- MCD BYE filter token="METACAT_SERVER"
1399
			value="${config.metacatserver}" / -->
1400
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1401
			value="${config.lsidauthority}" / -->
1402
	</filterset>
1403

    
1404
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1405
		description="Configure files prior to compilation">
1406
		<mkdir dir="${lsid.build.dir}" />
1407
		<!-- Copy the properties file into the build -->
1408
		<copy file="${conf.dir}/metacat-lsid.properties"
1409
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1410
			overwrite="true">
1411
			<filterset refid="configFilters" />
1412
		</copy>
1413
		<copy file="${conf.dir}/log4j.properties"
1414
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1415
			overwrite="true">
1416
			<filterset refid="configFilters" />
1417
		</copy>
1418
		<!-- Copy config files into the build -->
1419
		<copy todir="${lsid.build.dir}/WEB-INF">
1420
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1421
		</copy>
1422
		<!-- Copy the metadata configuration files into the build -->
1423
		<mkdir
1424
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1425
		<copy
1426
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1427
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1428
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1429
			<filterset refid="configFilters" />
1430
		</copy>
1431
		<!-- Copy services files into the build -->
1432
		<mkdir dir="${lsid.build.dir}/services" />
1433
		<copy todir="${lsid.build.dir}/services">
1434
			<fileset dir="${services.dir}" />
1435
			<filterset refid="configFilters" />
1436
		</copy>
1437
		<!-- Copy axis files into the build -->
1438
		<mkdir dir="${lsid.build.dir}" />
1439
		<copy todir="${lsid.build.dir}">
1440
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1441
		</copy>
1442
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1443
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1444
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1445
		</copy>
1446
	</target>
1447

    
1448
	<target name="compile-lsid" depends="prepare-lsid"
1449
		description="Compile Java sources">
1450
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1451
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1452
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1453
			deprecation="${compile.deprecation}"
1454
			optimize="${compile.optimize}">
1455
			<classpath refid="lsid.classpath" />
1456
		</javac>
1457
	</target>
1458

    
1459
	<target name="war-lsid" depends="compile-lsid"
1460
		description="Create a war file for the application">
1461
		<mkdir dir="${dist.dir}" />
1462
		<war destfile="${dist.dir}/${authority.context}.war"
1463
			webxml="${webinf.dir}/web.xml">
1464
			<fileset dir="${lsid.build.dir}" />
1465
			<lib dir="${lsid.lib.dir}">
1466
				<patternset refid="lsid.jars" />
1467
			</lib>
1468
			<lib dir="${lib.dir}">
1469
				<patternset refid="lib.jars" />
1470
			</lib>
1471
			<lib dir="${lib.dir}">
1472
				<include name="xalan.jar" />
1473
				<include name="xml-apis.jar" />
1474
			</lib>
1475
			<lib dir="${build.dir}">
1476
				<include name="metacat-client.jar" />
1477
			</lib>
1478
		</war>
1479
	</target>
1480

    
1481
	<target name="deploy-lsid" depends="war-lsid"
1482
		description="Deploy LSID war to servlet container">
1483
		<delete dir="${app.deploy.dir}/${authority.context}" />
1484
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1485
		<mkdir dir="${app.deploy.dir}" />
1486
		<copy todir="${app.deploy.dir}">
1487
			<fileset dir="${dist.dir}" />
1488
		</copy>
1489
	</target>
1490
</project>
(5-5/6)