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-31 11:29:00 -0800 (Mon, 31 Jan 2011) $'
11
	*    '$Revision: 5866 $'
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_RC1" />
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}" force="true" />
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
			</fileset>
983
		</copy>
984
		<copy todir="${war.context}" filtering="no">
985
			<fileset dir="lib">
986
				<include name="spatial/geoserver/data/**" />
987
			</fileset>
988
		</copy>
989
		<copy todir="${war.context.docs}" filtering="yes">
990
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
991
		</copy>
992
		<copy todir="${war.context.docs}" filtering="no">
993
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
994
		</copy>
995
		<copy todir="${war.webinf.sql}" filtering="yes">
996
			<fileset dir="src">
997
				<include name="**/*.sql" />
998
			</fileset>
999
		</copy>
1000
		<copy todir="${war.webinf.scripts}" filtering="yes">
1001
			<fileset dir="src/scripts" />
1002
		</copy>
1003
		<copy todir="${war.webinf.scripts}"
1004
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1005
			failonerror="false" />
1006

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1118
			<formatter type="plain" />
1119

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

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

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

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

    
1150
			<formatter type="plain" />
1151

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

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

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

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

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

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

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

    
1224
			<formatter type="plain" />
1225

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

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

    
1239

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1411

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

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

    
1427
	<target name="spatial_option" depends="prepare"
1428
		description=" -- compiles code for the spatial option">
1429

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

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

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

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

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

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

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

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

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

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

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