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-08-24 12:07:09 -0700 (Tue, 24 Aug 2010) $'
11
	*    '$Revision: 5511 $'
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_4" />
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
		</ant>
788
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
789
			inheritall="false">
790
			<property name="context" value="${metacat.context}" />
791
			<property name="target" value="${ecogrid-target-name}" />
792
			<property name="metacat.dir" value="${basedir}"/>
793
		</ant>
794
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
795
			<webinf dir="${ecogrid-dir}/lib">
796
			<include name="server-config.wsdd"/>
797
			</webinf>
798
			</war -->
799
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
800
			todir="${dist.dir}" overwrite="true" />
801

    
802

    
803
	</target>
804

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1119
			<formatter type="plain" />
1120

    
1121
			<batchtest fork="yes" todir="${build.dir}">
1122
				<fileset dir="${build.tests}">
1123
					<include name="**/*.class" />
1124
					<exclude name="**/MCTestCase.class" />
1125
					<exclude name="**/ClientViewHelperTest.class" />
1126
				</fileset>
1127
			</batchtest>
1128
		</junit>
1129
	</target>
1130

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

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

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

    
1150
			<formatter type="plain" />
1151

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

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

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

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

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

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

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

    
1224
			<formatter type="plain" />
1225

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

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

    
1239

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1408

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

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

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

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

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

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

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

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

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

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

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

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

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

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