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: leinfelder $'
10
	*    '$Date: 2012-02-11 16:56:19 -0800 (Sat, 11 Feb 2012) $'
11
	*    '$Revision: 7011 $'
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|documentation]
17
	*
18
	* This program is free software; you can redistribute it and/or modify
19
	* it under the terms of the GNU General Public License as published by
20
	* the Free Software Foundation; either version 2 of the License, or
21
	* (at your option) any later version.
22
	*
23
	* This program is distributed in the hope that it will be useful,
24
	* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
	* GNU General Public License for more details.
27
	*
28
	* You should have received a copy of the GNU General Public License
29
	* along with this program; if not, write to the Free Software
30
	* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir="."
33
         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
34
	<property environment="env" />
35
	<property file="build.properties" /><!-- USER SPECIFIC PROPS -->
36

    
37

    
38
    <!-- Configure the maven2 ant tasks -->
39
    <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
40
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
41
             uri="antlib:org.apache.maven.artifact.ant"
42
             classpathref="maven-ant-tasks.classpath" />
43

    
44
	<!-- defining the axis tasks -->
45
	<path id="axis.ant.classpath">
46
		<fileset dir="lib/lsid_lib">
47
			<include name="*.jar" />
48
		</fileset>
49
	</path>
50
    	
51
	<taskdef resource="axis-tasks.properties"
52
		classpathref="axis.ant.classpath" />
53
	
54
	<!-- Determine if ecogrid should be installed-->
55
	<condition property="enable.ecogrid">
56
		<equals arg1="${install.ecogrid}" arg2="true" />
57
	</condition>
58

    
59
	<!-- Determine if perl should be built-->
60
	<condition property="build.perl">
61
		<equals arg1="${make.perl.code}" arg2="true" />
62
	</condition>
63

    
64
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
65
			property="tomcat.common.exists" />
66

    
67
	<target name="config" depends="setTomcatCommon, setTomcatNoCommon">
68
		<!-- usr for client testing, generally you don't need change-->
69
		<property name="mcuser"
70
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
71
		<property name="mcpassword" value="kepler" />
72
		<property name="mcanotheruser"
73
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
74
		<property name="mcanotherpassword" value="yourpass" />
75
		<property name="piscouser"
76
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
77
		<property name="piscopassword" value="yourpass" />
78
		<property name="lteruser"
79
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
80
		<property name="lterpassword" value="yourpass" />
81

    
82
		<property name="debug" value="on" />
83
		<property name="morphosourcedir" value="../morpho" />
84
		<property name="utilitiesdir" value="../utilities" />
85
		<property name="installdir"
86
			value="${app.deploy.dir}/${metacat.context}" />
87

    
88
		<echo>*********** set jsdk to ${jsdk}</echo>
89
	</target>
90
	
91
	<target name="setTomcatCommon" if="tomcat.common.exists" >
92
		<property name="jsdk"
93
			value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
94
	</target>
95
	
96
	<target name="setTomcatNoCommon" unless="tomcat.common.exists" >
97
		<property name="jsdk"
98
			value="${build.tomcat.dir}/lib/servlet-api.jar" />
99
	</target>
100
	
101
	<target name="init" depends="config">
102
		<path id="compile.classpath">
103
			<pathelement location="${jsdk}" />
104
			<pathelement location="lib" />
105
			<fileset dir="lib">
106
				<include name="*.jar" />
107
			</fileset>
108
			<fileset dir="lib">
109
				<include name="xalan.jar" />
110
			</fileset>
111
			<fileset dir="lib/lsid_lib">
112
				<include name="*.jar" />
113
			</fileset>
114

    
115
			<!-- Include geoserver, geotools, et. al. -->
116
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
117
				<include name="*.jar" />
118
			</fileset>
119

    
120
			<!-- Include OAI-PMH -->
121
			<fileset dir="lib/oaipmh">
122
				<include name="*.jar" />
123
			</fileset>
124

    
125
		</path>
126
		
127
		<path id="test.classpath">
128
			<pathelement location="${jsdk}" />
129
			<pathelement location="lib" />
130
			<fileset dir="lib">
131
				<include name="*.jar" />
132
				<exclude name="maven-ant-tasks-2.1.0.jar" />
133
			</fileset>
134
			<fileset dir="lib">
135
				<include name="xalan.jar" />
136
			</fileset>
137
			<fileset dir="lib/lsid_lib">
138
				<include name="*.jar" />
139
			</fileset>
140

    
141
			<!-- Include geoserver, geotools, et. al. -->
142
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
143
				<include name="*.jar" />
144
			</fileset>
145
		
146

    
147
			<!-- Include OAI-PMH -->
148
			<fileset dir="lib/oaipmh">
149
				<include name="*.jar" />
150
			</fileset>
151

    
152
		</path>
153

    
154
		<!-- It is less likely you'll need to make any changes from here down,
155
			but customization is possible -->
156
		<property name="name" value="metacat" />
157
		<property name="Name" value="MetaCat" />
158
		<property name="debugprefix" value="${Name}:" />
159
		<property name="release" value="${metacat.version}" />
160
		<tstamp>
161
		    <format property="copyrightyear" pattern="yyyy" locale="en,US"/>
162
		</tstamp>
163
		<property name="copyright" value="${copyrightyear} Regents of the University of California" />
164
		<property name="style-common-relpath" value="/style/common" />
165
		<property name="style-shared-relpath" value="/style/shared" />
166
		<property name="schema-relpath" value="/schema" />
167
		<property name="style-common-cvsrelpath"
168
			value="lib${style-common-relpath}" />
169
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
170
		<property name="style-skins-relpath" value="/style/skins" />
171
		<property name="util-module" value="utilities" />
172
		<!-- property name="utilities-tag" value="trunk" / -->
173
		<property name="utilities-tag" value="tags/UTILITIES_1_1_0" />
174
		<property name="seek-tag" value="tags/ECOGRID_1_2_2" />
175
		<property name="eml-module" value="eml" />
176
		<property name="eml-version" value="2.0.0beta6" />
177
		<property name="eml-beta-tag"
178
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
179
		<property name="eml2_0_0-schema-tag"
180
			value="RELEASE_EML_2_0_0_UPDATE_1" />
181
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
182
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
183
		<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
184
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_0" />
185
		<property name="eml2_0_0namespace"
186
			value="eml://ecoinformatics.org/eml-2.0.0" />
187
		<property name="eml2_0_1namespace"
188
			value="eml://ecoinformatics.org/eml-2.0.1" />
189
		<property name="eml2_1_0namespace"
190
			value="eml://ecoinformatics.org/eml-2.1.0" />
191
		<property name="eml2_1_1namespace"
192
			value="eml://ecoinformatics.org/eml-2.1.1" />
193
		<property name="stmmlnamespace"
194
			value="http://www.xml-cml.org/schema/stmml" />
195
		<property name="eml-css" value="eml_xsl.css" />
196
		<property name="eml-module.default.css" value="default.css" />
197
		<property name="systemidserver" value="" />
198
		<property name="html-path" value="" />
199
		<property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
200

    
201

    
202
		<!-- Config for registry variables -->
203
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
204
		<property name="scope" value="obfs" />
205
		<property name="responseForm" value="genericResponse.tmpl" />
206
		<property name="entryForm" value="entryForm.tmpl" />
207
		<property name="guide" value="genericGuide.tmpl" />
208
		<property name="loginForm" value="loginForm.tmpl" />
209
		<property name="confirmData" value="confirmData.tmpl" />
210
		<property name="deleteData" value="deleteData.tmpl" />
211
		<property name="genericHeader" value="genericHeader.tmpl" />
212
		<property name="genericFooter" value="genericFooter.tmpl" />
213

    
214
		<filter token="scope" value="${scope}" />
215
		<filter token="responseForm" value="${responseForm}" />
216
		<filter token="entryForm" value="${entryForm}" />
217
		<filter token="guide" value="${guide}" />
218
		<filter token="loginForm" value="${loginForm}" />
219
		<filter token="confirmData" value="${confirmData}" />
220
		<filter token="deleteData" value="${deleteData}" />
221
		<filter token="genericHeader" value="${genericHeader}" />
222
		<filter token="genericFooter" value="${genericFooter}" />
223
		<filter token="adminname" value="${adminname}" />
224
		<filter token="recipient" value="${recipient}" />
225
		<filter token="metacatVersion" value="${metacat.version}" />
226
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
227
		<filter token="build.context" value="${metacat.context}" />
228

    
229
		<filter token="docrooturl" value="./" />
230
		<filter token="mcuser" value="${mcuser}" />
231
		<filter token="mcpassword" value="${mcpassword}" />
232
		<filter token="mcanotheruser" value="${mcanotheruser}" />
233
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
234
		<filter token="eml-css" value="${eml-css}" />
235
		<filter token="style-skins-relpath"
236
			value="${style-skins-relpath}" />
237
		<filter token="style-common-relpath"
238
			value="${style-common-relpath}" />
239

    
240
		<filter token="eml-version" value="${eml-version}" />
241
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
242
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
243
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
244
		<filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
245
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
246
		<filter token="debugprefix" value="${debugprefix}" />
247

    
248
		<filter token="defaultStage" value="${defaultStage}" />
249
		<filter token="defaultHeader" value="${defaultHeader}" />
250
		<filter token="defaultFooter" value="${defaultFooter}" />
251
		<filter token="defaultChangePass" value="${defaultChangePass}" />
252
		<filter token="defaultResetPass" value="${defaultResetPass}" />
253
		<filter token="changePassSuccess" value="${changePassSuccess}" />
254
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
255
		<filter token="registerFailed" value="${registerFailed}" />
256
		<filter token="registerLter" value="${registerLter}" />
257
		<filter token="registerMatch" value="${registerMatch}" />
258
		<filter token="registerSuccess" value="${registerSuccess}" />
259
		<filter token="register" value="${register}" />
260
		<filter token="searchResults" value="${searchResults}" />
261
		<filter token="ldapMainServerFailure"
262
			value="${ldapMainServerFailure}" />
263
		<filter token="lter-user" value="${lteruser}" />
264
		<filter token="lter-pass" value="${lterpassword}" />
265
		<filter token="pisco-user" value="${piscouser}" />
266
		<filter token="pisco-pass" value="${piscopassword}" />
267

    
268

    
269
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
270
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
271
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
272

    
273
		<property name="srcdir" value="./src" />
274
		<property name="lib.dir" value="./lib" />
275
		<property name="docdir" value="./docs" />
276
		<property name="cgidir" value="./cgi-bin" />
277
		<property name="testdir" value="./test" />
278
		<property name="testtorun" value="GenerateSystemMetadataTest" />
279
		<property name="junittestsdir"
280
			value="./test/edu/ucsb/nceas/metacattest" />
281
		<property name="junitnettestsdir"
282
			value="./test/edu/ucsb/nceas/metacatnettest" />
283
		<property name="classtorun" value="edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateSystemMetadata" />
284
		<property name="build.dir" value="./build" />
285
		<property name="build.src" value="${build.dir}/src" />
286
		<property name="build.dest" value="${build.dir}/classes" />
287
		<property name="build.samples" value="${build.dir}/samples" />
288
		<property name="build.tests" value="${build.dir}/tests" />
289
		<property name="build.tmp" value="${build.dir}/tmp" />
290
		<property name="build.metacattest"
291
			value="${build.tests}/metacattest" />
292
		<property name="build.metacatnettest"
293
			value="${build.tests}/metacatnettest" />
294
		<property name="build.data" value="${build.dir}/data" />
295
		<property name="build.docs" value="${build.dir}/docs" />
296
		<property name="build.javadocs" value="${build.docs}/api" />
297
		<property name="build.war" value="${build.dir}/war" />
298
		<property name="dist.dir" value="dist" />
299
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
300
		<property name="ver.src" value="${ver.dir}/src" />
301
		<property name="util.dir" value="${dist.dir}/${util-module}" />
302
		<property name="test.dir" value="${dist.dir}/test" />
303
		<!-- directories for creating a Harvest List Editor distribution -->
304
		<property name="dist.dir.hle" value="disthle" />
305
		<property name="ver.dir.hle"
306
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
307
		<property name="pkg.dir" value="./package" />
308
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
309

    
310
		<property name="ecogrid-target-name" value="metacatImpl" />
311
		<property name="ecogrid-module-dest-dir" value=".." />
312
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
313
		<property name="ecogrid-dist-dir"
314
			value="${dist.dir}/${ecogrid-module}" />
315
		<property name="ecogrid-dir"
316
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
317

    
318
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
319

    
320
		<!-- set up svn -->
321
		<property name="svnant.lib" value="lib" />
322
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
323
		<property name="svnClientAdapter.jar"
324
			value="${svnant.lib}/svnClientAdapter.jar" />
325
		<property name="svnjavahl.jar"
326
			value="${svnant.lib}/svnjavahl.jar" />
327
		<property name="svn.utilitiesUrl"
328
			value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
329
		<property name="svn.ecogridUrl"
330
			value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
331
		<property name="svn.emlBetaUrl"
332
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
333
		<property name="svn.eml200SchemaUrl"
334
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
335
		<property name="svn.eml201SchemaUrl"
336
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
337
		<property name="svn.eml210SchemaUrl"
338
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
339
		<property name="svn.eml211SchemaUrl"
340
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
341
		<property name="svn.eml2StyleUrl"
342
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
343

    
344
		<!-- load the svn task -->
345
		<path id="svn.classpath">
346
			<pathelement location="${svnjavahl.jar}" />
347
			<pathelement location="${svnant.jar}" />
348
			<pathelement location="${svnClientAdapter.jar}" />
349
		</path>
350
		<taskdef resource="svntask.properties"
351
			classpathref="svn.classpath" />
352

    
353
		<condition property="utilities.required">
354
			<or>
355
				<not>
356
					<available file="lib/utilities.jar" />
357
				</not>
358
				<not>
359
					<available file="${utilitiesdir}" type="dir" />
360
				</not>
361
			</or>
362
		</condition>
363
		<!-- peer.utilities.required is used when there is no utilities 
364
			directory at ${utilitiesdir} -->
365
		<condition property="peer.utilities.required">
366
			<or>
367
				<not>
368
					<available file="${utilitiesdir}" type="dir" />
369
				</not>
370
			</or>
371
		</condition>
372
		<condition property="eml.required">
373
			<or>
374
				<not>
375
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
376
				</not>
377
				<not>
378
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
379
				</not>
380
				<not>
381
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
382
				</not>
383
				<not>
384
					<available
385
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
386
				</not>
387
			</or>
388
		</condition>
389

    
390
		<condition property="ecogrid.required">
391
			<or>
392
				<not>
393
					<available file="${ecogrid-dir}/build.properties" />
394
				</not>
395
				<not>
396
					<available
397
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
398
				</not>
399
			</or>
400
		</condition>
401

    
402
	</target>
403

    
404
	<target name="prepare" depends="init">
405
		<mkdir dir="${build.dir}" />
406
		<mkdir dir="${build.src}" />
407
		<mkdir dir="${build.dest}" />
408
		<mkdir dir="${build.docs}" />
409
		<mkdir dir="${build.javadocs}" />
410
		<mkdir dir="${build.tmp}" />
411

    
412
		<copy todir="${build.src}" filtering="yes">
413
			<fileset dir="${srcdir}">
414
				<include name="edu/**" />
415
				<include name="com/**" />
416
				<include name="org/**" />
417
				<!-- include name="java/**" / -->
418
				<include name="**/*.sql" />
419
				<exclude name="**/CVS*" />
420
				<exclude name="**/.#*" />
421
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
422
			</fileset>
423
		</copy>
424
		<available file="lib/style/common/emlb6toeml2" type="dir"
425
			property="styles.not.needed" />
426
	</target>
427

    
428
	<target name="generateStubs" depends="prepare">
429
		<echo
430
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
431
		<axis-wsdl2java verbose="true" output="${srcdir}"
432
			url="/tmp/KeplerWebService.wsdl" />
433
	</target>
434

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

    
438
		<javac srcdir="${build.src}" destdir="${build.dest}"
439
			debug="${debug}"
440
			excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
441
			<classpath>
442
				<path refid="compile.classpath" />
443
			</classpath>
444
		</javac>
445
	</target>
446

    
447
	<target name="jar" depends="compile,geteml"
448
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
449

    
450
		<delete file="${build.dir}/${name}.jar" />
451
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
452
			excludes="**/protocols/ **/harvesterClient/" />
453
	</target>
454

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

    
462
	<target name="utilities" depends="config,getpeerutilities"
463
		if="utilities.required">
464
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
465
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
466
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
467
	</target>
468

    
469
	<target name="getpeerutilities" depends="prepare"
470
		if="peer.utilities.required"
471
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
472
		<echo message="Exporting utilities files from svn repository:" />
473
		<svn>
474
			<export srcUrl="${svn.utilitiesUrl}"
475
				destPath="${utilitiesdir}" />
476
		</svn>
477

    
478
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
479
	</target>
480

    
481
	<target name="getutilities" depends="prepare"
482
		description="Checks utility out of svn and copies it to your metacat sandbox">
483
		<svn>
484
			<export srcUrl="${svn.utilitiesUrl}"
485
				destPath="${utilitiesdir}" force="true" />
486
		</svn>
487
	</target>
488

    
489
	<target name="client" depends="utilities, prepare"
490
		description="Compiles metacat-client java code to build dir">
491
		<javac srcdir="${build.src}" destdir="${build.dest}"
492
			includes="edu/ucsb/nceas/metacat/client/*">
493
			<classpath>
494
				<path refid="compile.classpath" />
495
			</classpath>
496
		</javac>
497
	</target>
498

    
499
	<target name="clientjar" depends="client"
500
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
501
		<delete file="${build.dir}/${name}-client.jar" />
502
		<jar jarfile="${build.dir}/${name}-client.jar"
503
			basedir="${build.dest}" includes="**/metacat/client/" />
504
	</target>
505

    
506
	<target name="advancedsearchjar" depends="compile"
507
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
508
		<delete file="${build.dir}/advancedsearch.jar" />
509
		<jar jarfile="${build.dir}/advancedsearch.jar"
510
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
511
	</target>
512

    
513
	<target name="harvester" depends="client"
514
		description="Compiles harvester java code to build dir">
515
		<javac srcdir="${build.src}" destdir="${build.dest}"
516
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
517
			<classpath>
518
				<path refid="compile.classpath" />
519
			</classpath>
520
		</javac>
521
	</target>
522
		
523
	<target name="harvesterjar" depends="harvester"
524
		description="Compiles and jars harvester java code to harvester.jar in build dir">
525
		<delete file="${build.dir}/harvester.jar" />
526
		<jar jarfile="${build.dir}/harvester.jar"
527
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
528
	</target>
529

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

    
554
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
555
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
556

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

    
573
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
574
			<fileset
575
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
576
				<include name="**/*.xsl" />
577
			</fileset>
578
		</copy>
579
	</target>
580

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

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

    
600
		</copy>
601
		<!-- <antcall target="copyxsl">
602
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
603
			<param name="dirname" value="eml-2.0.0" />
604
			</antcall> -->
605

    
606
		<!-- Checkout eml201 for given schema tag-->
607
		<svn>
608
			<export srcUrl="${svn.eml201SchemaUrl}"
609
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
610
		</svn>
611
		<mkdir dir="lib/schema/eml-2.0.1" />
612
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
613
			<fileset
614
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
615
				<include name="*.xsd" />
616
			</fileset>
617
		</copy>
618

    
619
		<!-- Checkout eml201 again for given style sheet tag-->
620
		<!-- echo>Enter CVS password: </echo>
621
			<cvs cvsRoot="${cvsroot}"
622
			package="${eml-module}"
623
			tag="${eml2_0_1-style-tag}"
624
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
625
			<antcall target="copyxsl">
626
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
627
			<param name="dirname" value="eml-2.0.1" />
628
			</antcall -->
629

    
630
		<!-- Checkout eml210 for given schema tag-->
631
		<svn>
632
			<export srcUrl="${svn.eml210SchemaUrl}"
633
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
634
		</svn>
635
		<mkdir dir="lib/schema/eml-2.1.0" />
636
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
637
			<fileset
638
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
639
				<include name="*.xsd" />
640
			</fileset>
641
		</copy>
642

    
643
		<!-- Checkout eml210 for given style sheet tag-->
644
		<svn>
645
			<export srcUrl="${svn.eml2StyleUrl}"
646
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
647
		</svn>
648
		<antcall target="copyxsl">
649
			<param name="cvs.tagname" value="${eml2-style-tag}" />
650
			<!-- param name="dirname" value="eml-2.1.0" / -->
651
			<param name="dirname" value="eml-2" />
652
		</antcall>
653
		
654
		<!-- Checkout eml210 for given schema tag-->
655
		<svn>
656
			<export srcUrl="${svn.eml211SchemaUrl}"
657
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
658
		</svn>
659
		<mkdir dir="lib/schema/eml-2.1.1" />
660
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
661
			<fileset
662
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
663
				<include name="*.xsd" />
664
			</fileset>
665
		</copy>
666
	</target>
667

    
668
	<target name="copyxsl"
669
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
670

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

    
673
		<copy todir="${style-common-cvsrelpath}/${dirname}"
674
			filtering="yes">
675
			<fileset
676
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
677
				<include name="**/*.xsl" />
678
			</fileset>
679
		</copy>
680

    
681

    
682
		<!-- now copy default css from eml module and put it in style-common-path
683
			dir with a new name, so other skin-specific css can import it if reqd -->
684
		<copy
685
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
686
			tofile="${style-common-cvsrelpath}/${eml-css}" />
687

    
688
	</target>
689

    
690
	<target name="correctEML201Docs" depends="jar"
691
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
692
		<copy todir="${build.dir}" file="lib/metacat.properties"
693
			filtering="yes" />
694
		<java
695
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
696
			<classpath>
697
				<path refid="compile.classpath" />
698
				<fileset dir="${build.dir}">
699
					<include name="${name}.jar" />
700
				</fileset>
701
			</classpath>
702
		</java>
703
	</target>
704

    
705
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
706
		description="Installs spatial option for metacat">
707

    
708
		<property name="spatial.dir" value="./lib/spatial" />
709
		<property name="spatial.geoserver.dir"
710
			value="${spatial.dir}/geoserver" />
711
		<property name="spatial.webinf-mods"
712
			value="${spatial.dir}/WEB-INF" />
713

    
714
		<!-- Copy geoserver libs into ${war.lib} -->
715
		<copy todir="${war.lib}" filtering="no">
716
			<fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
717
				<include name="**" />
718
			</fileset>
719
		</copy>
720
		
721
		<copy todir="${dist.dir}">
722
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
723
		</copy>
724

    
725
	</target>
726

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

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

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

    
768

    
769
	</target>
770

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1029
		<svn>
1030
			<export srcUrl="${svn.eml2StyleUrl}"
1031
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1032
		</svn>
1033

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

    
1044
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1045
		<mkdir dir="${build.tests}" />
1046
		<copy todir="${build.tests}" encoding="UTF-8">
1047
			<fileset dir="${testdir}">
1048
				<include name="edu/**" />
1049
			</fileset>
1050
		</copy>
1051
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1052

    
1053
		<path id="test.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
			</fileset>
1060
		</path>
1061
		
1062
		<pathconvert pathsep="${line.separator}|  |--" 
1063
		             property="echo.test.classpath"
1064
		             refid="test.classpath">
1065
		</pathconvert>
1066
		<echo message="|--test classpath" />
1067
		<echo message="|  |" />
1068
		<echo message="|  |-- ${echo.test.classpath}" />
1069
		
1070
		<!-- copy and compile the tests into a jar file -->
1071
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1072
			debug="on" includes="**/*.java" encoding="UTF-8">
1073
			<classpath refid="test.classpath" />
1074
		</javac>
1075

    
1076
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1077
			basedir="${build.tests}" >
1078
			<include name="**/*.class"/>
1079
			<include name="**/*.xml"/>
1080
		</jar>	
1081
		
1082
	</target>
1083

    
1084
	<target name="runoneclass" depends="testprep"
1085
		description="Uses the ant to run a class">
1086
		
1087
		<java classname="${classtorun}" fork="true">
1088
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1089
			<classpath>
1090
				<path refid="test.classpath" />
1091
				<fileset dir="${build.dir}">
1092
					<include name="${name}.jar" />
1093
					<include name="${name}-client.jar" />
1094
					<include name="harvester.jar" />
1095
					<include name="${name}-junittests.jar" />
1096
				</fileset>
1097
			</classpath>
1098
		</java>
1099
	</target>
1100
	
1101
	<target name="test" depends="testprep"
1102
		description="Uses the ant junit task to run all JUnit tests">
1103

    
1104
		<!-- use the ant "junit" task to run JUnit tests. -->
1105
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1106
			haltonerror="no">
1107
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1108
			<classpath>
1109
				<path refid="test.classpath" />
1110
				<fileset dir="${build.dir}">
1111
					<include name="${name}.jar" />
1112
					<include name="${name}-client.jar" />
1113
					<include name="harvester.jar" />
1114
					<include name="${name}-junittests.jar" />
1115
				</fileset>
1116
			</classpath>
1117

    
1118
			<formatter type="plain" />
1119

    
1120
			<batchtest fork="yes" todir="${build.dir}">
1121
				<fileset dir="${build.tests}">
1122
					<include name="**/*.class" />
1123
					<exclude name="**/MCTestCase.class" />
1124
					<exclude name="**/ClientViewHelperTest.class" />
1125
					<!-- these are not test cases -->
1126
					<exclude name="**/MockCNode.class" />
1127
					<exclude name="**/D1NodeServiceTest.class" />
1128
				</fileset>
1129
			</batchtest>
1130
		</junit>
1131
	</target>
1132

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

    
1136
		<echo>testtorun: ${testtorun}</echo>
1137

    
1138
		<!-- use the ant "junit" task to run JUnit tests. -->
1139
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1140
			haltonerror="no" showoutput="yes">
1141
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1142
			<classpath>
1143
				<path refid="test.classpath" />
1144
				<fileset dir="${build.dir}">
1145
					<include name="${name}.jar" />
1146
					<include name="${name}-client.jar" />
1147
					<include name="harvester.jar" />
1148
					<include name="${name}-junittests.jar" />
1149
				</fileset>
1150
			</classpath>
1151

    
1152
			<formatter type="plain" />
1153

    
1154
			<batchtest fork="yes" todir="${build.dir}">
1155
				<fileset dir="${build.tests}">
1156
					<include name="**/${testtorun}.class" />
1157
				</fileset>
1158
			</batchtest>
1159
		</junit>
1160
	</target>
1161
	
1162
	<target name="run" depends="testprep"
1163
			description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1164

    
1165
			<echo>testtorun: ${testtorun}</echo>
1166

    
1167
			<!-- use the ant "junit" task to run JUnit tests. -->
1168
			<junit printsummary="yes" haltonfailure="no" fork="yes"
1169
				haltonerror="no" showoutput="yes">
1170
				<jvmarg value="-Dfile.encoding=UTF-8"/>
1171
				<classpath>
1172
					<path refid="test.classpath" />
1173
					<fileset dir="${build.dir}">
1174
						<include name="${name}.jar" />
1175
						<include name="${name}-client.jar" />
1176
						<include name="harvester.jar" />
1177
						<include name="${name}-junittests.jar" />
1178
					</fileset>
1179
				</classpath>
1180

    
1181
				<formatter type="plain" />
1182

    
1183
				<batchtest fork="yes" todir="${build.dir}">
1184
					<fileset dir="${build.tests}">
1185
						<include name="**/${testtorun}.class" />
1186
					</fileset>
1187
				</batchtest>
1188
			</junit>
1189
		</target>
1190

    
1191
	<target name="testharvester" depends="testprep"
1192
		description="Uses the ant junit task to test only the Harvester code">
1193
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1194
			haltonerror="off">
1195
			<classpath>
1196
				<path refid="compile.classpath" />
1197
				<fileset dir="${build.dir}">
1198
					<include name="${name}.jar" />
1199
					<include name="${name}-client.jar" />
1200
					<include name="harvester.jar" />
1201
					<include name="${name}-junittests.jar" />
1202
				</fileset>
1203
			</classpath>
1204
			<formatter type="plain" />
1205
			<batchtest fork="yes" todir="${build.dir}">
1206
				<fileset dir="${build.tests}">
1207
					<include name="**/harvesterClient/*.class" />
1208
				</fileset>
1209
			</batchtest>
1210
		</junit>
1211
	</target>
1212

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

    
1217
		<echo>
1218
			*********************************** Please run ant
1219
			gethttpclient first! ***********************************
1220
		</echo>
1221
		<!-- copy and compile the tests into a jar file -->
1222
		<mkdir dir="${build.metacatnettest}" />
1223
		<javac srcdir="${junitnettestsdir}"
1224
			destdir="${build.metacatnettest}" includes="**/*.java">
1225
			<classpath>
1226
				<path refid="compile.classpath" />
1227
				<fileset dir="${build.dir}">
1228
					<include name="${name}.jar" />
1229
				</fileset>
1230
			</classpath>
1231
		</javac>
1232

    
1233
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1234
			basedir="${build.metacatnettest}" includes="**/*.class" />
1235

    
1236
		<!-- use the ant "junit" task to run JUnit tests. -->
1237
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1238
			haltonerror="no">
1239
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1240
			<classpath>
1241
				<path refid="compile.classpath" />
1242
				<fileset dir="${build.dir}">
1243
					<include name="${name}.jar" />
1244
					<include name="${name}-junitnettests.jar" />
1245
				</fileset>
1246
			</classpath>
1247

    
1248
			<formatter type="plain" />
1249

    
1250
			<batchtest fork="yes" todir="${build.dir}">
1251
				<fileset dir="${build.metacatnettest}">
1252
					<include name="**/*.class" />
1253
				</fileset>
1254
			</batchtest>
1255
		</junit>
1256
	</target>
1257

    
1258
	<target name="cleanweb" depends="clean"
1259
		description="deletes tomcat web context dir and all its contents">
1260
		<delete dir="${installdir}" />
1261
	</target>
1262

    
1263

    
1264
	<target name="clean" depends="init"
1265
		description="deletes build dir and files that can be regenerated form the release">
1266
		<delete dir="${build.dir}" />
1267
		<delete dir="${dist.dir}" />
1268
	</target>
1269

    
1270
	<target name="localclean" depends="clean"
1271
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1272
		<delete file="lib/utilities.jar" />
1273
	</target>
1274

    
1275
	<target name="fullclean" depends="localclean"
1276
		description="deletes code and eml">
1277
		<delete includeEmptyDirs="true" failonerror="false">
1278
			<fileset dir="${style-common-cvsrelpath}">
1279
				<include name="${eml-css}" />
1280
				<include name="eml-*/*.xsl" />
1281
				<include name="eml-*" />
1282
			</fileset>
1283
			<fileset dir="${schema-cvsrelpath}">
1284
				<include name="eml-*/*.xsd" />
1285
			</fileset>
1286
			<fileset dir="${ecogrid-dir}"/>
1287
			<fileset dir="lib/style/common/emlb6toeml2"/>
1288
			<fileset dir="lib/dtd"/>
1289
			<fileset dir="lib/schema"/>
1290
			<fileset dir="${utilitiesdir}"/>
1291
		</delete>
1292
	</target>
1293
	
1294
	<target name="documentation" depends="javadoc,admindoc"
1295
	    description="generates Javadoc API documentation and Admin Guide">
1296
    </target>
1297
	
1298
	<target name="admindoc" depends="prepare">
1299
		<!-- Build the administrator's guide, which is a Sphinx RST project
1300
		     For this to succeed, you must have Sphinx installed on your machine
1301
		     See: http://sphinx.pocoo.org/ for details
1302
		     And you must also have the 'make' build tool installed
1303
		-->
1304
		<exec dir="${docdir}/user/metacat" executable="make"> 
1305
		        <arg value="html"/> 
1306
		</exec>
1307
    </target>
1308

    
1309
	<target name="javadoc" depends="prepare"
1310
		description="generates Javadoc API documentation">
1311
		<javadoc packagenames="edu.ucsb.nceas.*"
1312
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1313
			version="true" use="true" windowtitle="${Name} API"
1314
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1315
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1316
			<classpath>
1317
				<path refid="compile.classpath" />
1318
			</classpath>
1319
		</javadoc>
1320
	</target>
1321

    
1322
	<target name="dist"
1323
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL,getutilities"
1324
		description="prepares a full release distribution">
1325
		<mkdir dir="${dist.dir}" />
1326
		<delete dir="${ver.dir}" />
1327
		<mkdir dir="${ver.dir}" />
1328
		<copy todir="${ver.dir}">
1329
			<fileset dir="."
1330
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1331
		</copy>
1332
		<copy todir="${ver.dir}" file="build.xml" />
1333
		<copy todir="${ver.dir}" file="build.properties" />
1334

    
1335
		<copy todir="${ver.dir}/docs" filtering="yes">
1336
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1337
		</copy>
1338
		<copy todir="${ver.dir}/docs" filtering="no">
1339
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1340
		</copy>
1341
		<copy todir="${ver.dir}/docs/dev">
1342
			<fileset dir="${build.dir}/docs" />
1343
		</copy>
1344
		<copy todir="${ver.dir}/src">
1345
			<fileset dir="${build.dir}/src" />
1346
		</copy>
1347

    
1348
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1349
		<copy todir="${ver.dir}/test/servertestfiles">
1350
			<fileset dir="./test/servertestfiles" />
1351
		</copy>
1352
	</target>
1353

    
1354
	<target name="distbin" depends="build-metacat,war-lsid"
1355
		description="prepares a binary distribution">
1356
		<copy todir="${dist.dir}">
1357
			<fileset dir="./src/scripts" />
1358
		</copy>
1359
		<delete file="./${name}-bin-${release}.zip" />
1360
		<zip zipfile="./${name}-bin-${release}.zip"
1361
			basedir="${dist.dir}" excludes="metacat-*/**" />
1362
		<delete file="./${name}-bin-${release}.tar.gz" />
1363
		<tar tarfile="./${name}-bin-${release}.tar"
1364
			basedir="${dist.dir}" excludes="metacat-*/**" />
1365
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1366
			src="./${name}-bin-${release}.tar" />
1367
		<delete file="./${name}-bin-${release}.tar" />
1368
	</target>
1369

    
1370
	<target name="distsrc" depends="dist"
1371
		description="prepares a source distribution">
1372
		<mkdir dir="${ver.src}" />
1373
		<copy todir="${ver.src}">
1374
			<fileset dir="./src" />
1375
		</copy>
1376
		<mkdir dir="${util.dir}" />
1377
		<copy todir="${util.dir}">
1378
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1379
		</copy>
1380

    
1381
		<mkdir dir="${ecogrid-dist-dir}" />
1382
		<copy todir="${ecogrid-dist-dir}">
1383
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1384
		</copy>
1385

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

    
1388
		<delete file="./${name}-src-${release}.zip" />
1389
		<zip zipfile="./${name}-src-${release}.zip"
1390
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1391
		<delete file="./${name}-src-${release}.tar.gz" />
1392
		<tar tarfile="./${name}-src-${release}.tar"
1393
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1394
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1395
			src="./${name}-src-${release}.tar" />
1396
		<delete file="./${name}-src-${release}.tar" />
1397
		<!--delete dir="${dist.dir}"/ -->
1398
	</target>
1399

    
1400
	<target name="deb-package" depends="distbin"
1401
		description="create a debian installation package">
1402
		<delete dir="${deb.pkg.dir}" />
1403
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1404
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1405
			<fileset dir="./src/scripts/debian"
1406
				includes="control postinst" />
1407
		</copy>
1408

    
1409
		<mkdir
1410
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1411
		<copy
1412
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1413
			filtering="yes">
1414
			<fileset dir="./src/scripts/debian"
1415
				excludes="control postinst" />
1416
		</copy>
1417
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1418

    
1419
		<copy file="${dist.dir}/knb.war"
1420
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1421
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1422
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1423

    
1424
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1425
			failonerror="true">
1426
			<arg line="--build debian" />
1427
		</exec>
1428

    
1429
		<move file="${pkg.dir}/debian.deb"
1430
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1431
	</target>
1432

    
1433
	<target name="stylesheettest">
1434
		<xslt in="${input}" out="eml.html"
1435
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1436
			<param name="displaymodule" expression="${displaymodule}" />
1437
			<param name="docid" expression="${input}" />
1438
			<param name="entitytype" expression="${entitytype}" />
1439
			<param name="entityindex" expression="${entityindex}" />
1440
			<outputproperty name="method" value="html" />
1441
			<outputproperty name="standalone" value="yes" />
1442
			<outputproperty name="encoding" value="iso8859_1" />
1443
			<outputproperty name="indent" value="yes" />
1444
		</xslt>
1445
	</target>
1446

    
1447
	<target name="spatial_option" depends="prepare"
1448
		description=" -- compiles code for the spatial option">
1449

    
1450
		<echo message="Compiling the metatcat shapefile creator" />
1451
		<echo message="using the shapelib at: ${shapelib.dir}" />
1452
		<exec dir="." executable="g++" os="Linux, Unix"
1453
			failonerror="true">
1454
			<arg
1455
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1456
		</exec>
1457

    
1458
		<exec dir="." executable="g++" os="Linux, Unix"
1459
			failonerror="true">
1460
			<arg
1461
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1462
		</exec>
1463
	</target>
1464

    
1465
	<!-- LSID Authority support -->
1466
	<patternset id="lsid.jars">
1467
		<include name="axis.jar" />
1468
		<include name="commons-discovery-0.2.jar" />
1469
		<include name="jaxrpc.jar" />
1470
		<include name="lsid-client-1.1.1.jar" />
1471
		<include name="lsid-server-1.1.1.jar" />
1472
		<include name="saaj.jar" />
1473
		<include name="wsdl4j-1.5.1.jar" />
1474
		<include name="activation.jar" />
1475
		<include name="castor-0.9.5.jar" />
1476
		<include name="dnsjava-1.3.2.jar" />
1477
		<include name="mail.jar" />
1478
		<include name="commons-logging-1.0.4.jar" />
1479
		<!-- These jars may be needed but seem to not actually be,
1480
			so leaving them out for now
1481
			<include name="axis-ant.jar" />
1482
		-->
1483
		<!--<include name="GenCastor.class" />-->
1484
	</patternset>
1485
	<patternset id="lib.jars">
1486
		<include name="log4j-1.2.12.jar" />
1487
		<include name="utilities.jar" />
1488
		<include name="xerces*.jar" />
1489
		<include name="xalan*.jar" />
1490
		<include name="xml-apis.jar" />
1491
	</patternset>
1492

    
1493
	<path id="lsid.classpath">
1494
		<fileset dir="${lsid.lib.dir}">
1495
			<patternset refid="lsid.jars" />
1496
		</fileset>
1497
		<fileset dir="${lib.dir}">
1498
			<patternset refid="lib.jars" />
1499
		</fileset>
1500
		<fileset dir="${build.dir}">
1501
			<include name="metacat-client.jar" />
1502
			<include name="metacat.jar" />
1503
		</fileset>
1504
	</path>
1505

    
1506
	<filterset id="configFilters">
1507
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1508
			value="${config.hostname}" / -->
1509
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1510
			value="${config.port}" / -->
1511
		<!-- MCD BYE filter token="METADATA_LABELS"
1512
			value="${config.metadataLabelLsid}" / -->
1513
		<!-- MCD BYE filter token="METACAT_SERVER"
1514
			value="${config.metacatserver}" / -->
1515
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1516
			value="${config.lsidauthority}" / -->
1517
	</filterset>
1518

    
1519
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1520
		description="Configure files prior to compilation">
1521
		<mkdir dir="${lsid.build.dir}" />
1522
		<!-- Copy the properties file into the build -->
1523
		<copy file="${conf.dir}/metacat-lsid.properties"
1524
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1525
			overwrite="true">
1526
			<filterset refid="configFilters" />
1527
		</copy>
1528
		<copy file="${conf.dir}/log4j.properties"
1529
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1530
			overwrite="true">
1531
			<filterset refid="configFilters" />
1532
		</copy>
1533
		<!-- Copy config files into the build -->
1534
		<copy todir="${lsid.build.dir}/WEB-INF">
1535
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1536
		</copy>
1537
		<!-- Copy the metadata configuration files into the build -->
1538
		<mkdir
1539
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1540
		<copy
1541
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1542
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1543
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1544
			<filterset refid="configFilters" />
1545
		</copy>
1546
		<!-- Copy services files into the build -->
1547
		<mkdir dir="${lsid.build.dir}/services" />
1548
		<copy todir="${lsid.build.dir}/services">
1549
			<fileset dir="${services.dir}" />
1550
			<filterset refid="configFilters" />
1551
		</copy>
1552
		<!-- Copy axis files into the build -->
1553
		<mkdir dir="${lsid.build.dir}" />
1554
		<copy todir="${lsid.build.dir}">
1555
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1556
		</copy>
1557
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1558
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1559
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1560
		</copy>
1561
	</target>
1562

    
1563
	<target name="compile-lsid" depends="prepare-lsid"
1564
		description="Compile Java sources">
1565
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1566
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1567
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1568
			deprecation="${compile.deprecation}"
1569
			optimize="${compile.optimize}">
1570
			<classpath refid="lsid.classpath" />
1571
		</javac>
1572
	</target>
1573

    
1574
	<target name="war-lsid" depends="compile-lsid"
1575
		description="Create a war file for the application">
1576
		<mkdir dir="${dist.dir}" />
1577
		<war destfile="${dist.dir}/${authority.context}.war"
1578
			webxml="${webinf.dir}/web.xml">
1579
			<fileset dir="${lsid.build.dir}" />
1580
			<lib dir="${lsid.lib.dir}">
1581
				<patternset refid="lsid.jars" />
1582
			</lib>
1583
			<lib dir="${lib.dir}">
1584
				<patternset refid="lib.jars" />
1585
			</lib>
1586
			<lib dir="${lib.dir}">
1587
				<include name="xalan.jar" />
1588
				<include name="xml-apis.jar" />
1589
			</lib>
1590
			<lib dir="${build.dir}">
1591
				<include name="metacat-client.jar" />
1592
			</lib>
1593
		</war>
1594
	</target>
1595

    
1596
	<target name="deploy-lsid" depends="war-lsid"
1597
		description="Deploy LSID war to servlet container">
1598
		<delete dir="${app.deploy.dir}/${authority.context}" />
1599
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1600
		<mkdir dir="${app.deploy.dir}" />
1601
		<copy todir="${app.deploy.dir}">
1602
			<fileset dir="${dist.dir}" />
1603
		</copy>
1604
	</target>
1605
	
1606
	<target name="change-metacat-properties" depends="warPrepare"
1607
        description="Chage some default values of metacat.properties">
1608
       <echo file="${metacat-properties-file}" append="true">
1609
		   configutil.propertiesConfigured=true
1610
		   configutil.authConfigured=true
1611
           configutil.skinsConfigured=true
1612
		   configutil.databaseConfigured=true
1613
		   configutil.geoserverConfigured=true
1614
	   </echo>
1615
  </target>
1616
	
1617
	<!-- This target will use default values in svn metacat.properties to build a configured 
1618
		metacat (except configuti.* properties, they will be set true). Those default settings
1619
		are for a test machine. It may not work on your system-->
1620
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1621
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1622
    </target>
1623
	
1624
</project>
(5-5/6)