Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
	*   '$RCSfile$'
4
	*     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
	*   Copyright: 2000 Regents of the University of California and the
6
	*              National Center for Ecological Analysis and Synthesis
7
	* For Details: http://www.nceas.ucsb.edu/
8
	*
9
	*    '$Author: leinfelder $'
10
	*    '$Date: 2011-05-24 16:18:55 -0700 (Tue, 24 May 2011) $'
11
	*    '$Revision: 6097 $'
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
	<!-- defining the axis tasks -->
45
	<path id="axis.ant.classpath">
46
		<fileset dir="lib/lsid_lib">
47
			<include name="*.jar" />
48
		</fileset>
49
	</path>
50
    	
51
	<taskdef resource="axis-tasks.properties"
52
		classpathref="axis.ant.classpath" />
53
	
54
	<!-- Determine if ecogrid should be installed-->
55
	<condition property="enable.ecogrid">
56
		<equals arg1="${install.ecogrid}" arg2="true" />
57
	</condition>
58

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

    
64
	<!-- Determine if dataone-service should be built-->
65
	<condition property="d1.available">
66
        <and>
67
	        <available file="${d1.dir}"/>
68
	        <available file="${maven.home}"/>
69
        </and>
70
	</condition>
71

    
72
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
73
			property="tomcat.common.exists" />
74

    
75
	<target name="config" depends="setTomcatCommon, setTomcatNoCommon">
76
		<!-- usr for client testing, generally you don't need change-->
77
		<property name="mcuser"
78
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
79
		<property name="mcpassword" value="kepler" />
80
		<property name="mcanotheruser"
81
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
82
		<property name="mcanotherpassword" value="yourpass" />
83
		<property name="piscouser"
84
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
85
		<property name="piscopassword" value="yourpass" />
86
		<property name="lteruser"
87
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
88
		<property name="lterpassword" value="yourpass" />
89

    
90
		<property name="debug" value="on" />
91
		<property name="morphosourcedir" value="../morpho" />
92
		<property name="utilitiesdir" value="../utilities" />
93
		<property name="installdir"
94
			value="${app.deploy.dir}/${metacat.context}" />
95

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

    
123
			<!-- Include geoserver, geotools, et. al. -->
124
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
125
				<include name="*.jar" />
126
			</fileset>
127

    
128
			<!-- Include OAI-PMH -->
129
			<fileset dir="lib/oaipmh">
130
				<include name="*.jar" />
131
			</fileset>
132

    
133
		</path>
134
		
135
		<path id="test.classpath">
136
			<pathelement location="${jsdk}" />
137
			<pathelement location="lib" />
138
			<fileset dir="lib">
139
				<include name="*.jar" />
140
				<exclude name="maven-ant-tasks-2.1.0.jar" />
141
			</fileset>
142
			<fileset dir="lib">
143
				<include name="xalan.jar" />
144
			</fileset>
145
			<fileset dir="lib/lsid_lib">
146
				<include name="*.jar" />
147
			</fileset>
148

    
149
			<!-- Include geoserver, geotools, et. al. -->
150
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
151
				<include name="*.jar" />
152
			</fileset>
153
		
154

    
155
			<!-- Include OAI-PMH -->
156
			<fileset dir="lib/oaipmh">
157
				<include name="*.jar" />
158
			</fileset>
159

    
160
		</path>
161

    
162
		<!-- It is less likely you'll need to make any changes from here down,
163
			but customization is possible -->
164
		<property name="name" value="metacat" />
165
		<property name="Name" value="MetaCat" />
166
		<property name="debugprefix" value="${Name}:" />
167
		<property name="release" value="${metacat.version}" />
168
		<property name="style-common-relpath" value="/style/common" />
169
		<property name="style-shared-relpath" value="/style/shared" />
170
		<property name="schema-relpath" value="/schema" />
171
		<property name="style-common-cvsrelpath"
172
			value="lib${style-common-relpath}" />
173
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
174
		<property name="style-skins-relpath" value="/style/skins" />
175
		<property name="util-module" value="utilities" />
176
		<!-- property name="utilities-tag" value="trunk" / -->
177
		<property name="utilities-tag" value="tags/UTILITIES_1_1_0_RC2" />
178
		<property name="seek-tag" value="tags/ECOGRID_1_2_2_RC3" />
179
		<property name="eml-module" value="eml" />
180
		<property name="eml-version" value="2.0.0beta6" />
181
		<property name="eml-beta-tag"
182
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
183
		<property name="eml2_0_0-schema-tag"
184
			value="RELEASE_EML_2_0_0_UPDATE_1" />
185
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
186
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
187
		<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1_RC_2" />
188
		<property name="dataone-schema-tag" value="D1_SCHEMA_0_6_1" />
189
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_0_RC12" />
190
		<property name="eml2_0_0namespace"
191
			value="eml://ecoinformatics.org/eml-2.0.0" />
192
		<property name="eml2_0_1namespace"
193
			value="eml://ecoinformatics.org/eml-2.0.1" />
194
		<property name="eml2_1_0namespace"
195
			value="eml://ecoinformatics.org/eml-2.1.0" />
196
		<property name="eml2_1_1namespace"
197
			value="eml://ecoinformatics.org/eml-2.1.1" />
198
		<property name="stmmlnamespace"
199
			value="http://www.xml-cml.org/schema/stmml" />
200
		<property name="eml-css" value="eml_xsl.css" />
201
		<property name="eml-module.default.css" value="default.css" />
202
		<property name="systemidserver" value="" />
203
		<property name="html-path" value="" />
204
		<property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
205

    
206

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

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

    
234
		<filter token="docrooturl" value="./" />
235
		<filter token="mcuser" value="${mcuser}" />
236
		<filter token="mcpassword" value="${mcpassword}" />
237
		<filter token="mcanotheruser" value="${mcanotheruser}" />
238
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
239
		<filter token="eml-css" value="${eml-css}" />
240
		<filter token="style-skins-relpath"
241
			value="${style-skins-relpath}" />
242
		<filter token="style-common-relpath"
243
			value="${style-common-relpath}" />
244

    
245
		<filter token="eml-version" value="${eml-version}" />
246
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
247
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
248
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
249
		<filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
250
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
251
		<filter token="debugprefix" value="${debugprefix}" />
252

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

    
273

    
274
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
275
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
276
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
277

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

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

    
321
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
322

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

    
349
		<!-- load the svn task -->
350
		<path id="svn.classpath">
351
			<pathelement location="${svnjavahl.jar}" />
352
			<pathelement location="${svnant.jar}" />
353
			<pathelement location="${svnClientAdapter.jar}" />
354
		</path>
355
		<taskdef resource="svntask.properties"
356
			classpathref="svn.classpath" />
357

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

    
395
		<condition property="ecogrid.required">
396
			<or>
397
				<not>
398
					<available file="${ecogrid-dir}/build.properties" />
399
				</not>
400
				<not>
401
					<available
402
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
403
				</not>
404
			</or>
405
		</condition>
406

    
407
	</target>
408

    
409
	<target name="prepare" depends="init">
410
		<mkdir dir="${build.dir}" />
411
		<mkdir dir="${build.src}" />
412
		<mkdir dir="${build.dest}" />
413
		<mkdir dir="${build.javadocs}" />
414
		<mkdir dir="${build.tmp}" />
415

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

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

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

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

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

    
454
		<delete file="${build.dir}/${name}.jar" />
455
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
456
			excludes="**/protocols/ **/harvesterClient/" />
457
	</target>
458

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

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

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

    
482
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
483
	</target>
484

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

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

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

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

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

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

    
558
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
559
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
560

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

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

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

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

    
604
		</copy>
605
		<!-- <antcall target="copyxsl">
606
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
607
			<param name="dirname" value="eml-2.0.0" />
608
			</antcall> -->
609

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

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

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

    
647
		<!-- Checkout eml210 for given style sheet tag-->
648
		<svn>
649
			<export srcUrl="${svn.eml2StyleUrl}"
650
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
651
		</svn>
652
		<antcall target="copyxsl">
653
			<param name="cvs.tagname" value="${eml2-style-tag}" />
654
			<!-- param name="dirname" value="eml-2.1.0" / -->
655
			<param name="dirname" value="eml-2" />
656
		</antcall>
657
		
658
		<!-- Checkout eml210 for given schema tag-->
659
		<svn>
660
			<export srcUrl="${svn.eml211SchemaUrl}"
661
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
662
		</svn>
663
		<mkdir dir="lib/schema/eml-2.1.1" />
664
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
665
			<fileset
666
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
667
				<include name="*.xsd" />
668
			</fileset>
669
		</copy>
670
	</target>
671
	
672
	<!-- copies the dataone schemas from a local source if you don't want
673
	     to have to make a ton of svn calls when you're testing (see getd1schemas) -->
674
	<target name="install-dataone" depends="init">
675
	  <property name="dataone-shema-dir" value="../cicore/schemas"/>
676
	  <property name="install-dataone-schema-dir" value="${installdir}/schema/${dataone-schema-tag}"/>
677
	  <mkdir dir="${install-dataone-schema-dir}"/>
678
	  <copy todir="${install-dataone-schema-dir}">
679
	    <fileset dir="${dataone-shema-dir}">
680
	      <include name="**/*.xsd"/>
681
	    </fileset>
682
	  </copy>
683
	</target>
684

    
685
	<!-- get the dataone schemas from svn -->
686
	<target name="getd1schemas" depends="prepare" 
687
		description="Checkout dataone schemas from svn and copy to metacat sandbox">
688
		<delete dir="${build.tmp}/${dataone-schema-tag}"/>
689
        <svn>
690
            <export srcUrl="${svn.dataone-0.1-schema-url}"
691
                destPath="${build.tmp}/${dataone-schema-tag}" />
692
        </svn>
693
        <mkdir dir="lib/schema/${dataone-schema-tag}" />
694
        <copy todir="lib/schema/${dataone-schema-tag}" filtering="yes">
695
            <fileset dir="${build.tmp}/${dataone-schema-tag}">
696
                <include name="*.xsd" />
697
            </fileset>
698
        </copy>
699
    </target>
700

    
701
	<target name="copyxsl"
702
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
703

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

    
706
		<copy todir="${style-common-cvsrelpath}/${dirname}"
707
			filtering="yes">
708
			<fileset
709
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
710
				<include name="**/*.xsl" />
711
			</fileset>
712
		</copy>
713

    
714

    
715
		<!-- now copy default css from eml module and put it in style-common-path
716
			dir with a new name, so other skin-specific css can import it if reqd -->
717
		<copy
718
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
719
			tofile="${style-common-cvsrelpath}/${eml-css}" />
720

    
721
	</target>
722

    
723
	<target name="correctEML201Docs" depends="jar"
724
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
725
		<copy todir="${build.dir}" file="lib/metacat.properties"
726
			filtering="yes" />
727
		<java
728
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
729
			<classpath>
730
				<path refid="compile.classpath" />
731
				<fileset dir="${build.dir}">
732
					<include name="${name}.jar" />
733
				</fileset>
734
			</classpath>
735
		</java>
736
	</target>
737

    
738
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
739
		description="Installs spatial option for metacat">
740

    
741
		<property name="spatial.dir" value="./lib/spatial" />
742
		<property name="spatial.geoserver.dir"
743
			value="${spatial.dir}/geoserver" />
744
		<property name="spatial.webinf-mods"
745
			value="${spatial.dir}/WEB-INF" />
746

    
747
		<!-- Copy geoserver libs into ${war.lib} -->
748
		<copy todir="${war.lib}" filtering="no">
749
			<fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
750
				<include name="**" />
751
			</fileset>
752
		</copy>
753
		
754
		<copy todir="${dist.dir}">
755
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
756
		</copy>
757

    
758
	</target>
759

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

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

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

    
801

    
802
	</target>
803

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1087
		<path id="test.classpath">
1088
			<path refid="compile.classpath" />
1089
			<fileset dir="${build.dir}">
1090
				<include name="${name}.jar" />
1091
				<include name="${name}-client.jar" />
1092
				<include name="harvester.jar" />
1093
			</fileset>
1094
		</path>
1095
		
1096
		<pathconvert pathsep="${line.separator}|  |--" 
1097
		             property="echo.test.classpath"
1098
		             refid="test.classpath">
1099
		</pathconvert>
1100
		<echo message="|--test classpath" />
1101
		<echo message="|  |" />
1102
		<echo message="|  |-- ${echo.test.classpath}" />
1103
		
1104
		<!-- copy and compile the tests into a jar file -->
1105
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1106
			debug="on" includes="**/*.java" encoding="UTF-8">
1107
			<classpath refid="test.classpath" />
1108
		</javac>
1109

    
1110
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1111
			basedir="${build.tests}" includes="**/*.class" />
1112
		
1113
	</target>
1114

    
1115
	<target name="test" depends="testprep"
1116
		description="Uses the ant junit task to run all JUnit tests">
1117

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

    
1132
			<formatter type="plain" />
1133

    
1134
			<batchtest fork="yes" todir="${build.dir}">
1135
				<fileset dir="${build.tests}">
1136
					<include name="**/*.class" />
1137
					<exclude name="**/MCTestCase.class" />
1138
					<exclude name="**/ClientViewHelperTest.class" />
1139
				</fileset>
1140
			</batchtest>
1141
		</junit>
1142
	</target>
1143

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

    
1147
		<echo>testtorun: ${testtorun}</echo>
1148

    
1149
		<!-- use the ant "junit" task to run JUnit tests. -->
1150
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1151
			haltonerror="no" showoutput="yes">
1152
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1153
			<classpath>
1154
				<path refid="test.classpath" />
1155
				<fileset dir="${build.dir}">
1156
					<include name="${name}.jar" />
1157
					<include name="${name}-client.jar" />
1158
					<include name="harvester.jar" />
1159
					<include name="${name}-junittests.jar" />
1160
				</fileset>
1161
			</classpath>
1162

    
1163
			<formatter type="plain" />
1164

    
1165
			<batchtest fork="yes" todir="${build.dir}">
1166
				<fileset dir="${build.tests}">
1167
					<include name="**/${testtorun}.class" />
1168
				</fileset>
1169
			</batchtest>
1170
		</junit>
1171
	</target>
1172

    
1173
	<target name="testharvester" depends="testprep"
1174
		description="Uses the ant junit task to test only the Harvester code">
1175
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1176
			haltonerror="off">
1177
			<classpath>
1178
				<path refid="compile.classpath" />
1179
				<fileset dir="${build.dir}">
1180
					<include name="${name}.jar" />
1181
					<include name="${name}-client.jar" />
1182
					<include name="harvester.jar" />
1183
					<include name="${name}-junittests.jar" />
1184
				</fileset>
1185
			</classpath>
1186
			<formatter type="plain" />
1187
			<batchtest fork="yes" todir="${build.dir}">
1188
				<fileset dir="${build.tests}">
1189
					<include name="**/harvesterClient/*.class" />
1190
				</fileset>
1191
			</batchtest>
1192
		</junit>
1193
	</target>
1194

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

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

    
1215
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1216
			basedir="${build.metacatnettest}" includes="**/*.class" />
1217

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

    
1230
			<formatter type="plain" />
1231

    
1232
			<batchtest fork="yes" todir="${build.dir}">
1233
				<fileset dir="${build.metacatnettest}">
1234
					<include name="**/*.class" />
1235
				</fileset>
1236
			</batchtest>
1237
		</junit>
1238
	</target>
1239

    
1240
	<target name="cleanweb" depends="clean"
1241
		description="deletes tomcat web context dir and all its contents">
1242
		<delete dir="${installdir}" />
1243
	</target>
1244

    
1245

    
1246
	<target name="clean" depends="init"
1247
		description="deletes build dir and files that can be regenerated form the release">
1248
		<delete dir="${build.dir}" />
1249
		<delete dir="${dist.dir}" />
1250
	</target>
1251

    
1252
	<target name="localclean" depends="clean"
1253
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1254
		<delete file="lib/utilities.jar" />
1255
	</target>
1256

    
1257
	<target name="fullclean" depends="localclean"
1258
		description="deletes code and eml">
1259
		<delete includeEmptyDirs="true" failonerror="false">
1260
			<fileset dir="${style-common-cvsrelpath}">
1261
				<include name="${eml-css}" />
1262
				<include name="eml-*/*.xsl" />
1263
				<include name="eml-*" />
1264
			</fileset>
1265
			<fileset dir="${schema-cvsrelpath}">
1266
				<include name="eml-*/*.xsd" />
1267
			</fileset>
1268
			<fileset dir="${ecogrid-dir}"/>
1269
			<fileset dir="lib/style/common/emlb6toeml2"/>
1270
			<fileset dir="lib/dtd"/>
1271
			<fileset dir="lib/schema"/>
1272
		</delete>
1273
	</target>
1274

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1591
    <!-- Build the dataone service, but only if it is checked out as a
1592
         sibling of the current build directory. Requires maven2 to
1593
         be installed and on the path. -->
1594
    <target name="dataone-service" if="d1.available">
1595
        <property name="d1.jar" value="d1_common_java-0.5.0.jar"/>
1596
        <artifact:mvn pom="${d1.dir}/pom.xml" fork="true"
1597
                      mavenHome="${maven.home}">
1598
            <arg value="install"/>
1599
        </artifact:mvn>
1600
		<copy file="${d1.dir}/target/${d1.jar}" todir="${lib.dir}" />
1601
  </target>
1602
</project>
(5-5/6)