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-01-21 15:08:31 -0800 (Fri, 21 Jan 2011) $'
11
	*    '$Revision: 5829 $'
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_RC1" />
178
		<property name="seek-tag" value="tags/ECOGRID_1_2_1" />
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_5_1" />
189
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_0_RC7" />
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

    
205

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

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

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

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

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

    
272

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

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

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

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

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

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

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

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

    
409
	</target>
410

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

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

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

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

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

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

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

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

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

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

    
485
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
486
	</target>
487

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

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

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

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

    
520
	<target name="harvester" depends="client"
521
		description="Compiles harvester java code to build dir">
522
		<javac srcdir="${build.src}" destdir="${build.dest}"
523
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
524
			<classpath>
525
				<path refid="compile.classpath" />
526
			</classpath>
527
		</javac>
528
	</target>
529

    
530
	<target name="harvesterjar" depends="harvester"
531
		description="Compiles and jars harvester java code to harvester.jar in build dir">
532
		<delete file="${build.dir}/harvester.jar" />
533
		<jar jarfile="${build.dir}/harvester.jar"
534
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
535
	</target>
536

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

    
561
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
562
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
563

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

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

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

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

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

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

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

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

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

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

    
704
	<target name="copyxsl"
705
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
706

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

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

    
717

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

    
724
	</target>
725

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

    
741
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
742
		description="Installs spatial option for metacat">
743

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

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

    
757
	</target>
758

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

    
773
	<target name="build-metacat" depends="install-ecogrid"
774
		description="Build Metacat">
775
	</target>
776

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

    
798

    
799
	</target>
800

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

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

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

    
825
	<target name="install-skin" depends="init"
826
		description="Install a Skin">
827

    
828
		<input message="Please enter name of the skin"
829
			addproperty="skin-name" />
830

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

    
875
		<echo message="Install Skin completed." />
876
	</target>
877

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

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

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

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

    
1003
		<copy file="src/perl/register-dataset.cgi"
1004
			todir="${war.context.cgi}" />
1005
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1006
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1007

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

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

    
1029
	<target name="cgiPrepare" if="build.perl">
1030
		<exec dir="src/perl/Metacat/" executable="make">
1031
			<arg value="clean" />
1032
		</exec>
1033
		<exec dir="src/perl/Metacat/" executable="perl">
1034
			<arg value="Makefile.PL" />
1035
		</exec>
1036
		<exec dir="src/perl/Metacat/" executable="make" />
1037
	</target>
1038

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

    
1052
	<target name="getConversionXSL" depends="prepare"
1053
		unless="styles.not.needed"
1054
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1055

    
1056
		<svn>
1057
			<export srcUrl="${svn.eml2StyleUrl}"
1058
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1059
		</svn>
1060

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

    
1071
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1072
		<mkdir dir="${build.tests}" />
1073
		<copy todir="${build.tests}" encoding="UTF-8">
1074
			<fileset dir="${testdir}">
1075
				<include name="edu/**" />
1076
			</fileset>
1077
		</copy>
1078
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1079

    
1080
		<!-- copy and compile the tests into a jar file -->
1081
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1082
			debug="on" includes="**/*.java" encoding="UTF-8">
1083
			<classpath>
1084
				<path refid="compile.classpath" />
1085
				<fileset dir="${build.dir}">
1086
					<include name="${name}.jar" />
1087
					<include name="${name}-client.jar" />
1088
					<include name="harvester.jar" />
1089
				</fileset>
1090
			</classpath>
1091
		</javac>
1092

    
1093
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1094
			basedir="${build.tests}" includes="**/*.class" />
1095
	</target>
1096

    
1097
	<target name="test" depends="testprep"
1098
		description="Uses the ant junit task to run all JUnit tests">
1099

    
1100
		<!-- use the ant "junit" task to run JUnit tests. -->
1101
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1102
			haltonerror="no">
1103
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1104
			<classpath>
1105
				<path refid="test.classpath" />
1106
				<fileset dir="${build.dir}">
1107
					<include name="${name}.jar" />
1108
					<include name="${name}-client.jar" />
1109
					<include name="harvester.jar" />
1110
					<include name="${name}-junittests.jar" />
1111
				</fileset>
1112
			</classpath>
1113

    
1114
			<formatter type="plain" />
1115

    
1116
			<batchtest fork="yes" todir="${build.dir}">
1117
				<fileset dir="${build.tests}">
1118
					<include name="**/*.class" />
1119
					<exclude name="**/MCTestCase.class" />
1120
					<exclude name="**/ClientViewHelperTest.class" />
1121
				</fileset>
1122
			</batchtest>
1123
		</junit>
1124
	</target>
1125

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

    
1129
		<echo>testtorun: ${testtorun}</echo>
1130

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

    
1146
			<formatter type="plain" />
1147

    
1148
			<batchtest fork="yes" todir="${build.dir}">
1149
				<fileset dir="${build.tests}">
1150
					<include name="**/${testtorun}.class" />
1151
				</fileset>
1152
			</batchtest>
1153
		</junit>
1154
	</target>
1155

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

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

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

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

    
1205
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1206
			basedir="${build.metacatnettest}" includes="**/*.class" />
1207

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

    
1220
			<formatter type="plain" />
1221

    
1222
			<batchtest fork="yes" todir="${build.dir}">
1223
				<fileset dir="${build.metacatnettest}">
1224
					<include name="**/*.class" />
1225
				</fileset>
1226
			</batchtest>
1227
		</junit>
1228
	</target>
1229

    
1230
	<target name="cleanweb" depends="clean"
1231
		description="deletes tomcat web context dir and all its contents">
1232
		<delete dir="${installdir}" />
1233
	</target>
1234

    
1235

    
1236
	<target name="clean" depends="init"
1237
		description="deletes build dir and files that can be regenerated form the release">
1238
		<delete dir="${build.dir}" />
1239
		<delete dir="${dist.dir}" />
1240
	</target>
1241

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1407

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

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

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

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

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

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

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

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

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

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

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

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

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

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