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: jones $'
10
	*    '$Date: 2010-04-01 16:30:27 -0700 (Thu, 01 Apr 2010) $'
11
	*    '$Revision: 5297 $'
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
	<!-- Determine if ecogrid should be installed-->
45
	<condition property="enable.ecogrid">
46
		<equals arg1="${install.ecogrid}" arg2="true" />
47
	</condition>
48

    
49
	<!-- Determine if perl should be built-->
50
	<condition property="build.perl">
51
		<equals arg1="${make.perl.code}" arg2="true" />
52
	</condition>
53

    
54
	<!-- Determine if dataone-service should be built-->
55
	<condition property="d1.available">
56
        <and>
57
	        <available file="${d1.dir}"/>
58
	        <available file="${maven.home}"/>
59
        </and>
60
	</condition>
61

    
62
	<target name="config">
63
        <!-- Find the servlet-api.jar, depending on the tomcat version. -->
64
		<property name="t5.jar" 
65
                 value="${build.tomcat.dir}/common/lib/servlet-api.jar"/>
66
		<property name="t6.jar" 
67
                 value="${build.tomcat.dir}/lib/servlet-api.jar"/>
68
		<available file="${t5.jar}" property="jsdk" value="${t5.jar}"/>
69
		<available file="${t6.jar}" property="jsdk" value="${t6.jar}"/>
70

    
71
		<!-- usr for client testing, generally you don't need change-->
72
		<property name="mcuser"
73
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
74
		<property name="mcpassword" value="kepler" />
75
		<property name="mcanotheruser"
76
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
77
		<property name="mcanotherpassword" value="yourpass" />
78
		<property name="piscouser"
79
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
80
		<property name="piscopassword" value="yourpass" />
81
		<property name="lteruser"
82
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
83
		<property name="lterpassword" value="yourpass" />
84

    
85
		<property name="debug" value="on" />
86
		<property name="morphosourcedir" value="../morpho" />
87
		<property name="utilitiesdir" value="../utilities" />
88
		<property name="installdir"
89
			value="${app.deploy.dir}/${metacat.context}" />
90

    
91
		<echo>*********** set jsdk to ${jsdk}</echo>
92
	</target>
93

    
94
	<target name="init" depends="config">
95
		<path id="compile.classpath">
96
			<pathelement location="${jsdk}" />
97
			<pathelement location="lib" />
98
			<fileset dir="lib">
99
				<include name="*.jar" />
100
			</fileset>
101
			<fileset dir="lib">
102
				<include name="xalan.jar" />
103
			</fileset>
104
			<fileset dir="lib/lsid_lib">
105
				<include name="*.jar" />
106
			</fileset>
107

    
108
			<!-- Include geoserver, geotools, et. al. -->
109
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
110
				<include name="*.jar" />
111
			</fileset>
112
			<pathelement
113
				location="lib/spatial/geoserver/WEB-INF/classes" />
114

    
115
			<!-- Include OAI-PMH -->
116
			<fileset dir="lib/oaipmh">
117
				<include name="*.jar" />
118
			</fileset>
119

    
120
		</path>
121

    
122
		<!-- It is less likely you'll need to make any changes from here down,
123
			but customization is possible -->
124
		<property name="name" value="metacat" />
125
		<property name="Name" value="MetaCat" />
126
		<property name="debugprefix" value="${Name}:" />
127
		<property name="release" value="${metacat.version}" />
128
		<property name="style-common-relpath" value="/style/common" />
129
		<property name="style-shared-relpath" value="/style/shared" />
130
		<property name="schema-relpath" value="/schema" />
131
		<property name="style-common-cvsrelpath"
132
			value="lib${style-common-relpath}" />
133
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
134
		<property name="style-skins-relpath" value="/style/skins" />
135
		<property name="util-module" value="utilities" />
136
		<!-- property name="utilities-tag" value="/tags/UTILITIES_1_0_1_RC2" / -->
137
		<property name="utilities-tag" value="trunk" />
138
		<property name="eml-module" value="eml" />
139
		<property name="eml-version" value="2.0.0beta6" />
140
		<property name="eml-beta-tag"
141
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
142
		<property name="eml2_0_0-schema-tag"
143
			value="RELEASE_EML_2_0_0_UPDATE_1" />
144
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
145
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
146
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_0_9_0" />
147
		<property name="eml2_0_0namespace"
148
			value="eml://ecoinformatics.org/eml-2.0.0" />
149
		<property name="eml2_0_1namespace"
150
			value="eml://ecoinformatics.org/eml-2.0.1" />
151
		<property name="eml2_1_0namespace"
152
			value="eml://ecoinformatics.org/eml-2.1.0" />
153
		<property name="stmmlnamespace"
154
			value="http://www.xml-cml.org/schema/stmml" />
155
		<property name="eml-css" value="eml_xsl.css" />
156
		<property name="eml-module.default.css" value="default.css" />
157
		<property name="systemidserver" value="" />
158
		<property name="html-path" value="" />
159

    
160

    
161
		<!-- Config for registry variables -->
162
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
163
		<property name="scope" value="obfs" />
164
		<property name="responseForm" value="genericResponse.tmpl" />
165
		<property name="entryForm" value="entryForm.tmpl" />
166
		<property name="guide" value="genericGuide.tmpl" />
167
		<property name="loginForm" value="loginForm.tmpl" />
168
		<property name="confirmData" value="confirmData.tmpl" />
169
		<property name="deleteData" value="deleteData.tmpl" />
170
		<property name="genericHeader" value="genericHeader.tmpl" />
171
		<property name="genericFooter" value="genericFooter.tmpl" />
172

    
173
		<filter token="scope" value="${scope}" />
174
		<filter token="responseForm" value="${responseForm}" />
175
		<filter token="entryForm" value="${entryForm}" />
176
		<filter token="guide" value="${guide}" />
177
		<filter token="loginForm" value="${loginForm}" />
178
		<filter token="confirmData" value="${confirmData}" />
179
		<filter token="deleteData" value="${deleteData}" />
180
		<filter token="genericHeader" value="${genericHeader}" />
181
		<filter token="genericFooter" value="${genericFooter}" />
182
		<filter token="adminname" value="${adminname}" />
183
		<filter token="recipient" value="${recipient}" />
184
		<filter token="metacatVersion" value="${metacat.version}" />
185
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
186
		<filter token="build.context" value="${metacat.context}" />
187

    
188
		<filter token="docrooturl" value="./" />
189
		<filter token="mcuser" value="${mcuser}" />
190
		<filter token="mcpassword" value="${mcpassword}" />
191
		<filter token="mcanotheruser" value="${mcanotheruser}" />
192
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
193
		<filter token="eml-css" value="${eml-css}" />
194
		<filter token="style-skins-relpath"
195
			value="${style-skins-relpath}" />
196
		<filter token="style-common-relpath"
197
			value="${style-common-relpath}" />
198

    
199
		<filter token="eml-version" value="${eml-version}" />
200
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
201
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
202
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
203
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
204
		<filter token="debugprefix" value="${debugprefix}" />
205

    
206
		<filter token="defaultStage" value="${defaultStage}" />
207
		<filter token="defaultHeader" value="${defaultHeader}" />
208
		<filter token="defaultFooter" value="${defaultFooter}" />
209
		<filter token="defaultChangePass" value="${defaultChangePass}" />
210
		<filter token="defaultResetPass" value="${defaultResetPass}" />
211
		<filter token="changePassSuccess" value="${changePassSuccess}" />
212
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
213
		<filter token="registerFailed" value="${registerFailed}" />
214
		<filter token="registerLter" value="${registerLter}" />
215
		<filter token="registerMatch" value="${registerMatch}" />
216
		<filter token="registerSuccess" value="${registerSuccess}" />
217
		<filter token="register" value="${register}" />
218
		<filter token="searchResults" value="${searchResults}" />
219
		<filter token="ldapMainServerFailure"
220
			value="${ldapMainServerFailure}" />
221
		<filter token="lter-user" value="${lteruser}" />
222
		<filter token="lter-pass" value="${lterpassword}" />
223
		<filter token="pisco-user" value="${piscouser}" />
224
		<filter token="pisco-pass" value="${piscopassword}" />
225

    
226

    
227
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
228
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
229
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
230

    
231
		<property name="srcdir" value="./src" />
232
		<property name="lib.dir" value="./lib" />
233
		<property name="docdir" value="./docs" />
234
		<property name="cgidir" value="./cgi-bin" />
235
		<property name="testdir" value="./test" />
236
		<property name="testtorun" value="BuildIndexTest" />
237
		<property name="junittestsdir"
238
			value="./test/edu/ucsb/nceas/metacattest" />
239
		<property name="junitnettestsdir"
240
			value="./test/edu/ucsb/nceas/metacatnettest" />
241
		<property name="build.dir" value="./build" />
242
		<property name="build.src" value="${build.dir}/src" />
243
		<property name="build.dest" value="${build.dir}/classes" />
244
		<property name="build.samples" value="${build.dir}/samples" />
245
		<property name="build.tests" value="${build.dir}/tests" />
246
		<property name="build.tmp" value="${build.dir}/tmp" />
247
		<property name="build.metacattest"
248
			value="${build.tests}/metacattest" />
249
		<property name="build.metacatnettest"
250
			value="${build.tests}/metacatnettest" />
251
		<property name="build.data" value="${build.dir}/data" />
252
		<property name="build.javadocs" value="${build.dir}/docs/api" />
253
		<property name="build.war" value="${build.dir}/war" />
254
		<property name="dist.dir" value="dist" />
255
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
256
		<property name="ver.src" value="${ver.dir}/src" />
257
		<property name="util.dir" value="${dist.dir}/${util-module}" />
258
		<property name="test.dir" value="${dist.dir}/test" />
259
		<!-- directories for creating a Harvest List Editor distribution -->
260
		<property name="dist.dir.hle" value="disthle" />
261
		<property name="ver.dir.hle"
262
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
263
		<property name="pkg.dir" value="./package" />
264
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
265

    
266
		<property name="ecogrid-target-name" value="metacatImpl" />
267
		<property name="ecogrid-module-dest-dir" value=".." />
268
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
269
		<property name="ecogrid-dist-dir"
270
			value="${dist.dir}/${ecogrid-module}" />
271
		<property name="ecogrid-dir"
272
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
273

    
274
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
275

    
276
		<!-- set up svn -->
277
		<property name="svnant.lib" value="lib" />
278
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
279
		<property name="svnClientAdapter.jar"
280
			value="${svnant.lib}/svnClientAdapter.jar" />
281
		<property name="svnjavahl.jar"
282
			value="${svnant.lib}/svnjavahl.jar" />
283
		<property name="svn.utilitiesUrl"
284
			value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
285
		<property name="svn.ecogridUrl"
286
			value="https://code.ecoinformatics.org/code/seek/trunk/projects/ecogrid/" />
287
		<property name="svn.emlBetaUrl"
288
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
289
		<property name="svn.eml200SchemaUrl"
290
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
291
		<property name="svn.eml201SchemaUrl"
292
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
293
		<property name="svn.eml210SchemaUrl"
294
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
295
		<property name="svn.eml2StyleUrl"
296
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
297

    
298
		<!-- load the svn task -->
299
		<path id="svn.classpath">
300
			<pathelement location="${svnjavahl.jar}" />
301
			<pathelement location="${svnant.jar}" />
302
			<pathelement location="${svnClientAdapter.jar}" />
303
		</path>
304
		<taskdef resource="svntask.properties"
305
			classpathref="svn.classpath" />
306

    
307
		<condition property="utilities.required">
308
			<or>
309
				<not>
310
					<available file="lib/httpclient.jar" />
311
				</not>
312
				<not>
313
					<available file="lib/utilities.jar" />
314
				</not>
315
				<not>
316
					<available file="${utilitiesdir}" type="dir" />
317
				</not>
318
			</or>
319
		</condition>
320
		<!-- peer.utilities.required is used when there is no utilities 
321
			directory at ${utilitiesdir} -->
322
		<condition property="peer.utilities.required">
323
			<or>
324
				<not>
325
					<available file="${utilitiesdir}" type="dir" />
326
				</not>
327
			</or>
328
		</condition>
329
		<condition property="eml.required">
330
			<or>
331
				<not>
332
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
333
				</not>
334
				<not>
335
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
336
				</not>
337
				<not>
338
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
339
				</not>
340
				<not>
341
					<available
342
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
343
				</not>
344
			</or>
345
		</condition>
346

    
347
		<condition property="ecogrid.required">
348
			<or>
349
				<not>
350
					<available file="${ecogrid-dir}/build.properties" />
351
				</not>
352
				<not>
353
					<available
354
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
355
				</not>
356
			</or>
357
		</condition>
358

    
359
	</target>
360

    
361
	<target name="prepare" depends="init">
362
		<mkdir dir="${build.dir}" />
363
		<mkdir dir="${build.src}" />
364
		<mkdir dir="${build.dest}" />
365
		<mkdir dir="${build.javadocs}" />
366
		<mkdir dir="${build.tmp}" />
367

    
368
		<copy todir="${build.src}" filtering="yes">
369
			<fileset dir="${srcdir}">
370
				<include name="edu/**" />
371
				<include name="com/**" />
372
				<include name="org/**" />
373
				<!-- include name="java/**" / -->
374
				<include name="**/*.sql" />
375
				<exclude name="**/CVS*" />
376
				<exclude name="**/.#*" />
377
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
378
			</fileset>
379
		</copy>
380
		<available file="lib/style/common/emlb6toeml2" type="dir"
381
			property="styles.not.needed" />
382
	</target>
383

    
384
	<taskdef resource="axis-tasks.properties"
385
		classpathref="compile.classpath" />
386

    
387
	<target name="generateStubs" depends="prepare">
388
		<echo
389
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
390
		<axis-wsdl2java verbose="true" output="${srcdir}"
391
			url="/tmp/KeplerWebService.wsdl" />
392
	</target>
393

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

    
397
		<javac srcdir="${build.src}" destdir="${build.dest}"
398
			debug="${debug}"
399
			excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
400
			<classpath>
401
				<path refid="compile.classpath" />
402
			</classpath>
403
		</javac>
404
	</target>
405

    
406
	<target name="jar" depends="compile,geteml"
407
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
408

    
409
		<delete file="${build.dir}/${name}.jar" />
410
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
411
			excludes="**/protocols/ **/harvesterClient/" />
412
	</target>
413

    
414
	<target name="protocol" depends="compile"
415
		description="Compiles and jars protocol java code to protocol.jar in build dir">
416
		<delete file="${build.dir}/protocol.jar" />
417
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
418
			includes="**/protocols/" />
419
	</target>
420

    
421
	<target name="utilities" depends="config,getpeerutilities"
422
		if="utilities.required">
423
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
424
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
425
		<copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
426
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
427
	</target>
428

    
429
	<target name="getpeerutilities" depends="prepare"
430
		if="peer.utilities.required"
431
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
432
		<echo message="Exporting utilities files from svn repository:" />
433
		<svn>
434
			<export srcUrl="${svn.utilitiesUrl}"
435
				destPath="${utilitiesdir}" />
436
		</svn>
437

    
438
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
439
	</target>
440

    
441
	<target name="getutilities" depends="prepare"
442
		description="Checks utility out of svn and copies it to your metacat sandbox">
443
		<svn>
444
			<export srcUrl="${svn.utilitiesUrl}"
445
				destPath="${utilitiesdir}" />
446
		</svn>
447
	</target>
448

    
449
	<target name="client" depends="utilities, prepare"
450
		description="Compiles metacat-client java code to build dir">
451
		<javac srcdir="${build.src}" destdir="${build.dest}"
452
			includes="edu/ucsb/nceas/metacat/client/*">
453
			<classpath>
454
				<path refid="compile.classpath" />
455
			</classpath>
456
		</javac>
457
	</target>
458

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

    
466
	<target name="advancedsearchjar" depends="compile"
467
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
468
		<delete file="${build.dir}/advancedsearch.jar" />
469
		<jar jarfile="${build.dir}/advancedsearch.jar"
470
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
471
	</target>
472

    
473
	<target name="harvester" depends="client"
474
		description="Compiles harvester java code to build dir">
475
		<javac srcdir="${build.src}" destdir="${build.dest}"
476
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
477
			<classpath>
478
				<path refid="compile.classpath" />
479
			</classpath>
480
		</javac>
481
	</target>
482

    
483
	<target name="harvesterjar" depends="harvester"
484
		description="Compiles and jars harvester java code to harvester.jar in build dir">
485
		<delete file="${build.dir}/harvester.jar" />
486
		<jar jarfile="${build.dir}/harvester.jar"
487
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
488
	</target>
489

    
490
	<target name="harvestListEditorDist" depends="harvesterjar"
491
		description="Prepares a distribution of the Harvest List Editor tool">
492
		<mkdir dir="${dist.dir.hle}" />
493
		<delete dir="${ver.dir.hle}" />
494
		<mkdir dir="${ver.dir.hle}" />
495
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
496
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
497
		<copy todir="${ver.dir.hle}"
498
			file="lib/harvester/harvestList.xsd" />
499
		<copy todir="${ver.dir.hle}"
500
			file="lib/harvester/harvestListEditor.bat" />
501
		<copy todir="${ver.dir.hle}"
502
			file="lib/harvester/harvestListEditor.sh" />
503
		<delete file="./harvest-list-editor-${release}.zip" />
504
		<zip zipfile="./harvest-list-editor-${release}.zip"
505
			basedir="${ver.dir.hle}" />
506
		<delete file="./harvest-list-editor-${release}.tar.gz" />
507
		<tar tarfile="./harvest-list-editor-${release}.tar"
508
			basedir="${ver.dir.hle}" />
509
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
510
			src="./harvest-list-editor-${release}.tar" />
511
		<delete file="./harvest-list-editor-${release}.tar" />
512
	</target>
513

    
514
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
515
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
516

    
517
	<target name="getemlpre2" depends="prepare" if="eml.required"
518
		description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
519
		<svn>
520
			<export srcUrl="${svn.emlBetaUrl}"
521
				destPath="${build.tmp}/eml_${eml-beta-tag}" />
522
		</svn>
523
		<mkdir dir="lib/dtd" />
524
		<copy todir="lib/dtd" filtering="yes">
525
			<fileset
526
				dir="${build.tmp}/eml_${eml-beta-tag}">
527
				<include name="*.dtd" />
528
			</fileset>
529
			<mapper type="glob" from="eml-*.dtd"
530
				to="eml-*-${eml-version}.dtd" />
531
		</copy>
532

    
533
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
534
			<fileset
535
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
536
				<include name="**/*.xsl" />
537
			</fileset>
538
		</copy>
539
	</target>
540

    
541
	<target name="geteml2+" depends="prepare" if="eml.required"
542
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
543
		<svn>
544
			<export srcUrl="${svn.eml200SchemaUrl}"
545
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
546
		</svn>
547
		<mkdir dir="lib/schema/eml-2.0.0" />
548
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
549
			<fileset
550
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
551
				<include name="*.xsd" />
552
			</fileset>
553

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

    
560
		</copy>
561
		<!-- <antcall target="copyxsl">
562
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
563
			<param name="dirname" value="eml-2.0.0" />
564
			</antcall> -->
565

    
566
		<!-- Checkout eml201 for given schema tag-->
567
		<svn>
568
			<export srcUrl="${svn.eml201SchemaUrl}"
569
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
570
		</svn>
571
		<mkdir dir="lib/schema/eml-2.0.1" />
572
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
573
			<fileset
574
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
575
				<include name="*.xsd" />
576
			</fileset>
577
		</copy>
578

    
579
		<!-- Checkout eml201 again for given style sheet tag-->
580
		<!-- echo>Enter CVS password: </echo>
581
			<cvs cvsRoot="${cvsroot}"
582
			package="${eml-module}"
583
			tag="${eml2_0_1-style-tag}"
584
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
585
			<antcall target="copyxsl">
586
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
587
			<param name="dirname" value="eml-2.0.1" />
588
			</antcall -->
589

    
590
		<!-- Checkout eml210 for given schema tag-->
591
		<svn>
592
			<export srcUrl="${svn.eml210SchemaUrl}"
593
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
594
		</svn>
595
		<mkdir dir="lib/schema/eml-2.1.0" />
596
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
597
			<fileset
598
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
599
				<include name="*.xsd" />
600
			</fileset>
601
		</copy>
602

    
603
		<!-- Checkout eml210 for given style sheet tag-->
604
		<svn>
605
			<export srcUrl="${svn.eml2StyleUrl}"
606
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
607
		</svn>
608
		<antcall target="copyxsl">
609
			<param name="cvs.tagname" value="${eml2-style-tag}" />
610
			<!-- param name="dirname" value="eml-2.1.0" / -->
611
			<param name="dirname" value="eml-2" />
612
		</antcall>
613
	</target>
614

    
615
	<target name="copyxsl"
616
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
617

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

    
620
		<copy todir="${style-common-cvsrelpath}/${dirname}"
621
			filtering="yes">
622
			<fileset
623
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
624
				<include name="**/*.xsl" />
625
			</fileset>
626
		</copy>
627

    
628

    
629
		<!-- now copy default css from eml module and put it in style-common-path
630
			dir with a new name, so other skin-specific css can import it if reqd -->
631
		<copy
632
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
633
			tofile="${style-common-cvsrelpath}/${eml-css}" />
634

    
635
	</target>
636

    
637
	<target name="correctEML201Docs" depends="jar"
638
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
639
		<copy todir="${build.dir}" file="lib/metacat.properties"
640
			filtering="yes" />
641
		<java
642
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
643
			<classpath>
644
				<path refid="compile.classpath" />
645
				<fileset dir="${build.dir}">
646
					<include name="${name}.jar" />
647
				</fileset>
648
			</classpath>
649
		</java>
650
	</target>
651

    
652
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
653
		description="Installs spatial option for metacat">
654

    
655
		<property name="spatial.dir" value="./lib/spatial" />
656
		<property name="spatial.geoserver.dir"
657
			value="${spatial.dir}/geoserver" />
658
		<property name="spatial.webinf-mods"
659
			value="${spatial.dir}/WEB-INF" />
660

    
661
		<!-- Copy geoserver libs into ${war.lib} -->
662
		<copy todir="${war.lib}" filtering="no">
663
			<fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
664
				<include name="**" />
665
			</fileset>
666
		</copy>
667

    
668
		<!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
669
		<copy todir="${war.webinf}" filtering="no">
670
			<fileset dir="${spatial.geoserver.dir}/WEB-INF">
671
				<exclude name="lib/**" />
672
				<exclude name="web.xml" />
673
			</fileset>
674
		</copy>
675

    
676
		<!-- Copy the rest of the geoserver codebase into ${war.context} -->
677
		<copy todir="${war.context}" filtering="no">
678
			<fileset dir="${spatial.geoserver.dir}">
679
				<exclude name="WEB-INF/**" />
680
				<exclude name="index.jsp" />
681
			</fileset>
682
		</copy>
683

    
684
		<!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
685
		<copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
686
			tofile="${war.context}/geoserver.jsp" overwrite="true"
687
			filtering="no" />
688

    
689
		<!-- Copy the rest of the modified geoserver web-inf files
690
			<copy todir="${war.webinf}" filtering="no">
691
			<fileset dir="${spatial.webinf-mods}">
692
			<exclude name="web.xml.combined"/>
693
			</fileset>
694
			</copy> -->
695

    
696
	</target>
697

    
698
	<target name="install" depends="build-metacat"
699
		description="* Full Install For Development *">
700
		<copy file="${dist.dir}/${metacat.context}.war"
701
			todir="${app.deploy.dir}" />
702
		<delete dir="${app.deploy.dir}/${metacat.context}" />
703
		<tstamp>
704
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
705
		</tstamp>
706
		<echo>Dev install completed at ${NOW}</echo>
707
	</target>
708

    
709
	<target name="build-metacat" depends="install-ecogrid"
710
		description="Build Metacat">
711
	</target>
712

    
713
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
714
		if="enable.ecogrid" description="Install Ecogrid Compentent">
715
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
716
			inheritall="false">
717
			<property name="context" value="${metacat.context}" />
718
			<property name="target" value="${ecogrid-target-name}" />
719
			<!-- property name="metacat.dir" value="."/ -->
720
		</ant>
721
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
722
			inheritall="false">
723
			<property name="context" value="${metacat.context}" />
724
			<property name="target" value="${ecogrid-target-name}" />
725
			<!-- property name="metacat.dir" value="."/ -->
726
		</ant>
727
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
728
			<webinf dir="${ecogrid-dir}/lib">
729
			<include name="server-config.wsdd"/>
730
			</webinf>
731
			</war -->
732
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
733
			todir="${dist.dir}" overwrite="true" />
734

    
735

    
736
	</target>
737

    
738
	<target name="get-ecogrid" depends="init"
739
		description="Check out ecogrid module" if="ecogrid.required">
740
		<svn>
741
			<export srcUrl="${svn.ecogridUrl}"
742
				destPath="${ecogrid-dir}" />
743
		</svn>
744
	</target>
745

    
746
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
747
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
748
		<property name="context" value="${metacat.context}"/>
749
		<property name="target" value="${ecogrid-target-name}"/>
750
		<property name="metacat.dir" value="."/>
751
		<property name="hostname" value="${ecogrid.hostname}"/>
752
		<property name="port" value="${config.port}"/>
753
		</ant>
754
		</target -->
755

    
756
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
757
		description="Automately generate wsdd for ecogrid service">
758
		<delete
759
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
760
	</target>
761

    
762
	<target name="install-skin" depends="init"
763
		description="Install a Skin">
764

    
765
		<input message="Please enter name of the skin"
766
			addproperty="skin-name" />
767

    
768
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
769
		<copy todir="${installdir}/style/skins/${skin-name}"
770
			filtering="yes">
771
			<fileset dir="lib/style/skins/${skin-name}">
772
				<exclude name="**/*.png" />
773
				<exclude name="**/*.gif" />
774
				<exclude name="**/*.jpg" />
775
				<exclude name="**/CVS*" />
776
				<exclude name="**/.#*" />
777
			</fileset>
778
		</copy>
779
		<copy todir="${installdir}/style/skins/${skin-name}"
780
			filtering="no">
781
			<fileset dir="lib/style/skins/${skin-name}">
782
				<include name="**/*.png" />
783
				<include name="**/*.gif" />
784
				<include name="**/*.jpg" />
785
				<exclude name="**/CVS*" />
786
				<exclude name="**/.#*" />
787
			</fileset>
788
		</copy>
789
		<copy todir="${installdir}/style/common" filtering="yes">
790
			<fileset dir="lib/style/common">
791
				<include name="*.js" />
792
				<include name="*.jsp" />
793
				<include name="*.css" />
794
				<exclude name="*.png" />
795
				<exclude name="*.gif" />
796
				<exclude name="*.jpg" />
797
				<exclude name="**/CVS*" />
798
				<exclude name="**/.#*" />
799
			</fileset>
800
		</copy>
801
		<!--
802
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
803
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
804
			<fileset dir="lib/style/skins/${skin-name}/images">
805
			<include name="*.png"/>
806
			<include name="*.gif"/>
807
			<include name="*.jpg"/>
808
			</fileset>
809
			</copy>
810
		-->
811

    
812
		<echo message="Install Skin completed." />
813
	</target>
814

    
815
	<target name="war" depends="warPrepare,install-spatial"
816
		description="Create a web archive (WAR) for servlet deployment">
817
		<mkdir dir="${dist.dir}" />
818
		<war destfile="${dist.dir}/${metacat.context}.war"
819
			webxml="${build.war}/web.xml">
820
			<fileset dir="${war.context}" />
821
			<lib dir="${war.lib}" />
822
			<webinf dir="${war.webinf}" />
823
		</war>
824
	</target>
825

    
826
	<target name="warPrepare"
827
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
828
		description="Prepare files for creating a web archive (WAR)">
829

    
830
		<property name="war.lib" value="${build.war}/lib" />
831
		<property name="war.webinf" value="${build.war}/WEB-INF" />
832
		<property name="war.context"
833
			value="${build.war}/${metacat.context}" />
834
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
835
		<property name="war.webinf.scripts"
836
			value="${war.webinf}/scripts" />
837
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
838
		<property name="war.context.docs" value="${war.context}/docs" />
839
		<property name="war.context.temp" value="${war.context}/temp" />
840
		<property name="war.context.templates"
841
			value="${war.context}${style-common-relpath}/templates" />
842
		<mkdir dir="${war.lib}" />
843
		<mkdir dir="${war.webinf}" />
844
		<mkdir dir="${war.context}" />
845
		<mkdir dir="${war.webinf.sql}" />
846
		<mkdir dir="${war.context.cgi}" />
847
		<mkdir dir="${war.context.docs}" />
848
		<mkdir dir="${war.context.temp}" />
849
		<mkdir dir="${war.context.templates}" />
850

    
851
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
852
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
853
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
854
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
855
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
856
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
857
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
858
		<copy todir="${war.lib}" filtering="no">
859
			<fileset dir="lib">
860
				<!--
861
					<not>
862
					<filename name="${jdbc-jar-name}"/>
863
					</not>
864
				-->
865
				<include name="*.jar" />
866
				<exclude name="maven-ant-tasks*.jar" />
867
			</fileset>
868
			<fileset dir="lib">
869
				<include name="xalan.jar" />
870
				<include name="gwt*.jar" />
871
			</fileset>
872
			<fileset dir="lib/oaipmh">
873
				<include name="oaicat.jar" />
874
			</fileset>
875
		</copy>
876
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
877
			tofile="${build.war}/web.xml" / -->
878
		<!-- MCD added next - Remove the tomcat5 reference-->
879
		<copy file="lib/web.xml.tomcat5" tofile="${build.war}/web.xml" />
880
		<copy file="lib/metacat.properties" todir="${war.webinf}"
881
			filtering="yes" />
882
		<copy file="lib/metacat.properties.metadata.xml"
883
			todir="${war.webinf}" filtering="no" />
884
		<copy file="lib/org.properties.metadata.xml"
885
			todir="${war.webinf}" filtering="no" />
886
		<copy file="lib/auth.properties.metadata.xml"
887
			todir="${war.webinf}" filtering="no" />
888
		<copy todir="${war.webinf}" filtering="yes">
889
			<fileset dir="lib">
890
				<include name="skin.configs/**" />
891
			</fileset>
892
		</copy>
893
		<copy file="lib/log4j.properties" todir="${war.webinf}"
894
			filtering="yes" />
895
		<copy todir="${war.context}" filtering="no">
896
			<fileset dir="lib">
897
				<include name="**/*.jpg" />
898
				<include name="**/*.png" />
899
				<include name="**/*.gif" />
900
				<include name="LiveMap_30/**" />
901
				<include name="oaipmh/**" />
902
			</fileset>
903
		</copy>
904
		<copy todir="${war.context}" filtering="yes">
905
			<fileset dir="lib">
906
				<exclude name="*.jar" />
907
				<exclude name="*.properties" />
908
				<exclude name="*.metadata.xml" />
909
				<exclude name="web.xml" />
910
				<exclude name="**/*.jpg" />
911
				<exclude name="**/*.png" />
912
				<exclude name="**/*.gif" />
913
				<exclude name="lsid_lib/**" />
914
				<exclude name="lsid_conf/**" />
915
				<exclude name="LiveMap_30/**" />
916
				<exclude name="oaipmh/**" />
917
				<exclude name="skin.configs/**" />
918
				<exclude name="spatial/geoserver/**" />
919
				<exclude name="spatial/WEB-INF/**" />
920
			</fileset>
921
		</copy>
922
		<copy todir="${war.context.docs}" filtering="yes">
923
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
924
		</copy>
925
		<copy todir="${war.context.docs}" filtering="no">
926
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
927
		</copy>
928
		<copy todir="${war.webinf.sql}" filtering="yes">
929
			<fileset dir="src">
930
				<include name="**/*.sql" />
931
			</fileset>
932
		</copy>
933
		<copy todir="${war.webinf.scripts}" filtering="yes">
934
			<fileset dir="src/scripts" />
935
		</copy>
936
		<copy todir="${war.webinf.scripts}"
937
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
938
			failonerror="false" />
939

    
940
		<copy file="src/perl/register-dataset.cgi"
941
			todir="${war.context.cgi}" />
942
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
943
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
944

    
945
		<!-- registry cgi section -->
946
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
947
			used in readDocumentFromMetacat -->
948
		<!-- TODO MCD copy temp files to actual location using config util?? -->
949
		<copy todir="${war.context.temp}" filtering="yes">
950
			<fileset dir="lib/style/common/emlb6toeml2">
951
				<include name="*.xsl" />
952
				<include name="*.xml" />
953
			</fileset>
954
		</copy>
955
		<available file="lib/style/common/emlb6toeml2" type="dir"
956
			property="styles.not.needed" />
957

    
958
		<!-- ldap cgi section -->
959
		<copy todir="${war.context.templates}">
960
			<fileset dir="lib/style/common/templates">
961
				<!-- SCW: Copy all files -->
962
			</fileset>
963
		</copy>
964
	</target>
965

    
966
	<target name="cgiPrepare" if="build.perl">
967
		<exec dir="src/perl/Metacat/" executable="make">
968
			<arg value="clean" />
969
		</exec>
970
		<exec dir="src/perl/Metacat/" executable="perl">
971
			<arg value="Makefile.PL" />
972
		</exec>
973
		<exec dir="src/perl/Metacat/" executable="make" />
974
	</target>
975

    
976
	<target name="testPrepare"
977
		description="Copies test files into the war directories">
978
		<echo>in testPrepare</echo>
979
		<property name="war.context.test"
980
			value="${build.war}/${metacat.context}/test" />
981
		<mkdir dir="${war.context.test}" />
982
		<copy todir="${war.context.test}" filtering="yes">
983
			<fileset dir="test/servertestfiles">
984
				<include name="*/**" />
985
			</fileset>
986
		</copy>
987
	</target>
988

    
989
	<target name="getConversionXSL" depends="prepare"
990
		unless="styles.not.needed"
991
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
992

    
993
		<svn>
994
			<export srcUrl="${svn.eml2StyleUrl}"
995
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
996
		</svn>
997

    
998
		<mkdir dir="lib/style/common/emlb6toeml2" />
999
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1000
			<fileset
1001
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1002
				<include name="*.xsl" />
1003
				<include name="*.xml" />
1004
			</fileset>
1005
		</copy>
1006
	</target>
1007

    
1008
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1009
		<mkdir dir="${build.tests}" />
1010
		<copy todir="${build.tests}" filtering="yes">
1011
			<fileset dir="${testdir}">
1012
				<include name="edu/**" />
1013
			</fileset>
1014
		</copy>
1015
		<copy todir="${build.tests}" file="${testdir}/test.properties"
1016
			filtering="yes" />
1017

    
1018
		<!-- copy and compile the tests into a jar file -->
1019
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1020
			debug="on" includes="**/*.java">
1021
			<classpath>
1022
				<path refid="compile.classpath" />
1023
				<fileset dir="${build.dir}">
1024
					<include name="${name}.jar" />
1025
					<include name="${name}-client.jar" />
1026
					<include name="harvester.jar" />
1027
				</fileset>
1028
			</classpath>
1029
		</javac>
1030

    
1031
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1032
			basedir="${build.tests}" includes="**/*.class" />
1033
	</target>
1034

    
1035
	<target name="test" depends="testprep"
1036
		description="Uses the ant junit task to run all JUnit tests">
1037

    
1038
		<!-- use the ant "junit" task to run JUnit tests. -->
1039
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1040
			haltonerror="no">
1041
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1042
			<classpath>
1043
				<path refid="compile.classpath" />
1044
				<fileset dir="${build.dir}">
1045
					<include name="${name}.jar" />
1046
					<include name="${name}-client.jar" />
1047
					<include name="harvester.jar" />
1048
					<include name="${name}-junittests.jar" />
1049
				</fileset>
1050
			</classpath>
1051

    
1052
			<formatter type="plain" />
1053

    
1054
			<batchtest fork="yes" todir="${build.dir}">
1055
				<fileset dir="${build.tests}">
1056
					<include name="**/*.class" />
1057
					<exclude name="**/MCTestCase.class" />
1058
					<exclude name="**/ClientViewHelperTest.class" />
1059
				</fileset>
1060
			</batchtest>
1061
		</junit>
1062
	</target>
1063

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

    
1067
		<echo>testtorun: ${testtorun}</echo>
1068

    
1069
		<!-- use the ant "junit" task to run JUnit tests. -->
1070
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1071
			haltonerror="no" showoutput="yes">
1072
			<!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1073
			<classpath>
1074
				<path refid="compile.classpath" />
1075
				<fileset dir="${build.dir}">
1076
					<include name="${name}.jar" />
1077
					<include name="${name}-client.jar" />
1078
					<include name="harvester.jar" />
1079
					<include name="${name}-junittests.jar" />
1080
				</fileset>
1081
			</classpath>
1082

    
1083
			<formatter type="plain" />
1084

    
1085
			<batchtest fork="yes" todir="${build.dir}">
1086
				<fileset dir="${build.tests}">
1087
					<include name="**/${testtorun}.class" />
1088
				</fileset>
1089
			</batchtest>
1090
		</junit>
1091
	</target>
1092

    
1093
	<target name="testharvester" depends="testprep"
1094
		description="Uses the ant junit task to test only the Harvester code">
1095
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1096
			haltonerror="off">
1097
			<classpath>
1098
				<path refid="compile.classpath" />
1099
				<fileset dir="${build.dir}">
1100
					<include name="${name}.jar" />
1101
					<include name="${name}-client.jar" />
1102
					<include name="harvester.jar" />
1103
					<include name="${name}-junittests.jar" />
1104
				</fileset>
1105
			</classpath>
1106
			<formatter type="plain" />
1107
			<batchtest fork="yes" todir="${build.dir}">
1108
				<fileset dir="${build.tests}">
1109
					<include name="**/harvesterClient/*.class" />
1110
				</fileset>
1111
			</batchtest>
1112
		</junit>
1113
	</target>
1114

    
1115
	<target name="gethttpclient" depends="prepare"
1116
		description="checks out and compiles morpho httpclient code">
1117
		<!--mkdir dir="${morphosourcedir}" -->
1118
		<cvs cvsRoot="${cvsroot}" package="morpho" dest="." />
1119
		<ant dir="${morphosourcedir}" inheritAll="false" target="jar" />
1120
	</target>
1121

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

    
1126
		<echo>
1127
			*********************************** Please run ant
1128
			gethttpclient first! ***********************************
1129
		</echo>
1130
		<!-- copy and compile the tests into a jar file -->
1131
		<mkdir dir="${build.metacatnettest}" />
1132
		<javac srcdir="${junitnettestsdir}"
1133
			destdir="${build.metacatnettest}" includes="**/*.java">
1134
			<classpath>
1135
				<path refid="compile.classpath" />
1136
				<fileset dir="${build.dir}">
1137
					<include name="${name}.jar" />
1138
				</fileset>
1139
			</classpath>
1140
		</javac>
1141

    
1142
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1143
			basedir="${build.metacatnettest}" includes="**/*.class" />
1144

    
1145
		<!-- use the ant "junit" task to run JUnit tests. -->
1146
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1147
			haltonerror="no">
1148
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1149
			<classpath>
1150
				<path refid="compile.classpath" />
1151
				<fileset dir="${build.dir}">
1152
					<include name="${name}.jar" />
1153
					<include name="${name}-junitnettests.jar" />
1154
				</fileset>
1155
			</classpath>
1156

    
1157
			<formatter type="plain" />
1158

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

    
1167
	<target name="cleanweb" depends="clean"
1168
		description="deletes tomcat web context dir and all its contents">
1169
		<delete dir="${installdir}" />
1170
	</target>
1171

    
1172

    
1173
	<target name="clean" depends="init"
1174
		description="deletes build dir and files that can be regenerated form the release">
1175
		<delete dir="${build.dir}" />
1176
		<delete dir="${dist.dir}" />
1177
	</target>
1178

    
1179
	<target name="localclean" depends="clean"
1180
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1181
		<delete file="lib/httpclient.jar" />
1182
		<delete file="lib/utilities.jar" />
1183
	</target>
1184

    
1185
	<target name="fullclean" depends="localclean"
1186
		description="deletes code and eml">
1187
		<delete includeEmptyDirs="true" failonerror="false">
1188
			<fileset dir="${style-common-cvsrelpath}">
1189
				<include name="${eml-css}" />
1190
				<include name="eml-*/*.xsl" />
1191
				<include name="eml-*" />
1192
			</fileset>
1193
			<fileset dir="${schema-cvsrelpath}">
1194
				<include name="eml-*/*.xsd" />
1195
			</fileset>
1196
			<fileset dir="${ecogrid-dir}">
1197
				<include name="build.properties" />
1198
				<include name="buildfiles/metacatImpl.xml" />
1199
			</fileset>
1200
		</delete>
1201
	</target>
1202

    
1203
	<target name="jdoc" depends="prepare"
1204
		description="generates javadoc documentation">
1205
		<javadoc packagenames="edu.ucsb.nceas.*"
1206
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1207
			version="true" use="true" windowtitle="${Name} API"
1208
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1209
			bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1210
			<classpath>
1211
				<path refid="compile.classpath" />
1212
			</classpath>
1213
		</javadoc>
1214
	</target>
1215

    
1216
	<target name="dist"
1217
		depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1218
		description="prepares a full release distribution">
1219
		<mkdir dir="${dist.dir}" />
1220
		<delete dir="${ver.dir}" />
1221
		<mkdir dir="${ver.dir}" />
1222
		<copy todir="${ver.dir}">
1223
			<fileset dir="."
1224
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1225
		</copy>
1226
		<copy todir="${ver.dir}" file="build.xml" />
1227
		<copy todir="${ver.dir}" file="build.properties" />
1228

    
1229
		<copy todir="${ver.dir}/docs" filtering="yes">
1230
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1231
		</copy>
1232
		<copy todir="${ver.dir}/docs" filtering="no">
1233
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1234
		</copy>
1235
		<copy todir="${ver.dir}/docs/dev">
1236
			<fileset dir="${build.dir}/docs" />
1237
		</copy>
1238
		<copy todir="${ver.dir}/src">
1239
			<fileset dir="${build.dir}/src" />
1240
		</copy>
1241

    
1242
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1243
		<copy todir="${ver.dir}/test/servertestfiles">
1244
			<fileset dir="./test/servertestfiles" />
1245
		</copy>
1246
	</target>
1247

    
1248
	<target name="distbin" depends="build-metacat,war-lsid"
1249
		description="prepares a binary distribution">
1250
		<copy todir="${dist.dir}">
1251
			<fileset dir="./src/scripts" />
1252
		</copy>
1253
		<delete file="./${name}-bin-${release}.zip" />
1254
		<zip zipfile="./${name}-bin-${release}.zip"
1255
			basedir="${dist.dir}" excludes="metacat-*/**" />
1256
		<delete file="./${name}-bin-${release}.tar.gz" />
1257
		<tar tarfile="./${name}-bin-${release}.tar"
1258
			basedir="${dist.dir}" excludes="metacat-*/**" />
1259
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1260
			src="./${name}-bin-${release}.tar" />
1261
		<delete file="./${name}-bin-${release}.tar" />
1262
	</target>
1263

    
1264
	<target name="distsrc" depends="dist"
1265
		description="prepares a source distribution">
1266
		<mkdir dir="${ver.src}" />
1267
		<copy todir="${ver.src}">
1268
			<fileset dir="./src" />
1269
		</copy>
1270
		<mkdir dir="${util.dir}" />
1271
		<copy todir="${util.dir}">
1272
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1273
		</copy>
1274

    
1275
		<mkdir dir="${ecogrid-dist-dir}" />
1276
		<copy todir="${ecogrid-dist-dir}">
1277
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1278
		</copy>
1279

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

    
1282
		<delete file="./${name}-src-${release}.zip" />
1283
		<zip zipfile="./${name}-src-${release}.zip"
1284
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1285
		<delete file="./${name}-src-${release}.tar.gz" />
1286
		<tar tarfile="./${name}-src-${release}.tar"
1287
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1288
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1289
			src="./${name}-src-${release}.tar" />
1290
		<delete file="./${name}-src-${release}.tar" />
1291
		<!--delete dir="${dist.dir}"/ -->
1292
	</target>
1293

    
1294
	<target name="deb-package" depends="distbin"
1295
		description="create a debian installation package">
1296
		<delete dir="${deb.pkg.dir}" />
1297
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1298
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1299
			<fileset dir="./src/scripts/debian"
1300
				includes="control postinst" />
1301
		</copy>
1302

    
1303
		<mkdir
1304
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1305
		<copy
1306
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1307
			filtering="yes">
1308
			<fileset dir="./src/scripts/debian"
1309
				excludes="control postinst" />
1310
		</copy>
1311
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1312

    
1313
		<copy file="${dist.dir}/knb.war"
1314
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1315
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1316
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1317

    
1318
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1319
			failonerror="true">
1320
			<arg line="--build debian" />
1321
		</exec>
1322

    
1323
		<move file="${pkg.dir}/debian.deb"
1324
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1325
	</target>
1326

    
1327
	<target name="stylesheettest">
1328
		<xslt in="${input}" out="eml.html"
1329
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1330
			<param name="displaymodule" expression="${displaymodule}" />
1331
			<param name="docid" expression="${input}" />
1332
			<param name="entitytype" expression="${entitytype}" />
1333
			<param name="entityindex" expression="${entityindex}" />
1334
			<outputproperty name="method" value="html" />
1335
			<outputproperty name="standalone" value="yes" />
1336
			<outputproperty name="encoding" value="iso8859_1" />
1337
			<outputproperty name="indent" value="yes" />
1338
		</xslt>
1339
	</target>
1340

    
1341

    
1342
	<target name="compilewebclient" depends="prepare">
1343
		<javac srcdir="${build.src}" destdir="${build.dest}"
1344
			includes="**/application/*.java" classpathref="webservicepath" />
1345
	</target>
1346

    
1347
	<target name="runwebclient" depends="compilewebclient">
1348
		<java
1349
			classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1350
			dir="${build.dest}" fork="yes" classpathref="webservicepath"
1351
			classpath="./lib/utilities.jar" failonerror="true">
1352
			<arg value="${serviceUrl}" />
1353
			<arg value="${docid}" />
1354
		</java>
1355
	</target>
1356

    
1357
	<target name="spatial_option" depends="prepare"
1358
		description=" -- compiles code for the spatial option">
1359

    
1360
		<echo message="Compiling the metatcat shapefile creator" />
1361
		<echo message="using the shapelib at: ${shapelib.dir}" />
1362
		<exec dir="." executable="g++" os="Linux, Unix"
1363
			failonerror="true">
1364
			<arg
1365
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1366
		</exec>
1367

    
1368
		<exec dir="." executable="g++" os="Linux, Unix"
1369
			failonerror="true">
1370
			<arg
1371
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1372
		</exec>
1373
	</target>
1374

    
1375
	<!-- LSID Authority support -->
1376
	<patternset id="lsid.jars">
1377
		<include name="axis.jar" />
1378
		<include name="commons-discovery-0.2.jar" />
1379
		<include name="jaxrpc.jar" />
1380
		<include name="lsid-client-1.1.1.jar" />
1381
		<include name="lsid-server-1.1.1.jar" />
1382
		<include name="saaj.jar" />
1383
		<include name="wsdl4j-1.5.1.jar" />
1384
		<include name="activation.jar" />
1385
		<include name="castor-0.9.5.jar" />
1386
		<include name="dnsjava-1.3.2.jar" />
1387
		<include name="mail.jar" />
1388
		<include name="commons-logging-1.0.4.jar" />
1389
		<!-- These jars may be needed but seem to not actually be,
1390
			so leaving them out for now
1391
			<include name="axis-ant.jar" />
1392
		-->
1393
		<!--<include name="GenCastor.class" />-->
1394
	</patternset>
1395
	<patternset id="lib.jars">
1396
		<include name="httpclient.jar" />
1397
		<include name="log4j-1.2.12.jar" />
1398
		<include name="utilities.jar" />
1399
		<include name="xercesImpl.jar" />
1400
		<include name="xalan.jar" />
1401
		<include name="xml-apis.jar" />
1402
	</patternset>
1403

    
1404
	<path id="lsid.classpath">
1405
		<fileset dir="${lsid.lib.dir}">
1406
			<patternset refid="lsid.jars" />
1407
		</fileset>
1408
		<fileset dir="${lib.dir}">
1409
			<patternset refid="lsid.jars" />
1410
		</fileset>
1411
		<fileset dir="${lib.dir}">
1412
			<include name="xalan.jar" />
1413
			<include name="xml-apis.jar" />
1414
		</fileset>
1415
		<fileset dir="${build.dir}">
1416
			<include name="metacat-client.jar" />
1417
		</fileset>
1418
	</path>
1419

    
1420
	<filterset id="configFilters">
1421
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1422
			value="${config.hostname}" / -->
1423
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1424
			value="${config.port}" / -->
1425
		<!-- MCD BYE filter token="METADATA_LABELS"
1426
			value="${config.metadataLabelLsid}" / -->
1427
		<!-- MCD BYE filter token="METACAT_SERVER"
1428
			value="${config.metacatserver}" / -->
1429
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1430
			value="${config.lsidauthority}" / -->
1431
	</filterset>
1432

    
1433
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1434
		description="Configure files prior to compilation">
1435
		<mkdir dir="${lsid.build.dir}" />
1436
		<!-- Copy the properties file into the build -->
1437
		<copy file="${conf.dir}/metacat-lsid.properties"
1438
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1439
			overwrite="true">
1440
			<filterset refid="configFilters" />
1441
		</copy>
1442
		<copy file="${conf.dir}/log4j.properties"
1443
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1444
			overwrite="true">
1445
			<filterset refid="configFilters" />
1446
		</copy>
1447
		<!-- Copy config files into the build -->
1448
		<copy todir="${lsid.build.dir}/WEB-INF">
1449
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1450
		</copy>
1451
		<!-- Copy the metadata configuration files into the build -->
1452
		<mkdir
1453
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1454
		<copy
1455
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1456
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1457
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1458
			<filterset refid="configFilters" />
1459
		</copy>
1460
		<!-- Copy services files into the build -->
1461
		<mkdir dir="${lsid.build.dir}/services" />
1462
		<copy todir="${lsid.build.dir}/services">
1463
			<fileset dir="${services.dir}" />
1464
			<filterset refid="configFilters" />
1465
		</copy>
1466
		<!-- Copy axis files into the build -->
1467
		<mkdir dir="${lsid.build.dir}" />
1468
		<copy todir="${lsid.build.dir}">
1469
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1470
		</copy>
1471
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1472
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1473
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1474
		</copy>
1475
	</target>
1476

    
1477
	<target name="compile-lsid" depends="prepare-lsid"
1478
		description="Compile Java sources">
1479
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1480
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1481
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1482
			deprecation="${compile.deprecation}"
1483
			optimize="${compile.optimize}">
1484
			<classpath refid="lsid.classpath" />
1485
		</javac>
1486
	</target>
1487

    
1488
	<target name="war-lsid" depends="compile-lsid"
1489
		description="Create a war file for the application">
1490
		<mkdir dir="${dist.dir}" />
1491
		<war destfile="${dist.dir}/${authority.context}.war"
1492
			webxml="${webinf.dir}/web.xml">
1493
			<fileset dir="${lsid.build.dir}" />
1494
			<lib dir="${lsid.lib.dir}">
1495
				<patternset refid="lsid.jars" />
1496
			</lib>
1497
			<lib dir="${lib.dir}">
1498
				<patternset refid="lib.jars" />
1499
			</lib>
1500
			<lib dir="${lib.dir}">
1501
				<include name="xalan.jar" />
1502
				<include name="xml-apis.jar" />
1503
			</lib>
1504
			<lib dir="${build.dir}">
1505
				<include name="metacat-client.jar" />
1506
			</lib>
1507
		</war>
1508
	</target>
1509

    
1510
	<target name="deploy-lsid" depends="war-lsid"
1511
		description="Deploy LSID war to servlet container">
1512
		<delete dir="${app.deploy.dir}/${authority.context}" />
1513
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1514
		<mkdir dir="${app.deploy.dir}" />
1515
		<copy todir="${app.deploy.dir}">
1516
			<fileset dir="${dist.dir}" />
1517
		</copy>
1518
	</target>
1519

    
1520
    <!-- Build the dataone service, but only if it is checked out as a
1521
         sibling of the current build directory. Requires maven2 to
1522
         be installed and on the path. -->
1523
    <target name="dataone-service" if="d1.available">
1524
        <property name="d1.jar" value="dataone-service-api-0.1.0.jar"/>
1525

    
1526
        <artifact:mvn pom="${d1.dir}/pom.xml" fork="true"
1527
                      mavenHome="${maven.home}">
1528
            <arg value="install"/>
1529
        </artifact:mvn>
1530
		<copy file="${d1.dir}/target/${d1.jar}" todir="${lib.dir}" />
1531
    </target>
1532
</project>
(5-5/6)