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-07-20 15:05:48 -0700 (Wed, 20 Jul 2011) $'
11
	*    '$Revision: 6363 $'
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_2" />
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="QueryGroupTest" />
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
					<!-- these are not test cases -->
1140
					<exclude name="**/MockCNode.class" />
1141
					<exclude name="**/D1NodeServiceTest.class" />
1142
				</fileset>
1143
			</batchtest>
1144
		</junit>
1145
	</target>
1146

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

    
1150
		<echo>testtorun: ${testtorun}</echo>
1151

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

    
1166
			<formatter type="plain" />
1167

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

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

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

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

    
1218
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1219
			basedir="${build.metacatnettest}" includes="**/*.class" />
1220

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

    
1233
			<formatter type="plain" />
1234

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

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

    
1248

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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