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-01-30 14:49:00 -0800 (Mon, 30 Jan 2012) $'
11
	*    '$Revision: 6966 $'
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.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="runonetest" depends="testprep"
1102
		description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1103

    
1104
		<echo>testtorun: ${testtorun}</echo>
1105

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

    
1120
			<formatter type="plain" />
1121

    
1122
			<batchtest fork="yes" todir="${build.dir}">
1123
				<fileset dir="${build.tests}">
1124
					<include name="**/${testtorun}.class" />
1125
				</fileset>
1126
			</batchtest>
1127
		</junit>
1128
	</target>
1129
	
1130
	<target name="run" depends="testprep"
1131
			description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1132

    
1133
			<echo>testtorun: ${testtorun}</echo>
1134

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

    
1149
				<formatter type="plain" />
1150

    
1151
				<batchtest fork="yes" todir="${build.dir}">
1152
					<fileset dir="${build.tests}">
1153
						<include name="**/${testtorun}.class" />
1154
					</fileset>
1155
				</batchtest>
1156
			</junit>
1157
		</target>
1158

    
1159
	<target name="testharvester" depends="testprep"
1160
		description="Uses the ant junit task to test only the Harvester code">
1161
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1162
			haltonerror="off">
1163
			<classpath>
1164
				<path refid="compile.classpath" />
1165
				<fileset dir="${build.dir}">
1166
					<include name="${name}.jar" />
1167
					<include name="${name}-client.jar" />
1168
					<include name="harvester.jar" />
1169
					<include name="${name}-junittests.jar" />
1170
				</fileset>
1171
			</classpath>
1172
			<formatter type="plain" />
1173
			<batchtest fork="yes" todir="${build.dir}">
1174
				<fileset dir="${build.tests}">
1175
					<include name="**/harvesterClient/*.class" />
1176
				</fileset>
1177
			</batchtest>
1178
		</junit>
1179
	</target>
1180

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

    
1185
		<echo>
1186
			*********************************** Please run ant
1187
			gethttpclient first! ***********************************
1188
		</echo>
1189
		<!-- copy and compile the tests into a jar file -->
1190
		<mkdir dir="${build.metacatnettest}" />
1191
		<javac srcdir="${junitnettestsdir}"
1192
			destdir="${build.metacatnettest}" includes="**/*.java">
1193
			<classpath>
1194
				<path refid="compile.classpath" />
1195
				<fileset dir="${build.dir}">
1196
					<include name="${name}.jar" />
1197
				</fileset>
1198
			</classpath>
1199
		</javac>
1200

    
1201
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1202
			basedir="${build.metacatnettest}" includes="**/*.class" />
1203

    
1204
		<!-- use the ant "junit" task to run JUnit tests. -->
1205
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1206
			haltonerror="no">
1207
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1208
			<classpath>
1209
				<path refid="compile.classpath" />
1210
				<fileset dir="${build.dir}">
1211
					<include name="${name}.jar" />
1212
					<include name="${name}-junitnettests.jar" />
1213
				</fileset>
1214
			</classpath>
1215

    
1216
			<formatter type="plain" />
1217

    
1218
			<batchtest fork="yes" todir="${build.dir}">
1219
				<fileset dir="${build.metacatnettest}">
1220
					<include name="**/*.class" />
1221
				</fileset>
1222
			</batchtest>
1223
		</junit>
1224
	</target>
1225

    
1226
	<target name="cleanweb" depends="clean"
1227
		description="deletes tomcat web context dir and all its contents">
1228
		<delete dir="${installdir}" />
1229
	</target>
1230

    
1231

    
1232
	<target name="clean" depends="init"
1233
		description="deletes build dir and files that can be regenerated form the release">
1234
		<delete dir="${build.dir}" />
1235
		<delete dir="${dist.dir}" />
1236
	</target>
1237

    
1238
	<target name="localclean" depends="clean"
1239
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1240
		<delete file="lib/utilities.jar" />
1241
	</target>
1242

    
1243
	<target name="fullclean" depends="localclean"
1244
		description="deletes code and eml">
1245
		<delete includeEmptyDirs="true" failonerror="false">
1246
			<fileset dir="${style-common-cvsrelpath}">
1247
				<include name="${eml-css}" />
1248
				<include name="eml-*/*.xsl" />
1249
				<include name="eml-*" />
1250
			</fileset>
1251
			<fileset dir="${schema-cvsrelpath}">
1252
				<include name="eml-*/*.xsd" />
1253
			</fileset>
1254
			<fileset dir="${ecogrid-dir}"/>
1255
			<fileset dir="lib/style/common/emlb6toeml2"/>
1256
			<fileset dir="lib/dtd"/>
1257
			<fileset dir="lib/schema"/>
1258
			<fileset dir="${utilitiesdir}"/>
1259
		</delete>
1260
	</target>
1261
	
1262
	<target name="documentation" depends="javadoc,admindoc"
1263
	    description="generates Javadoc API documentation and Admin Guide">
1264
    </target>
1265
	
1266
	<target name="admindoc" depends="prepare">
1267
		<!-- Build the administrator's guide, which is a Sphinx RST project
1268
		     For this to succeed, you must have Sphinx installed on your machine
1269
		     See: http://sphinx.pocoo.org/ for details
1270
		     And you must also have the 'make' build tool installed
1271
		-->
1272
		<exec dir="${docdir}/user/metacat" executable="make"> 
1273
		        <arg value="html"/> 
1274
		</exec>
1275
    </target>
1276

    
1277
	<target name="javadoc" depends="prepare"
1278
		description="generates Javadoc API documentation">
1279
		<javadoc packagenames="edu.ucsb.nceas.*"
1280
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1281
			version="true" use="true" windowtitle="${Name} API"
1282
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1283
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1284
			<classpath>
1285
				<path refid="compile.classpath" />
1286
			</classpath>
1287
		</javadoc>
1288
	</target>
1289

    
1290
	<target name="dist"
1291
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL,getutilities"
1292
		description="prepares a full release distribution">
1293
		<mkdir dir="${dist.dir}" />
1294
		<delete dir="${ver.dir}" />
1295
		<mkdir dir="${ver.dir}" />
1296
		<copy todir="${ver.dir}">
1297
			<fileset dir="."
1298
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1299
		</copy>
1300
		<copy todir="${ver.dir}" file="build.xml" />
1301
		<copy todir="${ver.dir}" file="build.properties" />
1302

    
1303
		<copy todir="${ver.dir}/docs" filtering="yes">
1304
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1305
		</copy>
1306
		<copy todir="${ver.dir}/docs" filtering="no">
1307
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1308
		</copy>
1309
		<copy todir="${ver.dir}/docs/dev">
1310
			<fileset dir="${build.dir}/docs" />
1311
		</copy>
1312
		<copy todir="${ver.dir}/src">
1313
			<fileset dir="${build.dir}/src" />
1314
		</copy>
1315

    
1316
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1317
		<copy todir="${ver.dir}/test/servertestfiles">
1318
			<fileset dir="./test/servertestfiles" />
1319
		</copy>
1320
	</target>
1321

    
1322
	<target name="distbin" depends="build-metacat,war-lsid"
1323
		description="prepares a binary distribution">
1324
		<copy todir="${dist.dir}">
1325
			<fileset dir="./src/scripts" />
1326
		</copy>
1327
		<delete file="./${name}-bin-${release}.zip" />
1328
		<zip zipfile="./${name}-bin-${release}.zip"
1329
			basedir="${dist.dir}" excludes="metacat-*/**" />
1330
		<delete file="./${name}-bin-${release}.tar.gz" />
1331
		<tar tarfile="./${name}-bin-${release}.tar"
1332
			basedir="${dist.dir}" excludes="metacat-*/**" />
1333
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1334
			src="./${name}-bin-${release}.tar" />
1335
		<delete file="./${name}-bin-${release}.tar" />
1336
	</target>
1337

    
1338
	<target name="distsrc" depends="dist"
1339
		description="prepares a source distribution">
1340
		<mkdir dir="${ver.src}" />
1341
		<copy todir="${ver.src}">
1342
			<fileset dir="./src" />
1343
		</copy>
1344
		<mkdir dir="${util.dir}" />
1345
		<copy todir="${util.dir}">
1346
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1347
		</copy>
1348

    
1349
		<mkdir dir="${ecogrid-dist-dir}" />
1350
		<copy todir="${ecogrid-dist-dir}">
1351
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1352
		</copy>
1353

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

    
1356
		<delete file="./${name}-src-${release}.zip" />
1357
		<zip zipfile="./${name}-src-${release}.zip"
1358
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1359
		<delete file="./${name}-src-${release}.tar.gz" />
1360
		<tar tarfile="./${name}-src-${release}.tar"
1361
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1362
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1363
			src="./${name}-src-${release}.tar" />
1364
		<delete file="./${name}-src-${release}.tar" />
1365
		<!--delete dir="${dist.dir}"/ -->
1366
	</target>
1367

    
1368
	<target name="deb-package" depends="distbin"
1369
		description="create a debian installation package">
1370
		<delete dir="${deb.pkg.dir}" />
1371
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1372
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1373
			<fileset dir="./src/scripts/debian"
1374
				includes="control postinst" />
1375
		</copy>
1376

    
1377
		<mkdir
1378
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1379
		<copy
1380
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1381
			filtering="yes">
1382
			<fileset dir="./src/scripts/debian"
1383
				excludes="control postinst" />
1384
		</copy>
1385
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1386

    
1387
		<copy file="${dist.dir}/knb.war"
1388
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1389
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1390
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1391

    
1392
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1393
			failonerror="true">
1394
			<arg line="--build debian" />
1395
		</exec>
1396

    
1397
		<move file="${pkg.dir}/debian.deb"
1398
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1399
	</target>
1400

    
1401
	<target name="stylesheettest">
1402
		<xslt in="${input}" out="eml.html"
1403
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1404
			<param name="displaymodule" expression="${displaymodule}" />
1405
			<param name="docid" expression="${input}" />
1406
			<param name="entitytype" expression="${entitytype}" />
1407
			<param name="entityindex" expression="${entityindex}" />
1408
			<outputproperty name="method" value="html" />
1409
			<outputproperty name="standalone" value="yes" />
1410
			<outputproperty name="encoding" value="iso8859_1" />
1411
			<outputproperty name="indent" value="yes" />
1412
		</xslt>
1413
	</target>
1414

    
1415
	<target name="spatial_option" depends="prepare"
1416
		description=" -- compiles code for the spatial option">
1417

    
1418
		<echo message="Compiling the metatcat shapefile creator" />
1419
		<echo message="using the shapelib at: ${shapelib.dir}" />
1420
		<exec dir="." executable="g++" os="Linux, Unix"
1421
			failonerror="true">
1422
			<arg
1423
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1424
		</exec>
1425

    
1426
		<exec dir="." executable="g++" os="Linux, Unix"
1427
			failonerror="true">
1428
			<arg
1429
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1430
		</exec>
1431
	</target>
1432

    
1433
	<!-- LSID Authority support -->
1434
	<patternset id="lsid.jars">
1435
		<include name="axis.jar" />
1436
		<include name="commons-discovery-0.2.jar" />
1437
		<include name="jaxrpc.jar" />
1438
		<include name="lsid-client-1.1.1.jar" />
1439
		<include name="lsid-server-1.1.1.jar" />
1440
		<include name="saaj.jar" />
1441
		<include name="wsdl4j-1.5.1.jar" />
1442
		<include name="activation.jar" />
1443
		<include name="castor-0.9.5.jar" />
1444
		<include name="dnsjava-1.3.2.jar" />
1445
		<include name="mail.jar" />
1446
		<include name="commons-logging-1.0.4.jar" />
1447
		<!-- These jars may be needed but seem to not actually be,
1448
			so leaving them out for now
1449
			<include name="axis-ant.jar" />
1450
		-->
1451
		<!--<include name="GenCastor.class" />-->
1452
	</patternset>
1453
	<patternset id="lib.jars">
1454
		<include name="log4j-1.2.12.jar" />
1455
		<include name="utilities.jar" />
1456
		<include name="xerces*.jar" />
1457
		<include name="xalan*.jar" />
1458
		<include name="xml-apis.jar" />
1459
	</patternset>
1460

    
1461
	<path id="lsid.classpath">
1462
		<fileset dir="${lsid.lib.dir}">
1463
			<patternset refid="lsid.jars" />
1464
		</fileset>
1465
		<fileset dir="${lib.dir}">
1466
			<patternset refid="lib.jars" />
1467
		</fileset>
1468
		<fileset dir="${build.dir}">
1469
			<include name="metacat-client.jar" />
1470
			<include name="metacat.jar" />
1471
		</fileset>
1472
	</path>
1473

    
1474
	<filterset id="configFilters">
1475
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1476
			value="${config.hostname}" / -->
1477
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1478
			value="${config.port}" / -->
1479
		<!-- MCD BYE filter token="METADATA_LABELS"
1480
			value="${config.metadataLabelLsid}" / -->
1481
		<!-- MCD BYE filter token="METACAT_SERVER"
1482
			value="${config.metacatserver}" / -->
1483
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1484
			value="${config.lsidauthority}" / -->
1485
	</filterset>
1486

    
1487
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1488
		description="Configure files prior to compilation">
1489
		<mkdir dir="${lsid.build.dir}" />
1490
		<!-- Copy the properties file into the build -->
1491
		<copy file="${conf.dir}/metacat-lsid.properties"
1492
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1493
			overwrite="true">
1494
			<filterset refid="configFilters" />
1495
		</copy>
1496
		<copy file="${conf.dir}/log4j.properties"
1497
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1498
			overwrite="true">
1499
			<filterset refid="configFilters" />
1500
		</copy>
1501
		<!-- Copy config files into the build -->
1502
		<copy todir="${lsid.build.dir}/WEB-INF">
1503
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1504
		</copy>
1505
		<!-- Copy the metadata configuration files into the build -->
1506
		<mkdir
1507
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1508
		<copy
1509
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1510
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1511
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1512
			<filterset refid="configFilters" />
1513
		</copy>
1514
		<!-- Copy services files into the build -->
1515
		<mkdir dir="${lsid.build.dir}/services" />
1516
		<copy todir="${lsid.build.dir}/services">
1517
			<fileset dir="${services.dir}" />
1518
			<filterset refid="configFilters" />
1519
		</copy>
1520
		<!-- Copy axis files into the build -->
1521
		<mkdir dir="${lsid.build.dir}" />
1522
		<copy todir="${lsid.build.dir}">
1523
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1524
		</copy>
1525
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1526
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1527
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1528
		</copy>
1529
	</target>
1530

    
1531
	<target name="compile-lsid" depends="prepare-lsid"
1532
		description="Compile Java sources">
1533
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1534
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1535
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1536
			deprecation="${compile.deprecation}"
1537
			optimize="${compile.optimize}">
1538
			<classpath refid="lsid.classpath" />
1539
		</javac>
1540
	</target>
1541

    
1542
	<target name="war-lsid" depends="compile-lsid"
1543
		description="Create a war file for the application">
1544
		<mkdir dir="${dist.dir}" />
1545
		<war destfile="${dist.dir}/${authority.context}.war"
1546
			webxml="${webinf.dir}/web.xml">
1547
			<fileset dir="${lsid.build.dir}" />
1548
			<lib dir="${lsid.lib.dir}">
1549
				<patternset refid="lsid.jars" />
1550
			</lib>
1551
			<lib dir="${lib.dir}">
1552
				<patternset refid="lib.jars" />
1553
			</lib>
1554
			<lib dir="${lib.dir}">
1555
				<include name="xalan.jar" />
1556
				<include name="xml-apis.jar" />
1557
			</lib>
1558
			<lib dir="${build.dir}">
1559
				<include name="metacat-client.jar" />
1560
			</lib>
1561
		</war>
1562
	</target>
1563

    
1564
	<target name="deploy-lsid" depends="war-lsid"
1565
		description="Deploy LSID war to servlet container">
1566
		<delete dir="${app.deploy.dir}/${authority.context}" />
1567
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1568
		<mkdir dir="${app.deploy.dir}" />
1569
		<copy todir="${app.deploy.dir}">
1570
			<fileset dir="${dist.dir}" />
1571
		</copy>
1572
	</target>
1573
	
1574
	<target name="change-metacat-properties" depends="warPrepare"
1575
        description="Chage some default values of metacat.properties">
1576
       <echo file="${metacat-properties-file}" append="true">
1577
		   configutil.propertiesConfigured=true
1578
		   configutil.authConfigured=true
1579
           configutil.skinsConfigured=true
1580
		   configutil.databaseConfigured=true
1581
		   configutil.geoserverConfigured=true
1582
	   </echo>
1583
  </target>
1584
	
1585
	<!-- This target will use default values in svn metacat.properties to build a configured 
1586
		metacat (except configuti.* properties, they will be set true). Those default settings
1587
		are for a test machine. It may not work on your system-->
1588
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1589
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1590
    </target>
1591
	
1592
</project>
(5-5/6)