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-02-04 06:17:53 -0800 (Fri, 04 Feb 2011) $'
11
	*    '$Revision: 5914 $'
12
	*
13
	* Build file for the Ant cross-platform build system for metacat
14
	* See http://jakarta.apache.org for details on Ant
15
	*
16
	* usage: ant [compile|jar|install|jdoc]
17
	*
18
	* This program is free software; you can redistribute it and/or modify
19
	* it under the terms of the GNU General Public License as published by
20
	* the Free Software Foundation; either version 2 of the License, or
21
	* (at your option) any later version.
22
	*
23
	* This program is distributed in the hope that it will be useful,
24
	* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
	* GNU General Public License for more details.
27
	*
28
	* You should have received a copy of the GNU General Public License
29
	* along with this program; if not, write to the Free Software
30
	* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir="."
33
         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
34
	<property environment="env" />
35
	<property file="build.properties" /><!-- USER SPECIFIC PROPS -->
36

    
37

    
38
    <!-- Configure the maven2 ant tasks -->
39
    <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
40
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
41
             uri="antlib:org.apache.maven.artifact.ant"
42
             classpathref="maven-ant-tasks.classpath" />
43

    
44
	<!-- defining the axis tasks -->
45
	<path id="axis.ant.classpath">
46
		<fileset dir="lib/lsid_lib">
47
			<include name="*.jar" />
48
		</fileset>
49
	</path>
50
	
51
	<taskdef resource="axis-tasks.properties"
52
		classpathref="axis.ant.classpath" />
53
	
54
	<!-- Determine if ecogrid should be installed-->
55
	<condition property="enable.ecogrid">
56
		<equals arg1="${install.ecogrid}" arg2="true" />
57
	</condition>
58

    
59
	<!-- Determine if perl should be built-->
60
	<condition property="build.perl">
61
		<equals arg1="${make.perl.code}" arg2="true" />
62
	</condition>
63

    
64
	<!-- Determine if dataone-service should be built-->
65
	<condition property="d1.available">
66
        <and>
67
	        <available file="${d1.dir}"/>
68
	        <available file="${maven.home}"/>
69
        </and>
70
	</condition>
71

    
72
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
73
			property="tomcat.common.exists" />
74

    
75
	<target name="config" depends="setTomcatCommon, setTomcatNoCommon">
76
		<!-- usr for client testing, generally you don't need change-->
77
		<property name="mcuser"
78
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
79
		<property name="mcpassword" value="kepler" />
80
		<property name="mcanotheruser"
81
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
82
		<property name="mcanotherpassword" value="yourpass" />
83
		<property name="piscouser"
84
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
85
		<property name="piscopassword" value="yourpass" />
86
		<property name="lteruser"
87
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
88
		<property name="lterpassword" value="yourpass" />
89

    
90
		<property name="debug" value="on" />
91
		<property name="morphosourcedir" value="../morpho" />
92
		<property name="utilitiesdir" value="../utilities" />
93
		<property name="installdir"
94
			value="${app.deploy.dir}/${metacat.context}" />
95

    
96
		<echo>*********** set jsdk to ${jsdk}</echo>
97
	</target>
98
	
99
	<target name="setTomcatCommon" if="tomcat.common.exists" >
100
		<property name="jsdk"
101
			value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
102
	</target>
103
	
104
	<target name="setTomcatNoCommon" unless="tomcat.common.exists" >
105
		<property name="jsdk"
106
			value="${build.tomcat.dir}/lib/servlet-api.jar" />
107
	</target>
108
	
109
	<target name="init" depends="config">
110
		<path id="compile.classpath">
111
			<pathelement location="${jsdk}" />
112
			<pathelement location="lib" />
113
			<fileset dir="lib">
114
				<include name="*.jar" />
115
			</fileset>
116
			<fileset dir="lib">
117
				<include name="xalan.jar" />
118
			</fileset>
119
			<fileset dir="lib/lsid_lib">
120
				<include name="*.jar" />
121
			</fileset>
122

    
123
			<!-- Include geoserver, geotools, et. al. -->
124
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
125
				<include name="*.jar" />
126
			</fileset>
127

    
128
			<!-- Include OAI-PMH -->
129
			<fileset dir="lib/oaipmh">
130
				<include name="*.jar" />
131
			</fileset>
132

    
133
		</path>
134
		
135
		<path id="test.classpath">
136
			<pathelement location="${jsdk}" />
137
			<pathelement location="lib" />
138
			<fileset dir="lib">
139
				<include name="*.jar" />
140
				<exclude name="maven-ant-tasks-2.1.0.jar" />
141
			</fileset>
142
			<fileset dir="lib">
143
				<include name="xalan.jar" />
144
			</fileset>
145
			<fileset dir="lib/lsid_lib">
146
				<include name="*.jar" />
147
			</fileset>
148

    
149
			<!-- Include geoserver, geotools, et. al. -->
150
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
151
				<include name="*.jar" />
152
			</fileset>
153
		
154

    
155
			<!-- Include OAI-PMH -->
156
			<fileset dir="lib/oaipmh">
157
				<include name="*.jar" />
158
			</fileset>
159

    
160
		</path>
161

    
162
		<!-- It is less likely you'll need to make any changes from here down,
163
			but customization is possible -->
164
		<property name="name" value="metacat" />
165
		<property name="Name" value="MetaCat" />
166
		<property name="debugprefix" value="${Name}:" />
167
		<property name="release" value="${metacat.version}" />
168
		<property name="style-common-relpath" value="/style/common" />
169
		<property name="style-shared-relpath" value="/style/shared" />
170
		<property name="schema-relpath" value="/schema" />
171
		<property name="style-common-cvsrelpath"
172
			value="lib${style-common-relpath}" />
173
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
174
		<property name="style-skins-relpath" value="/style/skins" />
175
		<property name="util-module" value="utilities" />
176
		<!-- property name="utilities-tag" value="trunk" / -->
177
		<property name="utilities-tag" value="tags/UTILITIES_1_1_0_RC1" />
178
		<property name="seek-tag" value="tags/ECOGRID_1_2_2_RC2" />
179
		<property name="eml-module" value="eml" />
180
		<property name="eml-version" value="2.0.0beta6" />
181
		<property name="eml-beta-tag"
182
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
183
		<property name="eml2_0_0-schema-tag"
184
			value="RELEASE_EML_2_0_0_UPDATE_1" />
185
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
186
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
187
		<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1_RC_2" />
188
		<property name="dataone-schema-tag" value="D1_SCHEMA_0_5_1" />
189
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_0_RC7" />
190
		<property name="eml2_0_0namespace"
191
			value="eml://ecoinformatics.org/eml-2.0.0" />
192
		<property name="eml2_0_1namespace"
193
			value="eml://ecoinformatics.org/eml-2.0.1" />
194
		<property name="eml2_1_0namespace"
195
			value="eml://ecoinformatics.org/eml-2.1.0" />
196
		<property name="eml2_1_1namespace"
197
			value="eml://ecoinformatics.org/eml-2.1.1" />
198
		<property name="stmmlnamespace"
199
			value="http://www.xml-cml.org/schema/stmml" />
200
		<property name="eml-css" value="eml_xsl.css" />
201
		<property name="eml-module.default.css" value="default.css" />
202
		<property name="systemidserver" value="" />
203
		<property name="html-path" value="" />
204

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

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

    
406
	</target>
407

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

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

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

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

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

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

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

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

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

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

    
481
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
482
	</target>
483

    
484
	<target name="getutilities" depends="prepare"
485
		description="Checks utility out of svn and copies it to your metacat sandbox">
486
		<svn>
487
			<export srcUrl="${svn.utilitiesUrl}"
488
				destPath="${utilitiesdir}" force="true" />
489
		</svn>
490
	</target>
491

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

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

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

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

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

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

    
557
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
558
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
559

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

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

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

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

    
603
		</copy>
604
		<!-- <antcall target="copyxsl">
605
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
606
			<param name="dirname" value="eml-2.0.0" />
607
			</antcall> -->
608

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

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

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

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

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

    
700
	<target name="copyxsl"
701
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
702

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

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

    
713

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

    
720
	</target>
721

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

    
737
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
738
		description="Installs spatial option for metacat">
739

    
740
		<property name="spatial.dir" value="./lib/spatial" />
741
		<property name="spatial.geoserver.dir"
742
			value="${spatial.dir}/geoserver" />
743
		<property name="spatial.webinf-mods"
744
			value="${spatial.dir}/WEB-INF" />
745

    
746
		<!-- Copy geoserver libs into ${war.lib} -->
747
		<copy todir="${war.lib}" filtering="no">
748
			<fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
749
				<include name="**" />
750
			</fileset>
751
		</copy>
752
		
753
		<copy todir="${dist.dir}">
754
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
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
		<copy file="${dist.dir}/geoserver.war"
768
					todir="${app.deploy.dir}" />
769
		<tstamp>
770
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
771
		</tstamp>
772
		<echo>Dev install completed at ${NOW}</echo>
773
	</target>
774

    
775
	<target name="build-metacat" depends="install-ecogrid, install-spatial"
776
		description="Build Metacat">
777
	</target>
778

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

    
800

    
801
	</target>
802

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

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

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

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

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

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

    
877
		<echo message="Install Skin completed." />
878
	</target>
879

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1120
			<formatter type="plain" />
1121

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

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

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

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

    
1151
			<formatter type="plain" />
1152

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

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

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

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

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

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

    
1218
			<formatter type="plain" />
1219

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

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

    
1233

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1401

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

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

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

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

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

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

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

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

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

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

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

    
1566
	<target name="deploy-lsid" depends="war-lsid"
1567
		description="Deploy LSID war to servlet container">
1568
		<delete dir="${app.deploy.dir}/${authority.context}" />
1569
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1570
		<mkdir dir="${app.deploy.dir}" />
1571
		<copy todir="${app.deploy.dir}">
1572
			<fileset dir="${dist.dir}" />
1573
		</copy>
1574
	</target>
1575

    
1576
    <!-- Build the dataone service, but only if it is checked out as a
1577
         sibling of the current build directory. Requires maven2 to
1578
         be installed and on the path. -->
1579
    <target name="dataone-service" if="d1.available">
1580
        <property name="d1.jar" value="dataone-service-api-0.3.0.jar"/>
1581

    
1582
        <artifact:mvn pom="${d1.dir}/pom.xml" fork="true"
1583
                      mavenHome="${maven.home}">
1584
            <arg value="install"/>
1585
        </artifact:mvn>
1586
		<copy file="${d1.dir}/target/${d1.jar}" todir="${lib.dir}" />
1587
    </target>
1588
</project>
(5-5/6)