Project

General

Profile

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

    
36

    
37

    
38

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

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

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

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

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

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

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

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

    
101
		</path>
102

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

    
140

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

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

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

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

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

    
206

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

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

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

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

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

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

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

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

    
330
	</target>
331

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
599

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

    
606
	</target>
607

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

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

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

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

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

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

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

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

    
667
	</target>
668

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

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

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

    
706

    
707
	</target>
708

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

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

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

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

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

    
771

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

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

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

    
822
		<echo message="Install Skin completed." />
823
	</target>
824

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1060
			<formatter type="plain" />
1061

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

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

    
1075
		<echo>testtorun: ${testtorun}</echo>
1076

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

    
1091
			<formatter type="plain" />
1092

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

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

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

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

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

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

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

    
1165
			<formatter type="plain" />
1166

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

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

    
1180

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1349

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

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

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

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

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

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

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

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

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

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

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

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