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: berkley $'
10
	*    '$Date: 2010-05-11 10:58:02 -0700 (Tue, 11 May 2010) $'
11
	*    '$Revision: 5347 $'
12
	*
13
	* Build file for the Ant cross-platform build system for metacat
14
	* See http://jakarta.apache.org for details on Ant
15
	*
16
	* usage: ant [compile|jar|install|jdoc]
17
	*
18
	* This program is free software; you can redistribute it and/or modify
19
	* it under the terms of the GNU General Public License as published by
20
	* the Free Software Foundation; either version 2 of the License, or
21
	* (at your option) any later version.
22
	*
23
	* This program is distributed in the hope that it will be useful,
24
	* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
	* GNU General Public License for more details.
27
	*
28
	* You should have received a copy of the GNU General Public License
29
	* along with this program; if not, write to the Free Software
30
	* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir="."
33
         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
	<!-- Determine if ecogrid should be installed-->
45
	<condition property="enable.ecogrid">
46
		<equals arg1="${install.ecogrid}" arg2="true" />
47
	</condition>
48

    
49
	<!-- Determine if perl should be built-->
50
	<condition property="build.perl">
51
		<equals arg1="${make.perl.code}" arg2="true" />
52
	</condition>
53

    
54
	<!-- Determine if dataone-service should be built-->
55
	<condition property="d1.available">
56
        <and>
57
	        <available file="${d1.dir}"/>
58
	        <available file="${maven.home}"/>
59
        </and>
60
	</condition>
61

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

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

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

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

    
113
			<!-- Include geoserver, geotools, et. al. -->
114
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
115
				<include name="*.jar" />
116
			</fileset>
117
			<pathelement
118
				location="lib/spatial/geoserver/WEB-INF/classes" />
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
			<pathelement
146
				location="lib/spatial/geoserver/WEB-INF/classes" />
147

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

    
153
		</path>
154

    
155
		<!-- It is less likely you'll need to make any changes from here down,
156
			but customization is possible -->
157
		<property name="name" value="metacat" />
158
		<property name="Name" value="MetaCat" />
159
		<property name="debugprefix" value="${Name}:" />
160
		<property name="release" value="${metacat.version}" />
161
		<property name="style-common-relpath" value="/style/common" />
162
		<property name="style-shared-relpath" value="/style/shared" />
163
		<property name="schema-relpath" value="/schema" />
164
		<property name="style-common-cvsrelpath"
165
			value="lib${style-common-relpath}" />
166
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
167
		<property name="style-skins-relpath" value="/style/skins" />
168
		<property name="util-module" value="utilities" />
169
		<!-- property name="utilities-tag" value="/tags/UTILITIES_1_0_1_RC2" / -->
170
		<property name="utilities-tag" value="trunk" />
171
		<property name="eml-module" value="eml" />
172
		<property name="eml-version" value="2.0.0beta6" />
173
		<property name="eml-beta-tag"
174
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
175
		<property name="eml2_0_0-schema-tag"
176
			value="RELEASE_EML_2_0_0_UPDATE_1" />
177
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
178
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
179
		<property name="dataone-0.1-schema-tag" value="D1_SCHEMA_0_1" />
180
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_0_9_0" />
181
		<property name="eml2_0_0namespace"
182
			value="eml://ecoinformatics.org/eml-2.0.0" />
183
		<property name="eml2_0_1namespace"
184
			value="eml://ecoinformatics.org/eml-2.0.1" />
185
		<property name="eml2_1_0namespace"
186
			value="eml://ecoinformatics.org/eml-2.1.0" />
187
		<property name="stmmlnamespace"
188
			value="http://www.xml-cml.org/schema/stmml" />
189
		<property name="eml-css" value="eml_xsl.css" />
190
		<property name="eml-module.default.css" value="default.css" />
191
		<property name="systemidserver" value="" />
192
		<property name="html-path" value="" />
193

    
194

    
195
		<!-- Config for registry variables -->
196
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
197
		<property name="scope" value="obfs" />
198
		<property name="responseForm" value="genericResponse.tmpl" />
199
		<property name="entryForm" value="entryForm.tmpl" />
200
		<property name="guide" value="genericGuide.tmpl" />
201
		<property name="loginForm" value="loginForm.tmpl" />
202
		<property name="confirmData" value="confirmData.tmpl" />
203
		<property name="deleteData" value="deleteData.tmpl" />
204
		<property name="genericHeader" value="genericHeader.tmpl" />
205
		<property name="genericFooter" value="genericFooter.tmpl" />
206

    
207
		<filter token="scope" value="${scope}" />
208
		<filter token="responseForm" value="${responseForm}" />
209
		<filter token="entryForm" value="${entryForm}" />
210
		<filter token="guide" value="${guide}" />
211
		<filter token="loginForm" value="${loginForm}" />
212
		<filter token="confirmData" value="${confirmData}" />
213
		<filter token="deleteData" value="${deleteData}" />
214
		<filter token="genericHeader" value="${genericHeader}" />
215
		<filter token="genericFooter" value="${genericFooter}" />
216
		<filter token="adminname" value="${adminname}" />
217
		<filter token="recipient" value="${recipient}" />
218
		<filter token="metacatVersion" value="${metacat.version}" />
219
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
220
		<filter token="build.context" value="${metacat.context}" />
221

    
222
		<filter token="docrooturl" value="./" />
223
		<filter token="mcuser" value="${mcuser}" />
224
		<filter token="mcpassword" value="${mcpassword}" />
225
		<filter token="mcanotheruser" value="${mcanotheruser}" />
226
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
227
		<filter token="eml-css" value="${eml-css}" />
228
		<filter token="style-skins-relpath"
229
			value="${style-skins-relpath}" />
230
		<filter token="style-common-relpath"
231
			value="${style-common-relpath}" />
232

    
233
		<filter token="eml-version" value="${eml-version}" />
234
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
235
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
236
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
237
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
238
		<filter token="debugprefix" value="${debugprefix}" />
239

    
240
		<filter token="defaultStage" value="${defaultStage}" />
241
		<filter token="defaultHeader" value="${defaultHeader}" />
242
		<filter token="defaultFooter" value="${defaultFooter}" />
243
		<filter token="defaultChangePass" value="${defaultChangePass}" />
244
		<filter token="defaultResetPass" value="${defaultResetPass}" />
245
		<filter token="changePassSuccess" value="${changePassSuccess}" />
246
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
247
		<filter token="registerFailed" value="${registerFailed}" />
248
		<filter token="registerLter" value="${registerLter}" />
249
		<filter token="registerMatch" value="${registerMatch}" />
250
		<filter token="registerSuccess" value="${registerSuccess}" />
251
		<filter token="register" value="${register}" />
252
		<filter token="searchResults" value="${searchResults}" />
253
		<filter token="ldapMainServerFailure"
254
			value="${ldapMainServerFailure}" />
255
		<filter token="lter-user" value="${lteruser}" />
256
		<filter token="lter-pass" value="${lterpassword}" />
257
		<filter token="pisco-user" value="${piscouser}" />
258
		<filter token="pisco-pass" value="${piscopassword}" />
259

    
260

    
261
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
262
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
263
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
264

    
265
		<property name="srcdir" value="./src" />
266
		<property name="lib.dir" value="./lib" />
267
		<property name="docdir" value="./docs" />
268
		<property name="cgidir" value="./cgi-bin" />
269
		<property name="testdir" value="./test" />
270
		<property name="testtorun" value="BuildIndexTest" />
271
		<property name="junittestsdir"
272
			value="./test/edu/ucsb/nceas/metacattest" />
273
		<property name="junitnettestsdir"
274
			value="./test/edu/ucsb/nceas/metacatnettest" />
275
		<property name="build.dir" value="./build" />
276
		<property name="build.src" value="${build.dir}/src" />
277
		<property name="build.dest" value="${build.dir}/classes" />
278
		<property name="build.samples" value="${build.dir}/samples" />
279
		<property name="build.tests" value="${build.dir}/tests" />
280
		<property name="build.tmp" value="${build.dir}/tmp" />
281
		<property name="build.metacattest"
282
			value="${build.tests}/metacattest" />
283
		<property name="build.metacatnettest"
284
			value="${build.tests}/metacatnettest" />
285
		<property name="build.data" value="${build.dir}/data" />
286
		<property name="build.javadocs" value="${build.dir}/docs/api" />
287
		<property name="build.war" value="${build.dir}/war" />
288
		<property name="dist.dir" value="dist" />
289
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
290
		<property name="ver.src" value="${ver.dir}/src" />
291
		<property name="util.dir" value="${dist.dir}/${util-module}" />
292
		<property name="test.dir" value="${dist.dir}/test" />
293
		<!-- directories for creating a Harvest List Editor distribution -->
294
		<property name="dist.dir.hle" value="disthle" />
295
		<property name="ver.dir.hle"
296
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
297
		<property name="pkg.dir" value="./package" />
298
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
299

    
300
		<property name="ecogrid-target-name" value="metacatImpl" />
301
		<property name="ecogrid-module-dest-dir" value=".." />
302
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
303
		<property name="ecogrid-dist-dir"
304
			value="${dist.dir}/${ecogrid-module}" />
305
		<property name="ecogrid-dir"
306
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
307

    
308
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
309

    
310
		<!-- set up svn -->
311
		<property name="svnant.lib" value="lib" />
312
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
313
		<property name="svnClientAdapter.jar"
314
			value="${svnant.lib}/svnClientAdapter.jar" />
315
		<property name="svnjavahl.jar"
316
			value="${svnant.lib}/svnjavahl.jar" />
317
		<property name="svn.utilitiesUrl"
318
			value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
319
		<property name="svn.ecogridUrl"
320
			value="https://code.ecoinformatics.org/code/seek/trunk/projects/ecogrid/" />
321
		<property name="svn.emlBetaUrl"
322
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
323
		<property name="svn.eml200SchemaUrl"
324
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
325
		<property name="svn.eml201SchemaUrl"
326
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
327
		<property name="svn.eml210SchemaUrl"
328
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
329
		<property name="svn.dataone-0.1-schema-url"
330
			value="https://repository.dataone.org/software/cicore/tags/${dataone-0.1-schema-tag}" />
331
		<property name="svn.eml2StyleUrl"
332
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
333

    
334
		<!-- load the svn task -->
335
		<path id="svn.classpath">
336
			<pathelement location="${svnjavahl.jar}" />
337
			<pathelement location="${svnant.jar}" />
338
			<pathelement location="${svnClientAdapter.jar}" />
339
		</path>
340
		<taskdef resource="svntask.properties"
341
			classpathref="svn.classpath" />
342

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

    
383
		<condition property="ecogrid.required">
384
			<or>
385
				<not>
386
					<available file="${ecogrid-dir}/build.properties" />
387
				</not>
388
				<not>
389
					<available
390
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
391
				</not>
392
			</or>
393
		</condition>
394

    
395
	</target>
396

    
397
	<target name="prepare" depends="init">
398
		<mkdir dir="${build.dir}" />
399
		<mkdir dir="${build.src}" />
400
		<mkdir dir="${build.dest}" />
401
		<mkdir dir="${build.javadocs}" />
402
		<mkdir dir="${build.tmp}" />
403

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

    
420
	<taskdef resource="axis-tasks.properties"
421
		classpathref="compile.classpath" />
422

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

    
430
	<target name="compile" depends="dataone-service,prepare,utilities"
431
		description="Compiles java code to build dir, and copies metacat props files there">
432

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

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

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

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

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

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

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

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

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

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

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

    
509
	<target name="harvester" depends="client"
510
		description="Compiles harvester java code to build dir">
511
		<javac srcdir="${build.src}" destdir="${build.dest}"
512
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
513
			<classpath>
514
				<path refid="compile.classpath" />
515
			</classpath>
516
		</javac>
517
	</target>
518

    
519
	<target name="harvesterjar" depends="harvester"
520
		description="Compiles and jars harvester java code to harvester.jar in build dir">
521
		<delete file="${build.dir}/harvester.jar" />
522
		<jar jarfile="${build.dir}/harvester.jar"
523
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
524
	</target>
525

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

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

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

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

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

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

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

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

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

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

    
639
		<!-- Checkout eml210 for given style sheet tag-->
640
		<svn>
641
			<export srcUrl="${svn.eml2StyleUrl}"
642
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
643
		</svn>
644
		<antcall target="copyxsl">
645
			<param name="cvs.tagname" value="${eml2-style-tag}" />
646
			<!-- param name="dirname" value="eml-2.1.0" / -->
647
			<param name="dirname" value="eml-2" />
648
		</antcall>
649
	</target>
650
	
651
	<!-- copies the dataone schemas from a local source if you don't want
652
	     to have to make a ton of svn calls when you're testing (see getd1schemas) -->
653
	<target name="install-dataone" depends="init">
654
	  <property name="dataone-shema-dir" value="../cicore/schemas"/>
655
	  <property name="install-dataone-schema-dir" value="${installdir}/schema/D1_SCHEMA_0_1"/>
656
	  <mkdir dir="${install-dataone-schema-dir}"/>
657
	  <copy todir="${install-dataone-schema-dir}">
658
	    <fileset dir="${dataone-shema-dir}">
659
	      <include name="**/*.xsd"/>
660
	    </fileset>
661
	  </copy>
662
	</target>
663

    
664
	<!-- get the dataone schemas from svn -->
665
	<target name="getd1schemas" depends="prepare" 
666
		description="Checkout dataone schemas from svn and copy to metacat sandbox">
667
		<delete dir="${build.tmp}/${dataone-0.1-schema-tag}"/>
668
        <svn>
669
            <export srcUrl="${svn.dataone-0.1-schema-url}"
670
                destPath="${build.tmp}/${dataone-0.1-schema-tag}" />
671
        </svn>
672
        <mkdir dir="lib/schema/${dataone-0.1-schema-tag}" />
673
        <copy todir="lib/schema/${dataone-0.1-schema-tag}" filtering="yes">
674
            <fileset dir="${build.tmp}/${dataone-0.1-schema-tag}">
675
                <include name="*.xsd" />
676
            </fileset>
677
        </copy>
678
    </target>
679

    
680
	<target name="copyxsl"
681
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
682

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

    
685
		<copy todir="${style-common-cvsrelpath}/${dirname}"
686
			filtering="yes">
687
			<fileset
688
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
689
				<include name="**/*.xsl" />
690
			</fileset>
691
		</copy>
692

    
693

    
694
		<!-- now copy default css from eml module and put it in style-common-path
695
			dir with a new name, so other skin-specific css can import it if reqd -->
696
		<copy
697
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
698
			tofile="${style-common-cvsrelpath}/${eml-css}" />
699

    
700
	</target>
701

    
702
	<target name="correctEML201Docs" depends="jar"
703
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
704
		<copy todir="${build.dir}" file="lib/metacat.properties"
705
			filtering="yes" />
706
		<java
707
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
708
			<classpath>
709
				<path refid="compile.classpath" />
710
				<fileset dir="${build.dir}">
711
					<include name="${name}.jar" />
712
				</fileset>
713
			</classpath>
714
		</java>
715
	</target>
716

    
717
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
718
		description="Installs spatial option for metacat">
719

    
720
		<property name="spatial.dir" value="./lib/spatial" />
721
		<property name="spatial.geoserver.dir"
722
			value="${spatial.dir}/geoserver" />
723
		<property name="spatial.webinf-mods"
724
			value="${spatial.dir}/WEB-INF" />
725

    
726
		<!-- Copy geoserver libs into ${war.lib} -->
727
		<copy todir="${war.lib}" filtering="no">
728
			<fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
729
				<include name="**" />
730
			</fileset>
731
		</copy>
732

    
733
		<!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
734
		<copy todir="${war.webinf}" filtering="no">
735
			<fileset dir="${spatial.geoserver.dir}/WEB-INF">
736
				<exclude name="lib/**" />
737
				<exclude name="web.xml" />
738
			</fileset>
739
		</copy>
740

    
741
		<!-- Copy the rest of the geoserver codebase into ${war.context} -->
742
		<copy todir="${war.context}" filtering="no">
743
			<fileset dir="${spatial.geoserver.dir}">
744
				<exclude name="WEB-INF/**" />
745
				<exclude name="index.jsp" />
746
			</fileset>
747
		</copy>
748

    
749
		<!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
750
		<copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
751
			tofile="${war.context}/geoserver.jsp" overwrite="true"
752
			filtering="no" />
753

    
754
		<!-- Copy the rest of the modified geoserver web-inf files
755
			<copy todir="${war.webinf}" filtering="no">
756
			<fileset dir="${spatial.webinf-mods}">
757
			<exclude name="web.xml.combined"/>
758
			</fileset>
759
			</copy> -->
760

    
761
	</target>
762

    
763
	<target name="install" depends="build-metacat"
764
		description="* Full Install For Development *">
765
		<copy file="${dist.dir}/${metacat.context}.war"
766
			todir="${app.deploy.dir}" />
767
               <!-- <copy file="${dist.dir}/${metacat.context}.war"
768
                        todir="${app.deploy.dir2}" />-->
769
		<delete dir="${app.deploy.dir}/${metacat.context}" />
770
		<!--<delete dir="${app.deploy.dir2}/${metacat.context}" />-->
771
		<tstamp>
772
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
773
		</tstamp>
774
		<echo>Dev install completed at ${NOW}</echo>
775
	</target>
776

    
777
	<target name="build-metacat" depends="install-ecogrid"
778
		description="Build Metacat">
779
	</target>
780

    
781
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
782
		if="enable.ecogrid" description="Install Ecogrid Compentent">
783
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
784
			inheritall="false">
785
			<property name="context" value="${metacat.context}" />
786
			<property name="target" value="${ecogrid-target-name}" />
787
			<!-- property name="metacat.dir" value="."/ -->
788
		</ant>
789
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
790
			inheritall="false">
791
			<property name="context" value="${metacat.context}" />
792
			<property name="target" value="${ecogrid-target-name}" />
793
			<!-- property name="metacat.dir" value="."/ -->
794
		</ant>
795
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
796
			<webinf dir="${ecogrid-dir}/lib">
797
			<include name="server-config.wsdd"/>
798
			</webinf>
799
			</war -->
800
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
801
			todir="${dist.dir}" overwrite="true" />
802

    
803

    
804
	</target>
805

    
806
	<target name="get-ecogrid" depends="init"
807
		description="Check out ecogrid module" if="ecogrid.required">
808
		<svn>
809
			<export srcUrl="${svn.ecogridUrl}"
810
				destPath="${ecogrid-dir}" />
811
		</svn>
812
	</target>
813

    
814
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
815
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
816
		<property name="context" value="${metacat.context}"/>
817
		<property name="target" value="${ecogrid-target-name}"/>
818
		<property name="metacat.dir" value="."/>
819
		<property name="hostname" value="${ecogrid.hostname}"/>
820
		<property name="port" value="${config.port}"/>
821
		</ant>
822
		</target -->
823

    
824
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
825
		description="Automately generate wsdd for ecogrid service">
826
		<delete
827
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
828
	</target>
829

    
830
	<target name="install-skin" depends="init"
831
		description="Install a Skin">
832

    
833
		<input message="Please enter name of the skin"
834
			addproperty="skin-name" />
835

    
836
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
837
		<copy todir="${installdir}/style/skins/${skin-name}"
838
			filtering="yes">
839
			<fileset dir="lib/style/skins/${skin-name}">
840
				<exclude name="**/*.png" />
841
				<exclude name="**/*.gif" />
842
				<exclude name="**/*.jpg" />
843
				<exclude name="**/CVS*" />
844
				<exclude name="**/.#*" />
845
			</fileset>
846
		</copy>
847
		<copy todir="${installdir}/style/skins/${skin-name}"
848
			filtering="no">
849
			<fileset dir="lib/style/skins/${skin-name}">
850
				<include name="**/*.png" />
851
				<include name="**/*.gif" />
852
				<include name="**/*.jpg" />
853
				<exclude name="**/CVS*" />
854
				<exclude name="**/.#*" />
855
			</fileset>
856
		</copy>
857
		<copy todir="${installdir}/style/common" filtering="yes">
858
			<fileset dir="lib/style/common">
859
				<include name="*.js" />
860
				<include name="*.jsp" />
861
				<include name="*.css" />
862
				<exclude name="*.png" />
863
				<exclude name="*.gif" />
864
				<exclude name="*.jpg" />
865
				<exclude name="**/CVS*" />
866
				<exclude name="**/.#*" />
867
			</fileset>
868
		</copy>
869
		<!--
870
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
871
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
872
			<fileset dir="lib/style/skins/${skin-name}/images">
873
			<include name="*.png"/>
874
			<include name="*.gif"/>
875
			<include name="*.jpg"/>
876
			</fileset>
877
			</copy>
878
		-->
879

    
880
		<echo message="Install Skin completed." />
881
	</target>
882

    
883
	<target name="war" depends="warPrepare,install-spatial"
884
		description="Create a web archive (WAR) for servlet deployment">
885
		<mkdir dir="${dist.dir}" />
886
		<war destfile="${dist.dir}/${metacat.context}.war"
887
			webxml="${build.war}/web.xml">
888
			<fileset dir="${war.context}" />
889
			<lib dir="${war.lib}" />
890
			<webinf dir="${war.webinf}" />
891
		</war>
892
	</target>
893

    
894
	<target name="warPrepare"
895
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
896
		description="Prepare files for creating a web archive (WAR)">
897

    
898
		<property name="war.lib" value="${build.war}/lib" />
899
		<property name="war.webinf" value="${build.war}/WEB-INF" />
900
		<property name="war.context"
901
			value="${build.war}/${metacat.context}" />
902
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
903
		<property name="war.webinf.scripts"
904
			value="${war.webinf}/scripts" />
905
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
906
		<property name="war.context.docs" value="${war.context}/docs" />
907
		<property name="war.context.temp" value="${war.context}/temp" />
908
		<property name="war.context.templates"
909
			value="${war.context}${style-common-relpath}/templates" />
910
		<mkdir dir="${war.lib}" />
911
		<mkdir dir="${war.webinf}" />
912
		<mkdir dir="${war.context}" />
913
		<mkdir dir="${war.webinf.sql}" />
914
		<mkdir dir="${war.context.cgi}" />
915
		<mkdir dir="${war.context.docs}" />
916
		<mkdir dir="${war.context.temp}" />
917
		<mkdir dir="${war.context.templates}" />
918

    
919
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
920
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
921
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
922
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
923
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
924
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
925
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
926
		<copy todir="${war.lib}" filtering="no">
927
			<fileset dir="lib">
928
				<!--
929
					<not>
930
					<filename name="${jdbc-jar-name}"/>
931
					</not>
932
				-->
933
				<include name="*.jar" />
934
				<exclude name="maven-ant-tasks*.jar" />
935
			</fileset>
936
			<fileset dir="lib">
937
				<include name="xalan.jar" />
938
				<include name="gwt*.jar" />
939
			</fileset>
940
			<fileset dir="lib/oaipmh">
941
				<include name="oaicat.jar" />
942
			</fileset>
943
		</copy>
944
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
945
			tofile="${build.war}/web.xml" / -->
946
		<!-- MCD added next - Remove the tomcat5 reference-->
947
		<copy file="lib/web.xml.tomcat5" tofile="${build.war}/web.xml" />
948
		<copy file="lib/metacat.properties" todir="${war.webinf}"
949
			filtering="yes" />
950
		<copy file="lib/metacat.properties.metadata.xml"
951
			todir="${war.webinf}" filtering="no" />
952
		<copy file="lib/org.properties.metadata.xml"
953
			todir="${war.webinf}" filtering="no" />
954
		<copy file="lib/auth.properties.metadata.xml"
955
			todir="${war.webinf}" filtering="no" />
956
		<copy todir="${war.webinf}" filtering="yes">
957
			<fileset dir="lib">
958
				<include name="skin.configs/**" />
959
			</fileset>
960
		</copy>
961
		<copy file="lib/log4j.properties" todir="${war.webinf}"
962
			filtering="yes" />
963
		<copy todir="${war.context}" filtering="no">
964
			<fileset dir="lib">
965
				<include name="**/*.jpg" />
966
				<include name="**/*.png" />
967
				<include name="**/*.gif" />
968
				<include name="LiveMap_30/**" />
969
				<include name="oaipmh/**" />
970
			</fileset>
971
		</copy>
972
		<copy todir="${war.context}" filtering="yes">
973
			<fileset dir="lib">
974
				<exclude name="*.jar" />
975
				<exclude name="*.properties" />
976
				<exclude name="*.metadata.xml" />
977
				<exclude name="web.xml" />
978
				<exclude name="**/*.jpg" />
979
				<exclude name="**/*.png" />
980
				<exclude name="**/*.gif" />
981
				<exclude name="lsid_lib/**" />
982
				<exclude name="lsid_conf/**" />
983
				<exclude name="LiveMap_30/**" />
984
				<exclude name="oaipmh/**" />
985
				<exclude name="skin.configs/**" />
986
				<exclude name="spatial/geoserver/**" />
987
				<exclude name="spatial/WEB-INF/**" />
988
			</fileset>
989
		</copy>
990
		<copy todir="${war.context.docs}" filtering="yes">
991
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
992
		</copy>
993
		<copy todir="${war.context.docs}" filtering="no">
994
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
995
		</copy>
996
		<copy todir="${war.webinf.sql}" filtering="yes">
997
			<fileset dir="src">
998
				<include name="**/*.sql" />
999
			</fileset>
1000
		</copy>
1001
		<copy todir="${war.webinf.scripts}" filtering="yes">
1002
			<fileset dir="src/scripts" />
1003
		</copy>
1004
		<copy todir="${war.webinf.scripts}"
1005
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1006
			failonerror="false" />
1007

    
1008
		<copy file="src/perl/register-dataset.cgi"
1009
			todir="${war.context.cgi}" />
1010
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1011
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1012

    
1013
		<!-- registry cgi section -->
1014
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1015
			used in readDocumentFromMetacat -->
1016
		<!-- TODO MCD copy temp files to actual location using config util?? -->
1017
		<copy todir="${war.context.temp}" filtering="yes">
1018
			<fileset dir="lib/style/common/emlb6toeml2">
1019
				<include name="*.xsl" />
1020
				<include name="*.xml" />
1021
			</fileset>
1022
		</copy>
1023
		<available file="lib/style/common/emlb6toeml2" type="dir"
1024
			property="styles.not.needed" />
1025

    
1026
		<!-- ldap cgi section -->
1027
		<copy todir="${war.context.templates}">
1028
			<fileset dir="lib/style/common/templates">
1029
				<!-- SCW: Copy all files -->
1030
			</fileset>
1031
		</copy>
1032
	</target>
1033

    
1034
	<target name="cgiPrepare" if="build.perl">
1035
		<exec dir="src/perl/Metacat/" executable="make">
1036
			<arg value="clean" />
1037
		</exec>
1038
		<exec dir="src/perl/Metacat/" executable="perl">
1039
			<arg value="Makefile.PL" />
1040
		</exec>
1041
		<exec dir="src/perl/Metacat/" executable="make" />
1042
	</target>
1043

    
1044
	<target name="testPrepare"
1045
		description="Copies test files into the war directories">
1046
		<echo>in testPrepare</echo>
1047
		<property name="war.context.test"
1048
			value="${build.war}/${metacat.context}/test" />
1049
		<mkdir dir="${war.context.test}" />
1050
		<copy todir="${war.context.test}" filtering="yes">
1051
			<fileset dir="test/servertestfiles">
1052
				<include name="*/**" />
1053
			</fileset>
1054
		</copy>
1055
	</target>
1056

    
1057
	<target name="getConversionXSL" depends="prepare"
1058
		unless="styles.not.needed"
1059
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1060

    
1061
		<svn>
1062
			<export srcUrl="${svn.eml2StyleUrl}"
1063
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1064
		</svn>
1065

    
1066
		<mkdir dir="lib/style/common/emlb6toeml2" />
1067
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1068
			<fileset
1069
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1070
				<include name="*.xsl" />
1071
				<include name="*.xml" />
1072
			</fileset>
1073
		</copy>
1074
	</target>
1075

    
1076
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1077
		<mkdir dir="${build.tests}" />
1078
		<copy todir="${build.tests}" filtering="yes">
1079
			<fileset dir="${testdir}">
1080
				<include name="edu/**" />
1081
			</fileset>
1082
		</copy>
1083
		<copy todir="${build.tests}" file="${testdir}/test.properties"
1084
			filtering="yes" />
1085

    
1086
		<!-- copy and compile the tests into a jar file -->
1087
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1088
			debug="on" includes="**/*.java">
1089
			<classpath>
1090
				<path refid="compile.classpath" />
1091
				<fileset dir="${build.dir}">
1092
					<include name="${name}.jar" />
1093
					<include name="${name}-client.jar" />
1094
					<include name="harvester.jar" />
1095
				</fileset>
1096
			</classpath>
1097
		</javac>
1098

    
1099
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1100
			basedir="${build.tests}" includes="**/*.class" />
1101
	</target>
1102

    
1103
	<target name="test" depends="testprep"
1104
		description="Uses the ant junit task to run all JUnit tests">
1105

    
1106
		<!-- use the ant "junit" task to run JUnit tests. -->
1107
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1108
			haltonerror="no">
1109
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
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="**/*.class" />
1125
					<exclude name="**/MCTestCase.class" />
1126
					<exclude name="**/ClientViewHelperTest.class" />
1127
				</fileset>
1128
			</batchtest>
1129
		</junit>
1130
	</target>
1131

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

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

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

    
1151
			<formatter type="plain" />
1152

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

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

    
1183
	<target name="gethttpclient" depends="prepare"
1184
		description="checks out and compiles morpho httpclient code">
1185
		<!--mkdir dir="${morphosourcedir}" -->
1186
		<cvs cvsRoot="${cvsroot}" package="morpho" dest="." />
1187
		<ant dir="${morphosourcedir}" inheritAll="false" target="jar" />
1188
	</target>
1189

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

    
1194
		<echo>
1195
			*********************************** Please run ant
1196
			gethttpclient first! ***********************************
1197
		</echo>
1198
		<!-- copy and compile the tests into a jar file -->
1199
		<mkdir dir="${build.metacatnettest}" />
1200
		<javac srcdir="${junitnettestsdir}"
1201
			destdir="${build.metacatnettest}" includes="**/*.java">
1202
			<classpath>
1203
				<path refid="compile.classpath" />
1204
				<fileset dir="${build.dir}">
1205
					<include name="${name}.jar" />
1206
				</fileset>
1207
			</classpath>
1208
		</javac>
1209

    
1210
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1211
			basedir="${build.metacatnettest}" includes="**/*.class" />
1212

    
1213
		<!-- use the ant "junit" task to run JUnit tests. -->
1214
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1215
			haltonerror="no">
1216
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1217
			<classpath>
1218
				<path refid="compile.classpath" />
1219
				<fileset dir="${build.dir}">
1220
					<include name="${name}.jar" />
1221
					<include name="${name}-junitnettests.jar" />
1222
				</fileset>
1223
			</classpath>
1224

    
1225
			<formatter type="plain" />
1226

    
1227
			<batchtest fork="yes" todir="${build.dir}">
1228
				<fileset dir="${build.metacatnettest}">
1229
					<include name="**/*.class" />
1230
				</fileset>
1231
			</batchtest>
1232
		</junit>
1233
	</target>
1234

    
1235
	<target name="cleanweb" depends="clean"
1236
		description="deletes tomcat web context dir and all its contents">
1237
		<delete dir="${installdir}" />
1238
	</target>
1239

    
1240

    
1241
	<target name="clean" depends="init"
1242
		description="deletes build dir and files that can be regenerated form the release">
1243
		<delete dir="${build.dir}" />
1244
		<delete dir="${dist.dir}" />
1245
	</target>
1246

    
1247
	<target name="localclean" depends="clean"
1248
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1249
		<delete file="lib/httpclient.jar" />
1250
		<delete file="lib/utilities.jar" />
1251
	</target>
1252

    
1253
	<target name="fullclean" depends="localclean"
1254
		description="deletes code and eml">
1255
		<delete includeEmptyDirs="true" failonerror="false">
1256
			<fileset dir="${style-common-cvsrelpath}">
1257
				<include name="${eml-css}" />
1258
				<include name="eml-*/*.xsl" />
1259
				<include name="eml-*" />
1260
			</fileset>
1261
			<fileset dir="${schema-cvsrelpath}">
1262
				<include name="eml-*/*.xsd" />
1263
			</fileset>
1264
			<fileset dir="${ecogrid-dir}">
1265
				<include name="build.properties" />
1266
				<include name="buildfiles/metacatImpl.xml" />
1267
			</fileset>
1268
		</delete>
1269
	</target>
1270

    
1271
	<target name="jdoc" depends="prepare"
1272
		description="generates javadoc documentation">
1273
		<javadoc packagenames="edu.ucsb.nceas.*"
1274
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1275
			version="true" use="true" windowtitle="${Name} API"
1276
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1277
			bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1278
			<classpath>
1279
				<path refid="compile.classpath" />
1280
			</classpath>
1281
		</javadoc>
1282
	</target>
1283

    
1284
	<target name="dist"
1285
		depends="geteml,getd1schemas,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1286
		description="prepares a full release distribution">
1287
		<mkdir dir="${dist.dir}" />
1288
		<delete dir="${ver.dir}" />
1289
		<mkdir dir="${ver.dir}" />
1290
		<copy todir="${ver.dir}">
1291
			<fileset dir="."
1292
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1293
		</copy>
1294
		<copy todir="${ver.dir}" file="build.xml" />
1295
		<copy todir="${ver.dir}" file="build.properties" />
1296

    
1297
		<copy todir="${ver.dir}/docs" filtering="yes">
1298
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1299
		</copy>
1300
		<copy todir="${ver.dir}/docs" filtering="no">
1301
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1302
		</copy>
1303
		<copy todir="${ver.dir}/docs/dev">
1304
			<fileset dir="${build.dir}/docs" />
1305
		</copy>
1306
		<copy todir="${ver.dir}/src">
1307
			<fileset dir="${build.dir}/src" />
1308
		</copy>
1309

    
1310
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1311
		<copy todir="${ver.dir}/test/servertestfiles">
1312
			<fileset dir="./test/servertestfiles" />
1313
		</copy>
1314
	</target>
1315

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

    
1332
	<target name="distsrc" depends="dist"
1333
		description="prepares a source distribution">
1334
		<mkdir dir="${ver.src}" />
1335
		<copy todir="${ver.src}">
1336
			<fileset dir="./src" />
1337
		</copy>
1338
		<mkdir dir="${util.dir}" />
1339
		<copy todir="${util.dir}">
1340
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1341
		</copy>
1342

    
1343
		<mkdir dir="${ecogrid-dist-dir}" />
1344
		<copy todir="${ecogrid-dist-dir}">
1345
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1346
		</copy>
1347

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

    
1350
		<delete file="./${name}-src-${release}.zip" />
1351
		<zip zipfile="./${name}-src-${release}.zip"
1352
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1353
		<delete file="./${name}-src-${release}.tar.gz" />
1354
		<tar tarfile="./${name}-src-${release}.tar"
1355
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1356
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1357
			src="./${name}-src-${release}.tar" />
1358
		<delete file="./${name}-src-${release}.tar" />
1359
		<!--delete dir="${dist.dir}"/ -->
1360
	</target>
1361

    
1362
	<target name="deb-package" depends="distbin"
1363
		description="create a debian installation package">
1364
		<delete dir="${deb.pkg.dir}" />
1365
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1366
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1367
			<fileset dir="./src/scripts/debian"
1368
				includes="control postinst" />
1369
		</copy>
1370

    
1371
		<mkdir
1372
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1373
		<copy
1374
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1375
			filtering="yes">
1376
			<fileset dir="./src/scripts/debian"
1377
				excludes="control postinst" />
1378
		</copy>
1379
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1380

    
1381
		<copy file="${dist.dir}/knb.war"
1382
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1383
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1384
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1385

    
1386
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1387
			failonerror="true">
1388
			<arg line="--build debian" />
1389
		</exec>
1390

    
1391
		<move file="${pkg.dir}/debian.deb"
1392
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1393
	</target>
1394

    
1395
	<target name="stylesheettest">
1396
		<xslt in="${input}" out="eml.html"
1397
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1398
			<param name="displaymodule" expression="${displaymodule}" />
1399
			<param name="docid" expression="${input}" />
1400
			<param name="entitytype" expression="${entitytype}" />
1401
			<param name="entityindex" expression="${entityindex}" />
1402
			<outputproperty name="method" value="html" />
1403
			<outputproperty name="standalone" value="yes" />
1404
			<outputproperty name="encoding" value="iso8859_1" />
1405
			<outputproperty name="indent" value="yes" />
1406
		</xslt>
1407
	</target>
1408

    
1409

    
1410
	<target name="compilewebclient" depends="prepare">
1411
		<javac srcdir="${build.src}" destdir="${build.dest}"
1412
			includes="**/application/*.java" classpathref="webservicepath" />
1413
	</target>
1414

    
1415
	<target name="runwebclient" depends="compilewebclient">
1416
		<java
1417
			classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1418
			dir="${build.dest}" fork="yes" classpathref="webservicepath"
1419
			classpath="./lib/utilities.jar" failonerror="true">
1420
			<arg value="${serviceUrl}" />
1421
			<arg value="${docid}" />
1422
		</java>
1423
	</target>
1424

    
1425
	<target name="spatial_option" depends="prepare"
1426
		description=" -- compiles code for the spatial option">
1427

    
1428
		<echo message="Compiling the metatcat shapefile creator" />
1429
		<echo message="using the shapelib at: ${shapelib.dir}" />
1430
		<exec dir="." executable="g++" os="Linux, Unix"
1431
			failonerror="true">
1432
			<arg
1433
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1434
		</exec>
1435

    
1436
		<exec dir="." executable="g++" os="Linux, Unix"
1437
			failonerror="true">
1438
			<arg
1439
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1440
		</exec>
1441
	</target>
1442

    
1443
	<!-- LSID Authority support -->
1444
	<patternset id="lsid.jars">
1445
		<include name="axis.jar" />
1446
		<include name="commons-discovery-0.2.jar" />
1447
		<include name="jaxrpc.jar" />
1448
		<include name="lsid-client-1.1.1.jar" />
1449
		<include name="lsid-server-1.1.1.jar" />
1450
		<include name="saaj.jar" />
1451
		<include name="wsdl4j-1.5.1.jar" />
1452
		<include name="activation.jar" />
1453
		<include name="castor-0.9.5.jar" />
1454
		<include name="dnsjava-1.3.2.jar" />
1455
		<include name="mail.jar" />
1456
		<include name="commons-logging-1.0.4.jar" />
1457
		<!-- These jars may be needed but seem to not actually be,
1458
			so leaving them out for now
1459
			<include name="axis-ant.jar" />
1460
		-->
1461
		<!--<include name="GenCastor.class" />-->
1462
	</patternset>
1463
	<patternset id="lib.jars">
1464
		<include name="httpclient.jar" />
1465
		<include name="log4j-1.2.12.jar" />
1466
		<include name="utilities.jar" />
1467
		<include name="xercesImpl.jar" />
1468
		<include name="xalan.jar" />
1469
		<include name="xml-apis.jar" />
1470
	</patternset>
1471

    
1472
	<path id="lsid.classpath">
1473
		<fileset dir="${lsid.lib.dir}">
1474
			<patternset refid="lsid.jars" />
1475
		</fileset>
1476
		<fileset dir="${lib.dir}">
1477
			<patternset refid="lsid.jars" />
1478
		</fileset>
1479
		<fileset dir="${lib.dir}">
1480
			<include name="xalan.jar" />
1481
			<include name="xml-apis.jar" />
1482
		</fileset>
1483
		<fileset dir="${build.dir}">
1484
			<include name="metacat-client.jar" />
1485
		</fileset>
1486
	</path>
1487

    
1488
	<filterset id="configFilters">
1489
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1490
			value="${config.hostname}" / -->
1491
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1492
			value="${config.port}" / -->
1493
		<!-- MCD BYE filter token="METADATA_LABELS"
1494
			value="${config.metadataLabelLsid}" / -->
1495
		<!-- MCD BYE filter token="METACAT_SERVER"
1496
			value="${config.metacatserver}" / -->
1497
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1498
			value="${config.lsidauthority}" / -->
1499
	</filterset>
1500

    
1501
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1502
		description="Configure files prior to compilation">
1503
		<mkdir dir="${lsid.build.dir}" />
1504
		<!-- Copy the properties file into the build -->
1505
		<copy file="${conf.dir}/metacat-lsid.properties"
1506
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1507
			overwrite="true">
1508
			<filterset refid="configFilters" />
1509
		</copy>
1510
		<copy file="${conf.dir}/log4j.properties"
1511
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1512
			overwrite="true">
1513
			<filterset refid="configFilters" />
1514
		</copy>
1515
		<!-- Copy config files into the build -->
1516
		<copy todir="${lsid.build.dir}/WEB-INF">
1517
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1518
		</copy>
1519
		<!-- Copy the metadata configuration files into the build -->
1520
		<mkdir
1521
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1522
		<copy
1523
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1524
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1525
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1526
			<filterset refid="configFilters" />
1527
		</copy>
1528
		<!-- Copy services files into the build -->
1529
		<mkdir dir="${lsid.build.dir}/services" />
1530
		<copy todir="${lsid.build.dir}/services">
1531
			<fileset dir="${services.dir}" />
1532
			<filterset refid="configFilters" />
1533
		</copy>
1534
		<!-- Copy axis files into the build -->
1535
		<mkdir dir="${lsid.build.dir}" />
1536
		<copy todir="${lsid.build.dir}">
1537
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1538
		</copy>
1539
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1540
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1541
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1542
		</copy>
1543
	</target>
1544

    
1545
	<target name="compile-lsid" depends="prepare-lsid"
1546
		description="Compile Java sources">
1547
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1548
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1549
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1550
			deprecation="${compile.deprecation}"
1551
			optimize="${compile.optimize}">
1552
			<classpath refid="lsid.classpath" />
1553
		</javac>
1554
	</target>
1555

    
1556
	<target name="war-lsid" depends="compile-lsid"
1557
		description="Create a war file for the application">
1558
		<mkdir dir="${dist.dir}" />
1559
		<war destfile="${dist.dir}/${authority.context}.war"
1560
			webxml="${webinf.dir}/web.xml">
1561
			<fileset dir="${lsid.build.dir}" />
1562
			<lib dir="${lsid.lib.dir}">
1563
				<patternset refid="lsid.jars" />
1564
			</lib>
1565
			<lib dir="${lib.dir}">
1566
				<patternset refid="lib.jars" />
1567
			</lib>
1568
			<lib dir="${lib.dir}">
1569
				<include name="xalan.jar" />
1570
				<include name="xml-apis.jar" />
1571
			</lib>
1572
			<lib dir="${build.dir}">
1573
				<include name="metacat-client.jar" />
1574
			</lib>
1575
		</war>
1576
	</target>
1577

    
1578
	<target name="deploy-lsid" depends="war-lsid"
1579
		description="Deploy LSID war to servlet container">
1580
		<delete dir="${app.deploy.dir}/${authority.context}" />
1581
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1582
		<mkdir dir="${app.deploy.dir}" />
1583
		<copy todir="${app.deploy.dir}">
1584
			<fileset dir="${dist.dir}" />
1585
		</copy>
1586
	</target>
1587

    
1588
    <!-- Build the dataone service, but only if it is checked out as a
1589
         sibling of the current build directory. Requires maven2 to
1590
         be installed and on the path. -->
1591
    <target name="dataone-service" if="d1.available">
1592
        <property name="d1.jar" value="dataone-service-api-0.3.0.jar"/>
1593

    
1594
        <artifact:mvn pom="${d1.dir}/pom.xml" fork="true"
1595
                      mavenHome="${maven.home}">
1596
            <arg value="install"/>
1597
        </artifact:mvn>
1598
		<copy file="${d1.dir}/target/${d1.jar}" todir="${lib.dir}" />
1599
    </target>
1600
</project>
(5-5/6)