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: tao $'
10
	*    '$Date: 2011-02-04 16:45:21 -0800 (Fri, 04 Feb 2011) $'
11
	*    '$Revision: 5919 $'
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_2_RC2" />
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
		<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="InternationalizationTest" />
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/tags/${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 **/stringclient/** **/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
		<!-- copy and compile the tests into a jar file -->
1088
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1089
			debug="on" includes="**/*.java" encoding="UTF-8">
1090
			<classpath>
1091
				<path refid="compile.classpath" />
1092
				<fileset dir="${build.dir}">
1093
					<include name="${name}.jar" />
1094
					<include name="${name}-client.jar" />
1095
					<include name="harvester.jar" />
1096
				</fileset>
1097
			</classpath>
1098
		</javac>
1099

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

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

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

    
1121
			<formatter type="plain" />
1122

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

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

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

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

    
1152
			<formatter type="plain" />
1153

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

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

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

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

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

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

    
1219
			<formatter type="plain" />
1220

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

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

    
1234

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

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

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

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

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

    
1290
		<copy todir="${ver.dir}/docs" filtering="yes">
1291
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1292
		</copy>
1293
		<copy todir="${ver.dir}/docs" filtering="no">
1294
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1295
		</copy>
1296
		<copy todir="${ver.dir}/docs/dev">
1297
			<fileset dir="${build.dir}/docs" />
1298
		</copy>
1299
		<copy todir="${ver.dir}/src">
1300
			<fileset dir="${build.dir}/src" />
1301
		</copy>
1302

    
1303
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1304
		<copy todir="${ver.dir}/test/servertestfiles">
1305
			<fileset dir="./test/servertestfiles" />
1306
		</copy>
1307
	</target>
1308

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

    
1325
	<target name="distsrc" depends="dist"
1326
		description="prepares a source distribution">
1327
		<mkdir dir="${ver.src}" />
1328
		<copy todir="${ver.src}">
1329
			<fileset dir="./src" />
1330
		</copy>
1331
		<mkdir dir="${util.dir}" />
1332
		<copy todir="${util.dir}">
1333
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1334
		</copy>
1335

    
1336
		<mkdir dir="${ecogrid-dist-dir}" />
1337
		<copy todir="${ecogrid-dist-dir}">
1338
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1339
		</copy>
1340

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

    
1343
		<delete file="./${name}-src-${release}.zip" />
1344
		<zip zipfile="./${name}-src-${release}.zip"
1345
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1346
		<delete file="./${name}-src-${release}.tar.gz" />
1347
		<tar tarfile="./${name}-src-${release}.tar"
1348
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1349
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1350
			src="./${name}-src-${release}.tar" />
1351
		<delete file="./${name}-src-${release}.tar" />
1352
		<!--delete dir="${dist.dir}"/ -->
1353
	</target>
1354

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

    
1364
		<mkdir
1365
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1366
		<copy
1367
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1368
			filtering="yes">
1369
			<fileset dir="./src/scripts/debian"
1370
				excludes="control postinst" />
1371
		</copy>
1372
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1373

    
1374
		<copy file="${dist.dir}/knb.war"
1375
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1376
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1377
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1378

    
1379
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1380
			failonerror="true">
1381
			<arg line="--build debian" />
1382
		</exec>
1383

    
1384
		<move file="${pkg.dir}/debian.deb"
1385
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1386
	</target>
1387

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

    
1402

    
1403
	<target name="compilewebclient" depends="prepare">
1404
		<javac srcdir="${build.src}" destdir="${build.dest}"
1405
			includes="**/application/*.java" classpathref="webservicepath" />
1406
	</target>
1407

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

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

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

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

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

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

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

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

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

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

    
1567
	<target name="deploy-lsid" depends="war-lsid"
1568
		description="Deploy LSID war to servlet container">
1569
		<delete dir="${app.deploy.dir}/${authority.context}" />
1570
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1571
		<mkdir dir="${app.deploy.dir}" />
1572
		<copy todir="${app.deploy.dir}">
1573
			<fileset dir="${dist.dir}" />
1574
		</copy>
1575
	</target>
1576
	
1577
	<target name="change-metacat-properties" depends="warPrepare"
1578
        description="Chage some default values of metacat.properties">
1579
       <propertyfile file="${metacat-properties-file}">
1580
		   <entry  key="configutil.propertiesConfigured" operation="=" value="true"/>
1581
		   <entry  key="configutil.authConfigured" operation="=" value="true"/>
1582
		   <entry  key="configutil.skinsConfigured" operation="=" value="true"/>
1583
		   <entry  key="configutil.databaseConfigured" operation="=" value="true"/>
1584
		   <entry  key="configutil.geoserverConfigured" operation="=" value="true"/>
1585
	   </propertyfile>
1586
    </target>
1587
	
1588
	<target name="install-without-configuration" depends="change-metacat-properties, install"
1589
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1590
    </target>
1591
	
1592

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

    
1599
        <artifact:mvn pom="${d1.dir}/pom.xml" fork="true"
1600
                      mavenHome="${maven.home}">
1601
            <arg value="install"/>
1602
        </artifact:mvn>
1603
		<copy file="${d1.dir}/target/${d1.jar}" todir="${lib.dir}" />
1604
    </target>
1605
</project>
(5-5/6)