Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
	*   '$RCSfile$'
4
	*     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
	*   Copyright: 2000 Regents of the University of California and the
6
	*              National Center for Ecological Analysis and Synthesis
7
	* For Details: http://www.nceas.ucsb.edu/
8
	*
9
	*    '$Author: leinfelder $'
10
	*    '$Date: 2011-01-31 15:31:33 -0800 (Mon, 31 Jan 2011) $'
11
	*    '$Revision: 5872 $'
12
	*
13
	* Build file for the Ant cross-platform build system for metacat
14
	* See http://jakarta.apache.org for details on Ant
15
	*
16
	* usage: ant [compile|jar|install|jdoc]
17
	*
18
	* This program is free software; you can redistribute it and/or modify
19
	* it under the terms of the GNU General Public License as published by
20
	* the Free Software Foundation; either version 2 of the License, or
21
	* (at your option) any later version.
22
	*
23
	* This program is distributed in the hope that it will be useful,
24
	* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
	* GNU General Public License for more details.
27
	*
28
	* You should have received a copy of the GNU General Public License
29
	* along with this program; if not, write to the Free Software
30
	* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir="."
33
         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
34
	<property environment="env" />
35
	<property file="build.properties" /><!-- USER SPECIFIC PROPS -->
36

    
37

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

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

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

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

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

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

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

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

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

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

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

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

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

    
160
		</path>
161

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

    
205

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

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

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

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

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

    
272

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

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

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

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

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

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

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

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

    
409
	</target>
410

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
717

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

    
724
	</target>
725

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

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

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

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

    
761
	</target>
762

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

    
779
	<target name="build-metacat" depends="install-ecogrid, install-spatial"
780
		description="Build Metacat">
781
	</target>
782

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

    
804

    
805
	</target>
806

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

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

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

    
831
	<target name="install-skin" depends="init"
832
		description="Install a Skin">
833

    
834
		<input message="Please enter name of the skin"
835
			addproperty="skin-name" />
836

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

    
881
		<echo message="Install Skin completed." />
882
	</target>
883

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

    
895
	<target name="warPrepare"
896
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
897
		description="Prepare files for creating a web archive (WAR)">
898

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

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

    
1013
		<copy file="src/perl/register-dataset.cgi"
1014
			todir="${war.context.cgi}" />
1015
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1016
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1017

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

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

    
1039
	<target name="cgiPrepare" if="build.perl">
1040
		<exec dir="src/perl/Metacat/" executable="make">
1041
			<arg value="clean" />
1042
		</exec>
1043
		<exec dir="src/perl/Metacat/" executable="perl">
1044
			<arg value="Makefile.PL" />
1045
		</exec>
1046
		<exec dir="src/perl/Metacat/" executable="make" />
1047
	</target>
1048

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

    
1062
	<target name="getConversionXSL" depends="prepare"
1063
		unless="styles.not.needed"
1064
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1065

    
1066
		<svn>
1067
			<export srcUrl="${svn.eml2StyleUrl}"
1068
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1069
		</svn>
1070

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

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

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

    
1103
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1104
			basedir="${build.tests}" includes="**/*.class" />
1105
	</target>
1106

    
1107
	<target name="test" depends="testprep"
1108
		description="Uses the ant junit task to run all JUnit tests">
1109

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

    
1124
			<formatter type="plain" />
1125

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

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

    
1139
		<echo>testtorun: ${testtorun}</echo>
1140

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

    
1156
			<formatter type="plain" />
1157

    
1158
			<batchtest fork="yes" todir="${build.dir}">
1159
				<fileset dir="${build.tests}">
1160
					<include name="**/${testtorun}.class" />
1161
				</fileset>
1162
			</batchtest>
1163
		</junit>
1164
	</target>
1165

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

    
1188
	<target name="gethttpclient" depends="prepare"
1189
		description="checks out and compiles morpho httpclient code">
1190
		<!--mkdir dir="${morphosourcedir}" -->
1191
		<cvs cvsRoot="${cvsroot}" package="morpho" dest="." />
1192
		<ant dir="${morphosourcedir}" inheritAll="false" target="jar" />
1193
	</target>
1194

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

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

    
1215
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1216
			basedir="${build.metacatnettest}" includes="**/*.class" />
1217

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

    
1230
			<formatter type="plain" />
1231

    
1232
			<batchtest fork="yes" todir="${build.dir}">
1233
				<fileset dir="${build.metacatnettest}">
1234
					<include name="**/*.class" />
1235
				</fileset>
1236
			</batchtest>
1237
		</junit>
1238
	</target>
1239

    
1240
	<target name="cleanweb" depends="clean"
1241
		description="deletes tomcat web context dir and all its contents">
1242
		<delete dir="${installdir}" />
1243
	</target>
1244

    
1245

    
1246
	<target name="clean" depends="init"
1247
		description="deletes build dir and files that can be regenerated form the release">
1248
		<delete dir="${build.dir}" />
1249
		<delete dir="${dist.dir}" />
1250
	</target>
1251

    
1252
	<target name="localclean" depends="clean"
1253
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1254
		<delete file="lib/httpclient.jar" />
1255
		<delete file="lib/utilities.jar" />
1256
	</target>
1257

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

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

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

    
1302
		<copy todir="${ver.dir}/docs" filtering="yes">
1303
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1304
		</copy>
1305
		<copy todir="${ver.dir}/docs" filtering="no">
1306
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1307
		</copy>
1308
		<copy todir="${ver.dir}/docs/dev">
1309
			<fileset dir="${build.dir}/docs" />
1310
		</copy>
1311
		<copy todir="${ver.dir}/src">
1312
			<fileset dir="${build.dir}/src" />
1313
		</copy>
1314

    
1315
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1316
		<copy todir="${ver.dir}/test/servertestfiles">
1317
			<fileset dir="./test/servertestfiles" />
1318
		</copy>
1319
	</target>
1320

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

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

    
1348
		<mkdir dir="${ecogrid-dist-dir}" />
1349
		<copy todir="${ecogrid-dist-dir}">
1350
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1351
		</copy>
1352

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

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

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

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

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

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

    
1396
		<move file="${pkg.dir}/debian.deb"
1397
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1398
	</target>
1399

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

    
1414

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

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

    
1430
	<target name="spatial_option" depends="prepare"
1431
		description=" -- compiles code for the spatial option">
1432

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

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

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

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

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

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

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

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

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

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

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