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: 2010-01-04 10:39:57 -0800 (Mon, 04 Jan 2010) $'
11
	*    '$Revision: 5176 $'
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.emlBetaUrl"
269
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
270
		<property name="svn.eml200SchemaUrl"
271
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
272
		<property name="svn.eml201SchemaUrl"
273
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
274
		<property name="svn.eml210SchemaUrl"
275
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
276
		<property name="svn.eml2StyleUrl"
277
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
278

    
279
		<!-- load the svn task -->
280
		<path id="svn.classpath">
281
			<pathelement location="${svnjavahl.jar}" />
282
			<pathelement location="${svnant.jar}" />
283
			<pathelement location="${svnClientAdapter.jar}" />
284
		</path>
285
		<taskdef resource="svntask.properties"
286
			classpathref="svn.classpath" />
287

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

    
328
		<condition property="ecogrid.required">
329
			<or>
330
				<not>
331
					<available file="${ecogrid-dir}/build.properties" />
332
				</not>
333
				<not>
334
					<available
335
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
336
				</not>
337
			</or>
338
		</condition>
339

    
340
	</target>
341

    
342
	<target name="prepare" depends="init">
343
		<mkdir dir="${build.dir}" />
344
		<mkdir dir="${build.src}" />
345
		<mkdir dir="${build.dest}" />
346
		<mkdir dir="${build.javadocs}" />
347
		<mkdir dir="${build.tmp}" />
348

    
349
		<copy todir="${build.src}" filtering="yes">
350
			<fileset dir="${srcdir}">
351
				<include name="edu/**" />
352
				<include name="com/**" />
353
				<include name="org/**" />
354
				<!-- include name="java/**" / -->
355
				<include name="**/*.sql" />
356
				<exclude name="**/CVS*" />
357
				<exclude name="**/.#*" />
358
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
359
			</fileset>
360
		</copy>
361
		<available file="lib/style/common/emlb6toeml2" type="dir"
362
			property="styles.not.needed" />
363
	</target>
364

    
365
	<taskdef resource="axis-tasks.properties"
366
		classpathref="compile.classpath" />
367

    
368
	<target name="generateStubs" depends="prepare">
369
		<echo
370
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
371
		<axis-wsdl2java verbose="true" output="${srcdir}"
372
			url="/tmp/KeplerWebService.wsdl" />
373
	</target>
374

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

    
378
		<javac srcdir="${build.src}" destdir="${build.dest}"
379
			debug="${debug}"
380
			excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
381
			<classpath>
382
				<path refid="compile.classpath" />
383
			</classpath>
384
		</javac>
385
	</target>
386

    
387
	<target name="jar" depends="compile,geteml"
388
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
389

    
390
		<delete file="${build.dir}/${name}.jar" />
391
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
392
			excludes="**/protocols/ **/harvesterClient/" />
393
	</target>
394

    
395
	<target name="protocol" depends="compile"
396
		description="Compiles and jars protocol java code to protocol.jar in build dir">
397
		<delete file="${build.dir}/protocol.jar" />
398
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
399
			includes="**/protocols/" />
400
	</target>
401

    
402
	<target name="utilities" depends="config,getpeerutilities"
403
		if="utilities.required">
404
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
405
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
406
		<copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
407
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
408
	</target>
409

    
410
	<target name="getpeerutilities" depends="prepare"
411
		if="peer.utilities.required"
412
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
413
		<echo message="Exporting utilities files from svn repository:" />
414
		<svn>
415
			<export srcUrl="${svn.utilitiesUrl}"
416
				destPath="${utilitiesdir}" />
417
		</svn>
418

    
419
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
420
	</target>
421

    
422
	<target name="getutilities" depends="prepare"
423
		description="Checks utility out of svn and copies it to your metacat sandbox">
424
		<svn>
425
			<export srcUrl="${svn.utilitiesUrl}"
426
				destPath="${utilitiesdir}" />
427
		</svn>
428
	</target>
429

    
430
	<target name="client" depends="utilities, prepare"
431
		description="Compiles metacat-client java code to build dir">
432
		<javac srcdir="${build.src}" destdir="${build.dest}"
433
			includes="edu/ucsb/nceas/metacat/client/*">
434
			<classpath>
435
				<path refid="compile.classpath" />
436
			</classpath>
437
		</javac>
438
	</target>
439

    
440
	<target name="clientjar" depends="client"
441
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
442
		<delete file="${build.dir}/${name}-client.jar" />
443
		<jar jarfile="${build.dir}/${name}-client.jar"
444
			basedir="${build.dest}" includes="**/metacat/client/" />
445
	</target>
446

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

    
454
	<target name="harvester" depends="client"
455
		description="Compiles harvester java code to build dir">
456
		<javac srcdir="${build.src}" destdir="${build.dest}"
457
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
458
			<classpath>
459
				<path refid="compile.classpath" />
460
			</classpath>
461
		</javac>
462
	</target>
463

    
464
	<target name="harvesterjar" depends="harvester"
465
		description="Compiles and jars harvester java code to harvester.jar in build dir">
466
		<delete file="${build.dir}/harvester.jar" />
467
		<jar jarfile="${build.dir}/harvester.jar"
468
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
469
	</target>
470

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

    
495
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
496
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
497

    
498
	<target name="getemlpre2" depends="prepare" if="eml.required"
499
		description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
500
		<svn>
501
			<export srcUrl="${svn.emlBetaUrl}"
502
				destPath="${build.tmp}/eml_${eml-beta-tag}" />
503
		</svn>
504
		<mkdir dir="lib/dtd" />
505
		<copy todir="lib/dtd" filtering="yes">
506
			<fileset
507
				dir="${build.tmp}/eml_${eml-beta-tag}">
508
				<include name="*.dtd" />
509
			</fileset>
510
			<mapper type="glob" from="eml-*.dtd"
511
				to="eml-*-${eml-version}.dtd" />
512
		</copy>
513

    
514
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
515
			<fileset
516
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
517
				<include name="**/*.xsl" />
518
			</fileset>
519
		</copy>
520
	</target>
521

    
522
	<target name="geteml2+" depends="prepare" if="eml.required"
523
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
524
		<svn>
525
			<export srcUrl="${svn.eml200SchemaUrl}"
526
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
527
		</svn>
528
		<mkdir dir="lib/schema/eml-2.0.0" />
529
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
530
			<fileset
531
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
532
				<include name="*.xsd" />
533
			</fileset>
534

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

    
541
		</copy>
542
		<!-- <antcall target="copyxsl">
543
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
544
			<param name="dirname" value="eml-2.0.0" />
545
			</antcall> -->
546

    
547
		<!-- Checkout eml201 for given schema tag-->
548
		<svn>
549
			<export srcUrl="${svn.eml201SchemaUrl}"
550
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
551
		</svn>
552
		<mkdir dir="lib/schema/eml-2.0.1" />
553
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
554
			<fileset
555
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
556
				<include name="*.xsd" />
557
			</fileset>
558
		</copy>
559

    
560
		<!-- Checkout eml201 again for given style sheet tag-->
561
		<!-- echo>Enter CVS password: </echo>
562
			<cvs cvsRoot="${cvsroot}"
563
			package="${eml-module}"
564
			tag="${eml2_0_1-style-tag}"
565
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
566
			<antcall target="copyxsl">
567
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
568
			<param name="dirname" value="eml-2.0.1" />
569
			</antcall -->
570

    
571
		<!-- Checkout eml210 for given schema tag-->
572
		<svn>
573
			<export srcUrl="${svn.eml210SchemaUrl}"
574
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
575
		</svn>
576
		<mkdir dir="lib/schema/eml-2.1.0" />
577
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
578
			<fileset
579
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
580
				<include name="*.xsd" />
581
			</fileset>
582
		</copy>
583

    
584
		<!-- Checkout eml210 for given style sheet tag-->
585
		<svn>
586
			<export srcUrl="${svn.eml2StyleUrl}"
587
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
588
		</svn>
589
		<antcall target="copyxsl">
590
			<param name="cvs.tagname" value="${eml2-style-tag}" />
591
			<!-- param name="dirname" value="eml-2.1.0" / -->
592
			<param name="dirname" value="eml-2" />
593
		</antcall>
594
	</target>
595

    
596
	<target name="copyxsl"
597
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
598

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

    
601
		<copy todir="${style-common-cvsrelpath}/${dirname}"
602
			filtering="yes">
603
			<fileset
604
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
605
				<include name="**/*.xsl" />
606
			</fileset>
607
		</copy>
608

    
609

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

    
616
	</target>
617

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

    
633
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
634
		description="Installs spatial option for metacat">
635

    
636
		<property name="spatial.dir" value="./lib/spatial" />
637
		<property name="spatial.geoserver.dir"
638
			value="${spatial.dir}/geoserver" />
639
		<property name="spatial.webinf-mods"
640
			value="${spatial.dir}/WEB-INF" />
641

    
642
		<!-- Copy geoserver libs into ${war.lib} -->
643
		<copy todir="${war.lib}" filtering="no">
644
			<fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
645
				<include name="**" />
646
			</fileset>
647
		</copy>
648

    
649
		<!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
650
		<copy todir="${war.webinf}" filtering="no">
651
			<fileset dir="${spatial.geoserver.dir}/WEB-INF">
652
				<exclude name="lib/**" />
653
				<exclude name="web.xml" />
654
			</fileset>
655
		</copy>
656

    
657
		<!-- Copy the rest of the geoserver codebase into ${war.context} -->
658
		<copy todir="${war.context}" filtering="no">
659
			<fileset dir="${spatial.geoserver.dir}">
660
				<exclude name="WEB-INF/**" />
661
				<exclude name="index.jsp" />
662
			</fileset>
663
		</copy>
664

    
665
		<!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
666
		<copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
667
			tofile="${war.context}/geoserver.jsp" overwrite="true"
668
			filtering="no" />
669

    
670
		<!-- Copy the rest of the modified geoserver web-inf files
671
			<copy todir="${war.webinf}" filtering="no">
672
			<fileset dir="${spatial.webinf-mods}">
673
			<exclude name="web.xml.combined"/>
674
			</fileset>
675
			</copy> -->
676

    
677
	</target>
678

    
679
	<target name="install" depends="build-metacat"
680
		description="* Full Install For Development *">
681
		<copy file="${dist.dir}/${metacat.context}.war"
682
			todir="${app.deploy.dir}" />
683
		<delete dir="${app.deploy.dir}/${metacat.context}" />
684
		<tstamp>
685
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
686
		</tstamp>
687
		<echo>Dev install completed at ${NOW}</echo>
688
	</target>
689

    
690
	<target name="build-metacat" depends="install-ecogrid"
691
		description="Build Metacat">
692
	</target>
693

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

    
716

    
717
	</target>
718

    
719
	<target name="get-ecogrid" depends="init"
720
		description="Check out ecogrid module" if="ecogrid.required">
721
		<svn>
722
			<export srcUrl="${svn.ecogridUrl}"
723
				destPath="${ecogrid-dir}" />
724
		</svn>
725
	</target>
726

    
727
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
728
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
729
		<property name="context" value="${metacat.context}"/>
730
		<property name="target" value="${ecogrid-target-name}"/>
731
		<property name="metacat.dir" value="."/>
732
		<property name="hostname" value="${ecogrid.hostname}"/>
733
		<property name="port" value="${config.port}"/>
734
		</ant>
735
		</target -->
736

    
737
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
738
		description="Automately generate wsdd for ecogrid service">
739
		<delete
740
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
741
	</target>
742

    
743
	<target name="install-skin" depends="init"
744
		description="Install a Skin">
745

    
746
		<input message="Please enter name of the skin"
747
			addproperty="skin-name" />
748

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

    
793
		<echo message="Install Skin completed." />
794
	</target>
795

    
796
	<target name="war" depends="warPrepare,install-spatial"
797
		description="Create a web archive (WAR) for servlet deployment">
798
		<mkdir dir="${dist.dir}" />
799
		<war destfile="${dist.dir}/${metacat.context}.war"
800
			webxml="${build.war}/web.xml">
801
			<fileset dir="${war.context}" />
802
			<lib dir="${war.lib}" />
803
			<webinf dir="${war.webinf}" />
804
		</war>
805
	</target>
806

    
807
	<target name="warPrepare"
808
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
809
		description="Prepare files for creating a web archive (WAR)">
810

    
811
		<property name="war.lib" value="${build.war}/lib" />
812
		<property name="war.webinf" value="${build.war}/WEB-INF" />
813
		<property name="war.context"
814
			value="${build.war}/${metacat.context}" />
815
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
816
		<property name="war.webinf.scripts"
817
			value="${war.webinf}/scripts" />
818
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
819
		<property name="war.context.docs" value="${war.context}/docs" />
820
		<property name="war.context.temp" value="${war.context}/temp" />
821
		<property name="war.context.templates"
822
			value="${war.context}${style-common-relpath}/templates" />
823
		<mkdir dir="${war.lib}" />
824
		<mkdir dir="${war.webinf}" />
825
		<mkdir dir="${war.context}" />
826
		<mkdir dir="${war.webinf.sql}" />
827
		<mkdir dir="${war.context.cgi}" />
828
		<mkdir dir="${war.context.docs}" />
829
		<mkdir dir="${war.context.temp}" />
830
		<mkdir dir="${war.context.templates}" />
831

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

    
920
		<copy file="src/perl/register-dataset.cgi"
921
			todir="${war.context.cgi}" />
922
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
923
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
924

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

    
938
		<!-- ldap cgi section -->
939
		<copy todir="${war.context.templates}">
940
			<fileset dir="lib/style/common/templates">
941
				<!-- SCW: Copy all files -->
942
			</fileset>
943
		</copy>
944
	</target>
945

    
946
	<target name="cgiPrepare" if="build.perl">
947
		<exec dir="src/perl/Metacat/" executable="make">
948
			<arg value="clean" />
949
		</exec>
950
		<exec dir="src/perl/Metacat/" executable="perl">
951
			<arg value="Makefile.PL" />
952
		</exec>
953
		<exec dir="src/perl/Metacat/" executable="make" />
954
	</target>
955

    
956
	<target name="testPrepare"
957
		description="Copies test files into the war directories">
958
		<echo>in testPrepare</echo>
959
		<property name="war.context.test"
960
			value="${build.war}/${metacat.context}/test" />
961
		<mkdir dir="${war.context.test}" />
962
		<copy todir="${war.context.test}" filtering="yes">
963
			<fileset dir="test/servertestfiles">
964
				<include name="*/**" />
965
			</fileset>
966
		</copy>
967
	</target>
968

    
969
	<target name="getConversionXSL" depends="prepare"
970
		unless="styles.not.needed"
971
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
972

    
973
		<svn>
974
			<export srcUrl="${svn.eml2StyleUrl}"
975
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
976
		</svn>
977

    
978
		<mkdir dir="lib/style/common/emlb6toeml2" />
979
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
980
			<fileset
981
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
982
				<include name="*.xsl" />
983
				<include name="*.xml" />
984
			</fileset>
985
		</copy>
986
	</target>
987

    
988
	<target name="testprep" depends="jar,clientjar,harvesterjar">
989
		<mkdir dir="${build.tests}" />
990
		<copy todir="${build.tests}" filtering="yes">
991
			<fileset dir="${testdir}">
992
				<include name="edu/**" />
993
			</fileset>
994
		</copy>
995
		<copy todir="${build.tests}" file="${testdir}/test.properties"
996
			filtering="yes" />
997

    
998
		<!-- copy and compile the tests into a jar file -->
999
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1000
			debug="on" includes="**/*.java">
1001
			<classpath>
1002
				<path refid="compile.classpath" />
1003
				<fileset dir="${build.dir}">
1004
					<include name="${name}.jar" />
1005
					<include name="${name}-client.jar" />
1006
					<include name="harvester.jar" />
1007
				</fileset>
1008
			</classpath>
1009
		</javac>
1010

    
1011
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1012
			basedir="${build.tests}" includes="**/*.class" />
1013
	</target>
1014

    
1015
	<target name="test" depends="testprep"
1016
		description="Uses the ant junit task to run all JUnit tests">
1017

    
1018
		<!-- use the ant "junit" task to run JUnit tests. -->
1019
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1020
			haltonerror="no">
1021
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1022
			<classpath>
1023
				<path refid="compile.classpath" />
1024
				<fileset dir="${build.dir}">
1025
					<include name="${name}.jar" />
1026
					<include name="${name}-client.jar" />
1027
					<include name="harvester.jar" />
1028
					<include name="${name}-junittests.jar" />
1029
				</fileset>
1030
			</classpath>
1031

    
1032
			<formatter type="plain" />
1033

    
1034
			<batchtest fork="yes" todir="${build.dir}">
1035
				<fileset dir="${build.tests}">
1036
					<include name="**/*.class" />
1037
					<exclude name="**/MCTestCase.class" />
1038
					<exclude name="**/ClientViewHelperTest.class" />
1039
				</fileset>
1040
			</batchtest>
1041
		</junit>
1042
	</target>
1043

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

    
1047
		<echo>testtorun: ${testtorun}</echo>
1048

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

    
1063
			<formatter type="plain" />
1064

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

    
1073
	<target name="testharvester" depends="testprep"
1074
		description="Uses the ant junit task to test only the Harvester code">
1075
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1076
			haltonerror="off">
1077
			<classpath>
1078
				<path refid="compile.classpath" />
1079
				<fileset dir="${build.dir}">
1080
					<include name="${name}.jar" />
1081
					<include name="${name}-client.jar" />
1082
					<include name="harvester.jar" />
1083
					<include name="${name}-junittests.jar" />
1084
				</fileset>
1085
			</classpath>
1086
			<formatter type="plain" />
1087
			<batchtest fork="yes" todir="${build.dir}">
1088
				<fileset dir="${build.tests}">
1089
					<include name="**/harvesterClient/*.class" />
1090
				</fileset>
1091
			</batchtest>
1092
		</junit>
1093
	</target>
1094

    
1095
	<target name="gethttpclient" depends="prepare"
1096
		description="checks out and compiles morpho httpclient code">
1097
		<!--mkdir dir="${morphosourcedir}" -->
1098
		<cvs cvsRoot="${cvsroot}" package="morpho" dest="." />
1099
		<ant dir="${morphosourcedir}" inheritAll="false" target="jar" />
1100
	</target>
1101

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

    
1106
		<echo>
1107
			*********************************** Please run ant
1108
			gethttpclient first! ***********************************
1109
		</echo>
1110
		<!-- copy and compile the tests into a jar file -->
1111
		<mkdir dir="${build.metacatnettest}" />
1112
		<javac srcdir="${junitnettestsdir}"
1113
			destdir="${build.metacatnettest}" includes="**/*.java">
1114
			<classpath>
1115
				<path refid="compile.classpath" />
1116
				<fileset dir="${build.dir}">
1117
					<include name="${name}.jar" />
1118
				</fileset>
1119
			</classpath>
1120
		</javac>
1121

    
1122
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1123
			basedir="${build.metacatnettest}" includes="**/*.class" />
1124

    
1125
		<!-- use the ant "junit" task to run JUnit tests. -->
1126
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1127
			haltonerror="no">
1128
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1129
			<classpath>
1130
				<path refid="compile.classpath" />
1131
				<fileset dir="${build.dir}">
1132
					<include name="${name}.jar" />
1133
					<include name="${name}-junitnettests.jar" />
1134
				</fileset>
1135
			</classpath>
1136

    
1137
			<formatter type="plain" />
1138

    
1139
			<batchtest fork="yes" todir="${build.dir}">
1140
				<fileset dir="${build.metacatnettest}">
1141
					<include name="**/*.class" />
1142
				</fileset>
1143
			</batchtest>
1144
		</junit>
1145
	</target>
1146

    
1147
	<target name="cleanweb" depends="clean"
1148
		description="deletes tomcat web context dir and all its contents">
1149
		<delete dir="${installdir}" />
1150
	</target>
1151

    
1152

    
1153
	<target name="clean" depends="init"
1154
		description="deletes build dir and files that can be regenerated form the release">
1155
		<delete dir="${build.dir}" />
1156
		<delete dir="${dist.dir}" />
1157
	</target>
1158

    
1159
	<target name="localclean" depends="clean"
1160
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1161
		<delete file="lib/httpclient.jar" />
1162
		<delete file="lib/utilities.jar" />
1163
	</target>
1164

    
1165
	<target name="fullclean" depends="localclean"
1166
		description="deletes code and eml">
1167
		<delete includeEmptyDirs="true" failonerror="false">
1168
			<fileset dir="${style-common-cvsrelpath}">
1169
				<include name="${eml-css}" />
1170
				<include name="eml-*/*.xsl" />
1171
				<include name="eml-*" />
1172
			</fileset>
1173
			<fileset dir="${schema-cvsrelpath}">
1174
				<include name="eml-*/*.xsd" />
1175
			</fileset>
1176
			<fileset dir="${ecogrid-dir}">
1177
				<include name="build.properties" />
1178
				<include name="buildfiles/metacatImpl.xml" />
1179
			</fileset>
1180
		</delete>
1181
	</target>
1182

    
1183
	<target name="jdoc" depends="prepare"
1184
		description="generates javadoc documentation">
1185
		<javadoc packagenames="edu.ucsb.nceas.*"
1186
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1187
			version="true" use="true" windowtitle="${Name} API"
1188
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1189
			bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1190
			<classpath>
1191
				<path refid="compile.classpath" />
1192
			</classpath>
1193
		</javadoc>
1194
	</target>
1195

    
1196
	<target name="dist"
1197
		depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1198
		description="prepares a full release distribution">
1199
		<mkdir dir="${dist.dir}" />
1200
		<delete dir="${ver.dir}" />
1201
		<mkdir dir="${ver.dir}" />
1202
		<copy todir="${ver.dir}">
1203
			<fileset dir="."
1204
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1205
		</copy>
1206
		<copy todir="${ver.dir}" file="build.xml" />
1207
		<copy todir="${ver.dir}" file="build.properties" />
1208

    
1209
		<copy todir="${ver.dir}/docs" filtering="yes">
1210
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1211
		</copy>
1212
		<copy todir="${ver.dir}/docs" filtering="no">
1213
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1214
		</copy>
1215
		<copy todir="${ver.dir}/docs/dev">
1216
			<fileset dir="${build.dir}/docs" />
1217
		</copy>
1218
		<copy todir="${ver.dir}/src">
1219
			<fileset dir="${build.dir}/src" />
1220
		</copy>
1221

    
1222
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1223
		<copy todir="${ver.dir}/test/servertestfiles">
1224
			<fileset dir="./test/servertestfiles" />
1225
		</copy>
1226
	</target>
1227

    
1228
	<target name="distbin" depends="build-metacat,war-lsid"
1229
		description="prepares a binary distribution">
1230
		<copy todir="${dist.dir}">
1231
			<fileset dir="./src/scripts" />
1232
		</copy>
1233
		<delete file="./${name}-bin-${release}.zip" />
1234
		<zip zipfile="./${name}-bin-${release}.zip"
1235
			basedir="${dist.dir}" excludes="metacat-*/**" />
1236
		<delete file="./${name}-bin-${release}.tar.gz" />
1237
		<tar tarfile="./${name}-bin-${release}.tar"
1238
			basedir="${dist.dir}" excludes="metacat-*/**" />
1239
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1240
			src="./${name}-bin-${release}.tar" />
1241
		<delete file="./${name}-bin-${release}.tar" />
1242
	</target>
1243

    
1244
	<target name="distsrc" depends="dist"
1245
		description="prepares a source distribution">
1246
		<mkdir dir="${ver.src}" />
1247
		<copy todir="${ver.src}">
1248
			<fileset dir="./src" />
1249
		</copy>
1250
		<mkdir dir="${util.dir}" />
1251
		<copy todir="${util.dir}">
1252
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1253
		</copy>
1254

    
1255
		<mkdir dir="${ecogrid-dist-dir}" />
1256
		<copy todir="${ecogrid-dist-dir}">
1257
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1258
		</copy>
1259

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

    
1262
		<delete file="./${name}-src-${release}.zip" />
1263
		<zip zipfile="./${name}-src-${release}.zip"
1264
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1265
		<delete file="./${name}-src-${release}.tar.gz" />
1266
		<tar tarfile="./${name}-src-${release}.tar"
1267
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1268
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1269
			src="./${name}-src-${release}.tar" />
1270
		<delete file="./${name}-src-${release}.tar" />
1271
		<!--delete dir="${dist.dir}"/ -->
1272
	</target>
1273

    
1274
	<target name="deb-package" depends="distbin"
1275
		description="create a debian installation package">
1276
		<delete dir="${deb.pkg.dir}" />
1277
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1278
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1279
			<fileset dir="./src/scripts/debian"
1280
				includes="control postinst" />
1281
		</copy>
1282

    
1283
		<mkdir
1284
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1285
		<copy
1286
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1287
			filtering="yes">
1288
			<fileset dir="./src/scripts/debian"
1289
				excludes="control postinst" />
1290
		</copy>
1291
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1292

    
1293
		<copy file="${dist.dir}/knb.war"
1294
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1295
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1296
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1297

    
1298
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1299
			failonerror="true">
1300
			<arg line="--build debian" />
1301
		</exec>
1302

    
1303
		<move file="${pkg.dir}/debian.deb"
1304
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1305
	</target>
1306

    
1307
	<target name="stylesheettest">
1308
		<xslt in="${input}" out="eml.html"
1309
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1310
			<param name="displaymodule" expression="${displaymodule}" />
1311
			<param name="docid" expression="${input}" />
1312
			<param name="entitytype" expression="${entitytype}" />
1313
			<param name="entityindex" expression="${entityindex}" />
1314
			<outputproperty name="method" value="html" />
1315
			<outputproperty name="standalone" value="yes" />
1316
			<outputproperty name="encoding" value="iso8859_1" />
1317
			<outputproperty name="indent" value="yes" />
1318
		</xslt>
1319
	</target>
1320

    
1321

    
1322
	<target name="compilewebclient" depends="prepare">
1323
		<javac srcdir="${build.src}" destdir="${build.dest}"
1324
			includes="**/application/*.java" classpathref="webservicepath" />
1325
	</target>
1326

    
1327
	<target name="runwebclient" depends="compilewebclient">
1328
		<java
1329
			classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1330
			dir="${build.dest}" fork="yes" classpathref="webservicepath"
1331
			classpath="./lib/utilities.jar" failonerror="true">
1332
			<arg value="${serviceUrl}" />
1333
			<arg value="${docid}" />
1334
		</java>
1335
	</target>
1336

    
1337
	<target name="spatial_option" depends="prepare"
1338
		description=" -- compiles code for the spatial option">
1339

    
1340
		<echo message="Compiling the metatcat shapefile creator" />
1341
		<echo message="using the shapelib at: ${shapelib.dir}" />
1342
		<exec dir="." executable="g++" os="Linux, Unix"
1343
			failonerror="true">
1344
			<arg
1345
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1346
		</exec>
1347

    
1348
		<exec dir="." executable="g++" os="Linux, Unix"
1349
			failonerror="true">
1350
			<arg
1351
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1352
		</exec>
1353
	</target>
1354

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

    
1384
	<path id="lsid.classpath">
1385
		<fileset dir="${lsid.lib.dir}">
1386
			<patternset refid="lsid.jars" />
1387
		</fileset>
1388
		<fileset dir="${lib.dir}">
1389
			<patternset refid="lsid.jars" />
1390
		</fileset>
1391
		<fileset dir="${lib.dir}">
1392
			<include name="xalan.jar" />
1393
			<include name="xml-apis.jar" />
1394
		</fileset>
1395
		<fileset dir="${build.dir}">
1396
			<include name="metacat-client.jar" />
1397
		</fileset>
1398
	</path>
1399

    
1400
	<filterset id="configFilters">
1401
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1402
			value="${config.hostname}" / -->
1403
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1404
			value="${config.port}" / -->
1405
		<!-- MCD BYE filter token="METADATA_LABELS"
1406
			value="${config.metadataLabelLsid}" / -->
1407
		<!-- MCD BYE filter token="METACAT_SERVER"
1408
			value="${config.metacatserver}" / -->
1409
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1410
			value="${config.lsidauthority}" / -->
1411
	</filterset>
1412

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

    
1457
	<target name="compile-lsid" depends="prepare-lsid"
1458
		description="Compile Java sources">
1459
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1460
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1461
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1462
			deprecation="${compile.deprecation}"
1463
			optimize="${compile.optimize}">
1464
			<classpath refid="lsid.classpath" />
1465
		</javac>
1466
	</target>
1467

    
1468
	<target name="war-lsid" depends="compile-lsid"
1469
		description="Create a war file for the application">
1470
		<mkdir dir="${dist.dir}" />
1471
		<war destfile="${dist.dir}/${authority.context}.war"
1472
			webxml="${webinf.dir}/web.xml">
1473
			<fileset dir="${lsid.build.dir}" />
1474
			<lib dir="${lsid.lib.dir}">
1475
				<patternset refid="lsid.jars" />
1476
			</lib>
1477
			<lib dir="${lib.dir}">
1478
				<patternset refid="lib.jars" />
1479
			</lib>
1480
			<lib dir="${lib.dir}">
1481
				<include name="xalan.jar" />
1482
				<include name="xml-apis.jar" />
1483
			</lib>
1484
			<lib dir="${build.dir}">
1485
				<include name="metacat-client.jar" />
1486
			</lib>
1487
		</war>
1488
	</target>
1489

    
1490
	<target name="deploy-lsid" depends="war-lsid"
1491
		description="Deploy LSID war to servlet container">
1492
		<delete dir="${app.deploy.dir}/${authority.context}" />
1493
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1494
		<mkdir dir="${app.deploy.dir}" />
1495
		<copy todir="${app.deploy.dir}">
1496
			<fileset dir="${dist.dir}" />
1497
		</copy>
1498
	</target>
1499
</project>
(5-5/6)