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: jones $'
10
	*    '$Date: 2012-01-12 18:03:36 -0800 (Thu, 12 Jan 2012) $'
11
	*    '$Revision: 6897 $'
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="branches/UTILITIES_1_1_0_RC3" />
174
		<property name="seek-tag" value="tags/ECOGRID_1_2_2_RC5" />
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_RC_2" />
184
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_0_RC13" />
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="QueryGroupTest" />
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="build.dir" value="./build" />
284
		<property name="build.src" value="${build.dir}/src" />
285
		<property name="build.dest" value="${build.dir}/classes" />
286
		<property name="build.samples" value="${build.dir}/samples" />
287
		<property name="build.tests" value="${build.dir}/tests" />
288
		<property name="build.tmp" value="${build.dir}/tmp" />
289
		<property name="build.metacattest"
290
			value="${build.tests}/metacattest" />
291
		<property name="build.metacatnettest"
292
			value="${build.tests}/metacatnettest" />
293
		<property name="build.data" value="${build.dir}/data" />
294
		<property name="build.javadocs" value="${build.dir}/docs/api" />
295
		<property name="build.war" value="${build.dir}/war" />
296
		<property name="dist.dir" value="dist" />
297
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
298
		<property name="ver.src" value="${ver.dir}/src" />
299
		<property name="util.dir" value="${dist.dir}/${util-module}" />
300
		<property name="test.dir" value="${dist.dir}/test" />
301
		<!-- directories for creating a Harvest List Editor distribution -->
302
		<property name="dist.dir.hle" value="disthle" />
303
		<property name="ver.dir.hle"
304
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
305
		<property name="pkg.dir" value="./package" />
306
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
307

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

    
316
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
317

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

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

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

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

    
400
	</target>
401

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

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

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

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

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

    
444
	<target name="jar" depends="compile,geteml"
445
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
446

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

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

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

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

    
475
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
476
	</target>
477

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

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

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

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

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

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

    
551
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
552
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
553

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

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

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

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

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

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

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

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

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

    
665
	<target name="copyxsl"
666
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
667

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

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

    
678

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

    
685
	</target>
686

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

    
702
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
703
		description="Installs spatial option for metacat">
704

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

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

    
722
	</target>
723

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

    
740
	<target name="build-metacat" depends="install-ecogrid, install-spatial"
741
		description="Build Metacat">
742
	</target>
743

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

    
765

    
766
	</target>
767

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

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

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

    
792
	<target name="install-skin" depends="init"
793
		description="Install a Skin">
794

    
795
		<input message="Please enter name of the skin"
796
			addproperty="skin-name" />
797

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

    
842
		<echo message="Install Skin completed." />
843
	</target>
844

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

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

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

    
881
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
882
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
883
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
884
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
885
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
886
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
887
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
888
		<copy todir="${war.lib}" filtering="no">
889
			<fileset dir="lib">
890
				<!--
891
					<not>
892
					<filename name="${jdbc-jar-name}"/>
893
					</not>
894
				-->
895
				<include name="*.jar" />
896
				<exclude name="maven-ant-tasks*.jar" />
897
			</fileset>
898
			<fileset dir="lib">
899
				<include name="xalan.jar" />
900
				<include name="gwt*.jar" />
901
			</fileset>
902
			<fileset dir="lib/oaipmh">
903
				<include name="oaicat.jar" />
904
			</fileset>
905
		</copy>
906
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
907
			tofile="${build.war}/web.xml" / -->
908
		<!-- MCD added next - Remove the tomcat5 reference-->
909
		<copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
910
		<copy file="lib/metacat.properties" todir="${war.webinf}"
911
			filtering="yes" />
912
		<copy file="lib/metacat.properties.metadata.xml"
913
			todir="${war.webinf}" filtering="no" />
914
		<copy file="lib/org.properties.metadata.xml"
915
			todir="${war.webinf}" filtering="no" />
916
		<copy file="lib/auth.properties.metadata.xml"
917
			todir="${war.webinf}" filtering="no" />
918
		<copy todir="${war.webinf}" filtering="yes">
919
			<fileset dir="lib">
920
				<include name="skin.configs/**" />
921
			</fileset>
922
		</copy>
923
		<copy file="lib/log4j.properties" todir="${war.webinf}"
924
			filtering="yes" />
925
		<copy file="lib/hazelcast.xml" todir="${war.webinf}"
926
			filtering="yes" />
927
		<copy todir="${war.context}" filtering="no">
928
			<fileset dir="lib">
929
				<include name="**/*.jpg" />
930
				<include name="**/*.png" />
931
				<include name="**/*.gif" />
932
				<include name="LiveMap_30/**" />
933
				<include name="oaipmh/**" />
934
			</fileset>
935
		</copy>
936
		<copy todir="${war.context}" filtering="yes">
937
			<fileset dir="lib">
938
				<exclude name="*.jar" />
939
				<exclude name="*.properties" />
940
				<exclude name="*.metadata.xml" />
941
				<exclude name="web.xml" />
942
				<exclude name="**/*.jpg" />
943
				<exclude name="**/*.png" />
944
				<exclude name="**/*.gif" />
945
				<exclude name="lsid_lib/**" />
946
				<exclude name="lsid_conf/**" />
947
				<exclude name="LiveMap_30/**" />
948
				<exclude name="oaipmh/**" />
949
				<exclude name="skin.configs/**" />
950
				<exclude name="spatial/geoserver/**" />
951
			</fileset>
952
		</copy>
953
		<copy todir="${war.context}" filtering="no">
954
			<fileset dir="lib">
955
				<include name="spatial/geoserver/data/**" />
956
			</fileset>
957
		</copy>
958
		<copy todir="${war.context.docs}" filtering="yes">
959
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
960
		</copy>
961
		<copy todir="${war.context.docs}" filtering="no">
962
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
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="test" depends="testprep"
1085
		description="Uses the ant junit task to run all JUnit tests">
1086

    
1087
		<!-- use the ant "junit" task to run JUnit tests. -->
1088
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1089
			haltonerror="no">
1090
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1091
			<classpath>
1092
				<path refid="test.classpath" />
1093
				<fileset dir="${build.dir}">
1094
					<include name="${name}.jar" />
1095
					<include name="${name}-client.jar" />
1096
					<include name="harvester.jar" />
1097
					<include name="${name}-junittests.jar" />
1098
				</fileset>
1099
			</classpath>
1100

    
1101
			<formatter type="plain" />
1102

    
1103
			<batchtest fork="yes" todir="${build.dir}">
1104
				<fileset dir="${build.tests}">
1105
					<include name="**/*.class" />
1106
					<exclude name="**/MCTestCase.class" />
1107
					<exclude name="**/ClientViewHelperTest.class" />
1108
					<!-- these are not test cases -->
1109
					<exclude name="**/MockCNode.class" />
1110
					<exclude name="**/D1NodeServiceTest.class" />
1111
				</fileset>
1112
			</batchtest>
1113
		</junit>
1114
	</target>
1115

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

    
1119
		<echo>testtorun: ${testtorun}</echo>
1120

    
1121
		<!-- use the ant "junit" task to run JUnit tests. -->
1122
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1123
			haltonerror="no" showoutput="yes">
1124
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1125
			<classpath>
1126
				<path refid="test.classpath" />
1127
				<fileset dir="${build.dir}">
1128
					<include name="${name}.jar" />
1129
					<include name="${name}-client.jar" />
1130
					<include name="harvester.jar" />
1131
					<include name="${name}-junittests.jar" />
1132
				</fileset>
1133
			</classpath>
1134

    
1135
			<formatter type="plain" />
1136

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

    
1145
	<target name="testharvester" depends="testprep"
1146
		description="Uses the ant junit task to test only the Harvester code">
1147
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1148
			haltonerror="off">
1149
			<classpath>
1150
				<path refid="compile.classpath" />
1151
				<fileset dir="${build.dir}">
1152
					<include name="${name}.jar" />
1153
					<include name="${name}-client.jar" />
1154
					<include name="harvester.jar" />
1155
					<include name="${name}-junittests.jar" />
1156
				</fileset>
1157
			</classpath>
1158
			<formatter type="plain" />
1159
			<batchtest fork="yes" todir="${build.dir}">
1160
				<fileset dir="${build.tests}">
1161
					<include name="**/harvesterClient/*.class" />
1162
				</fileset>
1163
			</batchtest>
1164
		</junit>
1165
	</target>
1166

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

    
1171
		<echo>
1172
			*********************************** Please run ant
1173
			gethttpclient first! ***********************************
1174
		</echo>
1175
		<!-- copy and compile the tests into a jar file -->
1176
		<mkdir dir="${build.metacatnettest}" />
1177
		<javac srcdir="${junitnettestsdir}"
1178
			destdir="${build.metacatnettest}" includes="**/*.java">
1179
			<classpath>
1180
				<path refid="compile.classpath" />
1181
				<fileset dir="${build.dir}">
1182
					<include name="${name}.jar" />
1183
				</fileset>
1184
			</classpath>
1185
		</javac>
1186

    
1187
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1188
			basedir="${build.metacatnettest}" includes="**/*.class" />
1189

    
1190
		<!-- use the ant "junit" task to run JUnit tests. -->
1191
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1192
			haltonerror="no">
1193
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1194
			<classpath>
1195
				<path refid="compile.classpath" />
1196
				<fileset dir="${build.dir}">
1197
					<include name="${name}.jar" />
1198
					<include name="${name}-junitnettests.jar" />
1199
				</fileset>
1200
			</classpath>
1201

    
1202
			<formatter type="plain" />
1203

    
1204
			<batchtest fork="yes" todir="${build.dir}">
1205
				<fileset dir="${build.metacatnettest}">
1206
					<include name="**/*.class" />
1207
				</fileset>
1208
			</batchtest>
1209
		</junit>
1210
	</target>
1211

    
1212
	<target name="cleanweb" depends="clean"
1213
		description="deletes tomcat web context dir and all its contents">
1214
		<delete dir="${installdir}" />
1215
	</target>
1216

    
1217

    
1218
	<target name="clean" depends="init"
1219
		description="deletes build dir and files that can be regenerated form the release">
1220
		<delete dir="${build.dir}" />
1221
		<delete dir="${dist.dir}" />
1222
	</target>
1223

    
1224
	<target name="localclean" depends="clean"
1225
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1226
		<delete file="lib/utilities.jar" />
1227
	</target>
1228

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

    
1263
	<target name="javadoc" depends="prepare"
1264
		description="generates Javadoc API documentation">
1265
		<javadoc packagenames="edu.ucsb.nceas.*"
1266
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1267
			version="true" use="true" windowtitle="${Name} API"
1268
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1269
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1270
			<classpath>
1271
				<path refid="compile.classpath" />
1272
			</classpath>
1273
		</javadoc>
1274
	</target>
1275

    
1276
	<target name="dist"
1277
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL,getutilities"
1278
		description="prepares a full release distribution">
1279
		<mkdir dir="${dist.dir}" />
1280
		<delete dir="${ver.dir}" />
1281
		<mkdir dir="${ver.dir}" />
1282
		<copy todir="${ver.dir}">
1283
			<fileset dir="."
1284
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1285
		</copy>
1286
		<copy todir="${ver.dir}" file="build.xml" />
1287
		<copy todir="${ver.dir}" file="build.properties" />
1288

    
1289
		<copy todir="${ver.dir}/docs" filtering="yes">
1290
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1291
		</copy>
1292
		<copy todir="${ver.dir}/docs" filtering="no">
1293
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1294
		</copy>
1295
		<copy todir="${ver.dir}/docs/dev">
1296
			<fileset dir="${build.dir}/docs" />
1297
		</copy>
1298
		<copy todir="${ver.dir}/src">
1299
			<fileset dir="${build.dir}/src" />
1300
		</copy>
1301

    
1302
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1303
		<copy todir="${ver.dir}/test/servertestfiles">
1304
			<fileset dir="./test/servertestfiles" />
1305
		</copy>
1306
	</target>
1307

    
1308
	<target name="distbin" depends="build-metacat,war-lsid"
1309
		description="prepares a binary distribution">
1310
		<copy todir="${dist.dir}">
1311
			<fileset dir="./src/scripts" />
1312
		</copy>
1313
		<delete file="./${name}-bin-${release}.zip" />
1314
		<zip zipfile="./${name}-bin-${release}.zip"
1315
			basedir="${dist.dir}" excludes="metacat-*/**" />
1316
		<delete file="./${name}-bin-${release}.tar.gz" />
1317
		<tar tarfile="./${name}-bin-${release}.tar"
1318
			basedir="${dist.dir}" excludes="metacat-*/**" />
1319
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1320
			src="./${name}-bin-${release}.tar" />
1321
		<delete file="./${name}-bin-${release}.tar" />
1322
	</target>
1323

    
1324
	<target name="distsrc" depends="dist"
1325
		description="prepares a source distribution">
1326
		<mkdir dir="${ver.src}" />
1327
		<copy todir="${ver.src}">
1328
			<fileset dir="./src" />
1329
		</copy>
1330
		<mkdir dir="${util.dir}" />
1331
		<copy todir="${util.dir}">
1332
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1333
		</copy>
1334

    
1335
		<mkdir dir="${ecogrid-dist-dir}" />
1336
		<copy todir="${ecogrid-dist-dir}">
1337
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1338
		</copy>
1339

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

    
1342
		<delete file="./${name}-src-${release}.zip" />
1343
		<zip zipfile="./${name}-src-${release}.zip"
1344
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1345
		<delete file="./${name}-src-${release}.tar.gz" />
1346
		<tar tarfile="./${name}-src-${release}.tar"
1347
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1348
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1349
			src="./${name}-src-${release}.tar" />
1350
		<delete file="./${name}-src-${release}.tar" />
1351
		<!--delete dir="${dist.dir}"/ -->
1352
	</target>
1353

    
1354
	<target name="deb-package" depends="distbin"
1355
		description="create a debian installation package">
1356
		<delete dir="${deb.pkg.dir}" />
1357
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1358
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1359
			<fileset dir="./src/scripts/debian"
1360
				includes="control postinst" />
1361
		</copy>
1362

    
1363
		<mkdir
1364
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1365
		<copy
1366
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1367
			filtering="yes">
1368
			<fileset dir="./src/scripts/debian"
1369
				excludes="control postinst" />
1370
		</copy>
1371
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1372

    
1373
		<copy file="${dist.dir}/knb.war"
1374
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1375
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1376
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1377

    
1378
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1379
			failonerror="true">
1380
			<arg line="--build debian" />
1381
		</exec>
1382

    
1383
		<move file="${pkg.dir}/debian.deb"
1384
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1385
	</target>
1386

    
1387
	<target name="stylesheettest">
1388
		<xslt in="${input}" out="eml.html"
1389
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1390
			<param name="displaymodule" expression="${displaymodule}" />
1391
			<param name="docid" expression="${input}" />
1392
			<param name="entitytype" expression="${entitytype}" />
1393
			<param name="entityindex" expression="${entityindex}" />
1394
			<outputproperty name="method" value="html" />
1395
			<outputproperty name="standalone" value="yes" />
1396
			<outputproperty name="encoding" value="iso8859_1" />
1397
			<outputproperty name="indent" value="yes" />
1398
		</xslt>
1399
	</target>
1400

    
1401
	<target name="spatial_option" depends="prepare"
1402
		description=" -- compiles code for the spatial option">
1403

    
1404
		<echo message="Compiling the metatcat shapefile creator" />
1405
		<echo message="using the shapelib at: ${shapelib.dir}" />
1406
		<exec dir="." executable="g++" os="Linux, Unix"
1407
			failonerror="true">
1408
			<arg
1409
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1410
		</exec>
1411

    
1412
		<exec dir="." executable="g++" os="Linux, Unix"
1413
			failonerror="true">
1414
			<arg
1415
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1416
		</exec>
1417
	</target>
1418

    
1419
	<!-- LSID Authority support -->
1420
	<patternset id="lsid.jars">
1421
		<include name="axis.jar" />
1422
		<include name="commons-discovery-0.2.jar" />
1423
		<include name="jaxrpc.jar" />
1424
		<include name="lsid-client-1.1.1.jar" />
1425
		<include name="lsid-server-1.1.1.jar" />
1426
		<include name="saaj.jar" />
1427
		<include name="wsdl4j-1.5.1.jar" />
1428
		<include name="activation.jar" />
1429
		<include name="castor-0.9.5.jar" />
1430
		<include name="dnsjava-1.3.2.jar" />
1431
		<include name="mail.jar" />
1432
		<include name="commons-logging-1.0.4.jar" />
1433
		<!-- These jars may be needed but seem to not actually be,
1434
			so leaving them out for now
1435
			<include name="axis-ant.jar" />
1436
		-->
1437
		<!--<include name="GenCastor.class" />-->
1438
	</patternset>
1439
	<patternset id="lib.jars">
1440
		<include name="log4j-1.2.12.jar" />
1441
		<include name="utilities.jar" />
1442
		<include name="xerces*.jar" />
1443
		<include name="xalan*.jar" />
1444
		<include name="xml-apis.jar" />
1445
	</patternset>
1446

    
1447
	<path id="lsid.classpath">
1448
		<fileset dir="${lsid.lib.dir}">
1449
			<patternset refid="lsid.jars" />
1450
		</fileset>
1451
		<fileset dir="${lib.dir}">
1452
			<patternset refid="lib.jars" />
1453
		</fileset>
1454
		<fileset dir="${build.dir}">
1455
			<include name="metacat-client.jar" />
1456
			<include name="metacat.jar" />
1457
		</fileset>
1458
	</path>
1459

    
1460
	<filterset id="configFilters">
1461
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1462
			value="${config.hostname}" / -->
1463
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1464
			value="${config.port}" / -->
1465
		<!-- MCD BYE filter token="METADATA_LABELS"
1466
			value="${config.metadataLabelLsid}" / -->
1467
		<!-- MCD BYE filter token="METACAT_SERVER"
1468
			value="${config.metacatserver}" / -->
1469
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1470
			value="${config.lsidauthority}" / -->
1471
	</filterset>
1472

    
1473
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1474
		description="Configure files prior to compilation">
1475
		<mkdir dir="${lsid.build.dir}" />
1476
		<!-- Copy the properties file into the build -->
1477
		<copy file="${conf.dir}/metacat-lsid.properties"
1478
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1479
			overwrite="true">
1480
			<filterset refid="configFilters" />
1481
		</copy>
1482
		<copy file="${conf.dir}/log4j.properties"
1483
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1484
			overwrite="true">
1485
			<filterset refid="configFilters" />
1486
		</copy>
1487
		<!-- Copy config files into the build -->
1488
		<copy todir="${lsid.build.dir}/WEB-INF">
1489
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1490
		</copy>
1491
		<!-- Copy the metadata configuration files into the build -->
1492
		<mkdir
1493
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1494
		<copy
1495
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1496
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1497
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1498
			<filterset refid="configFilters" />
1499
		</copy>
1500
		<!-- Copy services files into the build -->
1501
		<mkdir dir="${lsid.build.dir}/services" />
1502
		<copy todir="${lsid.build.dir}/services">
1503
			<fileset dir="${services.dir}" />
1504
			<filterset refid="configFilters" />
1505
		</copy>
1506
		<!-- Copy axis files into the build -->
1507
		<mkdir dir="${lsid.build.dir}" />
1508
		<copy todir="${lsid.build.dir}">
1509
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1510
		</copy>
1511
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1512
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1513
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1514
		</copy>
1515
	</target>
1516

    
1517
	<target name="compile-lsid" depends="prepare-lsid"
1518
		description="Compile Java sources">
1519
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1520
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1521
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1522
			deprecation="${compile.deprecation}"
1523
			optimize="${compile.optimize}">
1524
			<classpath refid="lsid.classpath" />
1525
		</javac>
1526
	</target>
1527

    
1528
	<target name="war-lsid" depends="compile-lsid"
1529
		description="Create a war file for the application">
1530
		<mkdir dir="${dist.dir}" />
1531
		<war destfile="${dist.dir}/${authority.context}.war"
1532
			webxml="${webinf.dir}/web.xml">
1533
			<fileset dir="${lsid.build.dir}" />
1534
			<lib dir="${lsid.lib.dir}">
1535
				<patternset refid="lsid.jars" />
1536
			</lib>
1537
			<lib dir="${lib.dir}">
1538
				<patternset refid="lib.jars" />
1539
			</lib>
1540
			<lib dir="${lib.dir}">
1541
				<include name="xalan.jar" />
1542
				<include name="xml-apis.jar" />
1543
			</lib>
1544
			<lib dir="${build.dir}">
1545
				<include name="metacat-client.jar" />
1546
			</lib>
1547
		</war>
1548
	</target>
1549

    
1550
	<target name="deploy-lsid" depends="war-lsid"
1551
		description="Deploy LSID war to servlet container">
1552
		<delete dir="${app.deploy.dir}/${authority.context}" />
1553
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1554
		<mkdir dir="${app.deploy.dir}" />
1555
		<copy todir="${app.deploy.dir}">
1556
			<fileset dir="${dist.dir}" />
1557
		</copy>
1558
	</target>
1559
	
1560
	<target name="change-metacat-properties" depends="warPrepare"
1561
        description="Chage some default values of metacat.properties">
1562
       <echo file="${metacat-properties-file}" append="true">
1563
		   configutil.propertiesConfigured=true
1564
		   configutil.authConfigured=true
1565
           configutil.skinsConfigured=true
1566
		   configutil.databaseConfigured=true
1567
		   configutil.geoserverConfigured=true
1568
	   </echo>
1569
  </target>
1570
	
1571
	<!-- This target will use default values in svn metacat.properties to build a configured 
1572
		metacat (except configuti.* properties, they will be set true). Those default settings
1573
		are for a test machine. It may not work on your system-->
1574
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1575
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1576
    </target>
1577
	
1578
</project>
(5-5/6)