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-01-25 14:49:04 -0800 (Tue, 25 Jan 2011) $'
11
	*    '$Revision: 5842 $'
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}" />
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/WEB-INF/**" />
982
			</fileset>
983
		</copy>
984
		<copy todir="${war.context.docs}" filtering="yes">
985
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
986
		</copy>
987
		<copy todir="${war.context.docs}" filtering="no">
988
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
989
		</copy>
990
		<copy todir="${war.webinf.sql}" filtering="yes">
991
			<fileset dir="src">
992
				<include name="**/*.sql" />
993
			</fileset>
994
		</copy>
995
		<copy todir="${war.webinf.scripts}" filtering="yes">
996
			<fileset dir="src/scripts" />
997
		</copy>
998
		<copy todir="${war.webinf.scripts}"
999
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1000
			failonerror="false" />
1001

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1113
			<formatter type="plain" />
1114

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

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

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

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

    
1145
			<formatter type="plain" />
1146

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

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

    
1177
	<target name="gethttpclient" depends="prepare"
1178
		description="checks out and compiles morpho httpclient code">
1179
		<!--mkdir dir="${morphosourcedir}" -->
1180
		<cvs cvsRoot="${cvsroot}" package="morpho" dest="." />
1181
		<ant dir="${morphosourcedir}" inheritAll="false" target="jar" />
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/httpclient.jar" />
1244
		<delete file="lib/utilities.jar" />
1245
	</target>
1246

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1403

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

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

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

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

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

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

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

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

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

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

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

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

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

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