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: 2012-01-18 11:05:58 -0800 (Wed, 18 Jan 2012) $'
11
	*    '$Revision: 6922 $'
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|documentation]
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
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
65
			property="tomcat.common.exists" />
66

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

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

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

    
115
			<!-- Include geoserver, geotools, et. al. -->
116
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
117
				<include name="*.jar" />
118
			</fileset>
119

    
120
			<!-- Include OAI-PMH -->
121
			<fileset dir="lib/oaipmh">
122
				<include name="*.jar" />
123
			</fileset>
124

    
125
		</path>
126
		
127
		<path id="test.classpath">
128
			<pathelement location="${jsdk}" />
129
			<pathelement location="lib" />
130
			<fileset dir="lib">
131
				<include name="*.jar" />
132
				<exclude name="maven-ant-tasks-2.1.0.jar" />
133
			</fileset>
134
			<fileset dir="lib">
135
				<include name="xalan.jar" />
136
			</fileset>
137
			<fileset dir="lib/lsid_lib">
138
				<include name="*.jar" />
139
			</fileset>
140

    
141
			<!-- Include geoserver, geotools, et. al. -->
142
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
143
				<include name="*.jar" />
144
			</fileset>
145
		
146

    
147
			<!-- Include OAI-PMH -->
148
			<fileset dir="lib/oaipmh">
149
				<include name="*.jar" />
150
			</fileset>
151

    
152
		</path>
153

    
154
		<!-- It is less likely you'll need to make any changes from here down,
155
			but customization is possible -->
156
		<property name="name" value="metacat" />
157
		<property name="Name" value="MetaCat" />
158
		<property name="debugprefix" value="${Name}:" />
159
		<property name="release" value="${metacat.version}" />
160
		<tstamp>
161
		    <format property="copyrightyear" pattern="yyyy" locale="en,US"/>
162
		</tstamp>
163
		<property name="copyright" value="${copyrightyear} Regents of the University of California" />
164
		<property name="style-common-relpath" value="/style/common" />
165
		<property name="style-shared-relpath" value="/style/shared" />
166
		<property name="schema-relpath" value="/schema" />
167
		<property name="style-common-cvsrelpath"
168
			value="lib${style-common-relpath}" />
169
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
170
		<property name="style-skins-relpath" value="/style/skins" />
171
		<property name="util-module" value="utilities" />
172
		<!-- property name="utilities-tag" value="trunk" / -->
173
		<property name="utilities-tag" value="tags/UTILITIES_1_1_0" />
174
		<property name="seek-tag" value="tags/ECOGRID_1_2_2" />
175
		<property name="eml-module" value="eml" />
176
		<property name="eml-version" value="2.0.0beta6" />
177
		<property name="eml-beta-tag"
178
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
179
		<property name="eml2_0_0-schema-tag"
180
			value="RELEASE_EML_2_0_0_UPDATE_1" />
181
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
182
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
183
		<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
184
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_0" />
185
		<property name="eml2_0_0namespace"
186
			value="eml://ecoinformatics.org/eml-2.0.0" />
187
		<property name="eml2_0_1namespace"
188
			value="eml://ecoinformatics.org/eml-2.0.1" />
189
		<property name="eml2_1_0namespace"
190
			value="eml://ecoinformatics.org/eml-2.1.0" />
191
		<property name="eml2_1_1namespace"
192
			value="eml://ecoinformatics.org/eml-2.1.1" />
193
		<property name="stmmlnamespace"
194
			value="http://www.xml-cml.org/schema/stmml" />
195
		<property name="eml-css" value="eml_xsl.css" />
196
		<property name="eml-module.default.css" value="default.css" />
197
		<property name="systemidserver" value="" />
198
		<property name="html-path" value="" />
199
		<property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
200

    
201

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

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

    
229
		<filter token="docrooturl" value="./" />
230
		<filter token="mcuser" value="${mcuser}" />
231
		<filter token="mcpassword" value="${mcpassword}" />
232
		<filter token="mcanotheruser" value="${mcanotheruser}" />
233
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
234
		<filter token="eml-css" value="${eml-css}" />
235
		<filter token="style-skins-relpath"
236
			value="${style-skins-relpath}" />
237
		<filter token="style-common-relpath"
238
			value="${style-common-relpath}" />
239

    
240
		<filter token="eml-version" value="${eml-version}" />
241
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
242
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
243
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
244
		<filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
245
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
246
		<filter token="debugprefix" value="${debugprefix}" />
247

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

    
268

    
269
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
270
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
271
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
272

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

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

    
317
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
318

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

    
343
		<!-- load the svn task -->
344
		<path id="svn.classpath">
345
			<pathelement location="${svnjavahl.jar}" />
346
			<pathelement location="${svnant.jar}" />
347
			<pathelement location="${svnClientAdapter.jar}" />
348
		</path>
349
		<taskdef resource="svntask.properties"
350
			classpathref="svn.classpath" />
351

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

    
389
		<condition property="ecogrid.required">
390
			<or>
391
				<not>
392
					<available file="${ecogrid-dir}/build.properties" />
393
				</not>
394
				<not>
395
					<available
396
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
397
				</not>
398
			</or>
399
		</condition>
400

    
401
	</target>
402

    
403
	<target name="prepare" depends="init">
404
		<mkdir dir="${build.dir}" />
405
		<mkdir dir="${build.src}" />
406
		<mkdir dir="${build.dest}" />
407
		<mkdir dir="${build.docs}" />
408
		<mkdir dir="${build.javadocs}" />
409
		<mkdir dir="${build.tmp}" />
410

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

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

    
434
	<target name="compile" depends="prepare,utilities"
435
		description="Compiles java code to build dir, and copies metacat props files there">
436

    
437
		<javac srcdir="${build.src}" destdir="${build.dest}"
438
			debug="${debug}"
439
			excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
440
			<classpath>
441
				<path refid="compile.classpath" />
442
			</classpath>
443
		</javac>
444
	</target>
445

    
446
	<target name="jar" depends="compile,geteml"
447
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
448

    
449
		<delete file="${build.dir}/${name}.jar" />
450
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
451
			excludes="**/protocols/ **/harvesterClient/" />
452
	</target>
453

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

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

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

    
477
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
478
	</target>
479

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

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

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

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

    
512
	<target name="harvester" depends="client"
513
		description="Compiles harvester java code to build dir">
514
		<javac srcdir="${build.src}" destdir="${build.dest}"
515
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
516
			<classpath>
517
				<path refid="compile.classpath" />
518
			</classpath>
519
		</javac>
520
	</target>
521
		
522
	<target name="harvesterjar" depends="harvester"
523
		description="Compiles and jars harvester java code to harvester.jar in build dir">
524
		<delete file="${build.dir}/harvester.jar" />
525
		<jar jarfile="${build.dir}/harvester.jar"
526
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
527
	</target>
528

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

    
553
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
554
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
555

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

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

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

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

    
599
		</copy>
600
		<!-- <antcall target="copyxsl">
601
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
602
			<param name="dirname" value="eml-2.0.0" />
603
			</antcall> -->
604

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

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

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

    
642
		<!-- Checkout eml210 for given style sheet tag-->
643
		<svn>
644
			<export srcUrl="${svn.eml2StyleUrl}"
645
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
646
		</svn>
647
		<antcall target="copyxsl">
648
			<param name="cvs.tagname" value="${eml2-style-tag}" />
649
			<!-- param name="dirname" value="eml-2.1.0" / -->
650
			<param name="dirname" value="eml-2" />
651
		</antcall>
652
		
653
		<!-- Checkout eml210 for given schema tag-->
654
		<svn>
655
			<export srcUrl="${svn.eml211SchemaUrl}"
656
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
657
		</svn>
658
		<mkdir dir="lib/schema/eml-2.1.1" />
659
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
660
			<fileset
661
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
662
				<include name="*.xsd" />
663
			</fileset>
664
		</copy>
665
	</target>
666

    
667
	<target name="copyxsl"
668
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
669

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

    
672
		<copy todir="${style-common-cvsrelpath}/${dirname}"
673
			filtering="yes">
674
			<fileset
675
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
676
				<include name="**/*.xsl" />
677
			</fileset>
678
		</copy>
679

    
680

    
681
		<!-- now copy default css from eml module and put it in style-common-path
682
			dir with a new name, so other skin-specific css can import it if reqd -->
683
		<copy
684
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
685
			tofile="${style-common-cvsrelpath}/${eml-css}" />
686

    
687
	</target>
688

    
689
	<target name="correctEML201Docs" depends="jar"
690
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
691
		<copy todir="${build.dir}" file="lib/metacat.properties"
692
			filtering="yes" />
693
		<java
694
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
695
			<classpath>
696
				<path refid="compile.classpath" />
697
				<fileset dir="${build.dir}">
698
					<include name="${name}.jar" />
699
				</fileset>
700
			</classpath>
701
		</java>
702
	</target>
703

    
704
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
705
		description="Installs spatial option for metacat">
706

    
707
		<property name="spatial.dir" value="./lib/spatial" />
708
		<property name="spatial.geoserver.dir"
709
			value="${spatial.dir}/geoserver" />
710
		<property name="spatial.webinf-mods"
711
			value="${spatial.dir}/WEB-INF" />
712

    
713
		<!-- Copy geoserver libs into ${war.lib} -->
714
		<copy todir="${war.lib}" filtering="no">
715
			<fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
716
				<include name="**" />
717
			</fileset>
718
		</copy>
719
		
720
		<copy todir="${dist.dir}">
721
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
722
		</copy>
723

    
724
	</target>
725

    
726
	<target name="install" depends="build-metacat"
727
		description="* Full Install For Development *">
728
		<copy file="${dist.dir}/${metacat.context}.war"
729
			todir="${app.deploy.dir}" />
730
               <!-- <copy file="${dist.dir}/${metacat.context}.war"
731
                        todir="${app.deploy.dir2}" />-->
732
		<delete dir="${app.deploy.dir}/${metacat.context}" />
733
		<!--<delete dir="${app.deploy.dir2}/${metacat.context}" />-->
734
		<copy file="${dist.dir}/geoserver.war"
735
					todir="${app.deploy.dir}" />
736
		<tstamp>
737
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
738
		</tstamp>
739
		<echo>Dev install completed at ${NOW}</echo>
740
	</target>
741

    
742
	<target name="build-metacat" depends="install-ecogrid, install-spatial"
743
		description="Build Metacat">
744
	</target>
745

    
746
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
747
		if="enable.ecogrid" description="Install Ecogrid Compentent">
748
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
749
			inheritall="false">
750
			<property name="context" value="${metacat.context}" />
751
			<property name="target" value="${ecogrid-target-name}" />
752
		</ant>
753
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
754
			inheritall="false">
755
			<property name="context" value="${metacat.context}" />
756
			<property name="target" value="${ecogrid-target-name}" />
757
			<property name="metacat.dir" value="${basedir}"/>
758
		</ant>
759
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
760
			<webinf dir="${ecogrid-dir}/lib">
761
			<include name="server-config.wsdd"/>
762
			</webinf>
763
			</war -->
764
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
765
			todir="${dist.dir}" overwrite="true" />
766

    
767

    
768
	</target>
769

    
770
	<target name="get-ecogrid" depends="init"
771
		description="Check out ecogrid module" if="ecogrid.required">
772
		<svn>
773
			<export srcUrl="${svn.ecogridUrl}" force="true"
774
				destPath="${ecogrid-dir}" />
775
		</svn>
776
	</target>
777

    
778
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
779
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
780
		<property name="context" value="${metacat.context}"/>
781
		<property name="target" value="${ecogrid-target-name}"/>
782
		<property name="metacat.dir" value="."/>
783
		<property name="hostname" value="${ecogrid.hostname}"/>
784
		<property name="port" value="${config.port}"/>
785
		</ant>
786
		</target -->
787

    
788
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
789
		description="Automately generate wsdd for ecogrid service">
790
		<delete
791
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
792
	</target>
793

    
794
	<target name="install-skin" depends="init"
795
		description="Install a Skin">
796

    
797
		<input message="Please enter name of the skin"
798
			addproperty="skin-name" />
799

    
800
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
801
		<copy todir="${installdir}/style/skins/${skin-name}"
802
			filtering="yes">
803
			<fileset dir="lib/style/skins/${skin-name}">
804
				<exclude name="**/*.png" />
805
				<exclude name="**/*.gif" />
806
				<exclude name="**/*.jpg" />
807
				<exclude name="**/CVS*" />
808
				<exclude name="**/.#*" />
809
			</fileset>
810
		</copy>
811
		<copy todir="${installdir}/style/skins/${skin-name}"
812
			filtering="no">
813
			<fileset dir="lib/style/skins/${skin-name}">
814
				<include name="**/*.png" />
815
				<include name="**/*.gif" />
816
				<include name="**/*.jpg" />
817
				<exclude name="**/CVS*" />
818
				<exclude name="**/.#*" />
819
			</fileset>
820
		</copy>
821
		<copy todir="${installdir}/style/common" filtering="yes">
822
			<fileset dir="lib/style/common">
823
				<include name="*.js" />
824
				<include name="*.jsp" />
825
				<include name="*.css" />
826
				<exclude name="*.png" />
827
				<exclude name="*.gif" />
828
				<exclude name="*.jpg" />
829
				<exclude name="**/CVS*" />
830
				<exclude name="**/.#*" />
831
			</fileset>
832
		</copy>
833
		<!--
834
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
835
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
836
			<fileset dir="lib/style/skins/${skin-name}/images">
837
			<include name="*.png"/>
838
			<include name="*.gif"/>
839
			<include name="*.jpg"/>
840
			</fileset>
841
			</copy>
842
		-->
843

    
844
		<echo message="Install Skin completed." />
845
	</target>
846

    
847
	<target name="war" depends="warPrepare,install-spatial"
848
		description="Create a web archive (WAR) for servlet deployment">
849
		<mkdir dir="${dist.dir}" />
850
		<war destfile="${dist.dir}/${metacat.context}.war"
851
			webxml="${build.war}/web.xml">
852
			<fileset dir="${war.context}" />
853
			<lib dir="${war.lib}" />
854
			<webinf dir="${war.webinf}" />
855
		</war>
856
	</target>
857

    
858
	<target name="warPrepare"
859
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
860
		description="Prepare files for creating a web archive (WAR)">
861

    
862
		<property name="war.lib" value="${build.war}/lib" />
863
		<property name="war.webinf" value="${build.war}/WEB-INF" />
864
		<property name="war.context"
865
			value="${build.war}/${metacat.context}" />
866
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
867
		<property name="war.webinf.scripts"
868
			value="${war.webinf}/scripts" />
869
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
870
		<property name="war.context.docs" value="${war.context}/docs" />
871
		<property name="war.context.temp" value="${war.context}/temp" />
872
		<property name="war.context.templates"
873
			value="${war.context}${style-common-relpath}/templates" />
874
		<mkdir dir="${war.lib}" />
875
		<mkdir dir="${war.webinf}" />
876
		<mkdir dir="${war.context}" />
877
		<mkdir dir="${war.webinf.sql}" />
878
		<mkdir dir="${war.context.cgi}" />
879
		<mkdir dir="${war.context.docs}" />
880
		<mkdir dir="${war.context.temp}" />
881
		<mkdir dir="${war.context.templates}" />
882

    
883
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
884
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
885
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
886
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
887
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
888
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
889
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
890
		<copy todir="${war.lib}" filtering="no">
891
			<fileset dir="lib">
892
				<!--
893
					<not>
894
					<filename name="${jdbc-jar-name}"/>
895
					</not>
896
				-->
897
				<include name="*.jar" />
898
				<exclude name="maven-ant-tasks*.jar" />
899
			</fileset>
900
			<fileset dir="lib">
901
				<include name="xalan.jar" />
902
				<include name="gwt*.jar" />
903
			</fileset>
904
			<fileset dir="lib/oaipmh">
905
				<include name="oaicat.jar" />
906
			</fileset>
907
		</copy>
908
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
909
			tofile="${build.war}/web.xml" / -->
910
		<!-- MCD added next - Remove the tomcat5 reference-->
911
		<copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
912
		<copy file="lib/metacat.properties" todir="${war.webinf}"
913
			filtering="yes" />
914
		<copy file="lib/metacat.properties.metadata.xml"
915
			todir="${war.webinf}" filtering="no" />
916
		<copy file="lib/org.properties.metadata.xml"
917
			todir="${war.webinf}" filtering="no" />
918
		<copy file="lib/auth.properties.metadata.xml"
919
			todir="${war.webinf}" filtering="no" />
920
		<copy todir="${war.webinf}" filtering="yes">
921
			<fileset dir="lib">
922
				<include name="skin.configs/**" />
923
			</fileset>
924
		</copy>
925
		<copy file="lib/log4j.properties" todir="${war.webinf}"
926
			filtering="yes" />
927
		<copy file="lib/hazelcast.xml" todir="${war.webinf}"
928
			filtering="yes" />
929
		<copy todir="${war.context}" filtering="no">
930
			<fileset dir="lib">
931
				<include name="**/*.jpg" />
932
				<include name="**/*.png" />
933
				<include name="**/*.gif" />
934
				<include name="LiveMap_30/**" />
935
				<include name="oaipmh/**" />
936
			</fileset>
937
		</copy>
938
		<copy todir="${war.context}" filtering="yes">
939
			<fileset dir="lib">
940
				<exclude name="*.jar" />
941
				<exclude name="*.properties" />
942
				<exclude name="*.metadata.xml" />
943
				<exclude name="web.xml" />
944
				<exclude name="**/*.jpg" />
945
				<exclude name="**/*.png" />
946
				<exclude name="**/*.gif" />
947
				<exclude name="lsid_lib/**" />
948
				<exclude name="lsid_conf/**" />
949
				<exclude name="LiveMap_30/**" />
950
				<exclude name="oaipmh/**" />
951
				<exclude name="skin.configs/**" />
952
				<exclude name="spatial/geoserver/**" />
953
			</fileset>
954
		</copy>
955
		<copy todir="${war.context}" filtering="no">
956
			<fileset dir="lib">
957
				<include name="spatial/geoserver/data/**" />
958
			</fileset>
959
		</copy>
960
		<copy todir="${war.context.docs}" filtering="no">
961
			<fileset dir="${build.docs}" />
962
		</copy>
963
		<copy todir="${war.webinf.sql}" filtering="yes">
964
			<fileset dir="src">
965
				<include name="**/*.sql" />
966
			</fileset>
967
		</copy>
968
		<copy todir="${war.webinf.scripts}" filtering="yes">
969
			<fileset dir="src/scripts" />
970
		</copy>
971
		<copy todir="${war.webinf.scripts}"
972
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
973
			failonerror="false" />
974

    
975
		<copy file="src/perl/register-dataset.cgi"
976
			todir="${war.context.cgi}" />
977
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
978
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
979

    
980
		<!-- registry cgi section -->
981
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
982
			used in readDocumentFromMetacat -->
983
		<!-- TODO MCD copy temp files to actual location using config util?? -->
984
		<copy todir="${war.context.temp}" filtering="yes">
985
			<fileset dir="lib/style/common/emlb6toeml2">
986
				<include name="*.xsl" />
987
				<include name="*.xml" />
988
			</fileset>
989
		</copy>
990
		<available file="lib/style/common/emlb6toeml2" type="dir"
991
			property="styles.not.needed" />
992

    
993
		<!-- ldap cgi section -->
994
		<copy todir="${war.context.templates}">
995
			<fileset dir="lib/style/common/templates">
996
				<!-- SCW: Copy all files -->
997
			</fileset>
998
		</copy>
999
	</target>
1000

    
1001
	<target name="cgiPrepare" if="build.perl">
1002
		<exec dir="src/perl/Metacat/" executable="make">
1003
			<arg value="clean" />
1004
		</exec>
1005
		<exec dir="src/perl/Metacat/" executable="perl">
1006
			<arg value="Makefile.PL" />
1007
		</exec>
1008
		<exec dir="src/perl/Metacat/" executable="make" />
1009
	</target>
1010

    
1011
	<target name="testPrepare"
1012
		description="Copies test files into the war directories">
1013
		<echo>in testPrepare</echo>
1014
		<property name="war.context.test"
1015
			value="${build.war}/${metacat.context}/test" />
1016
		<mkdir dir="${war.context.test}" />
1017
		<copy todir="${war.context.test}" filtering="yes">
1018
			<fileset dir="test/servertestfiles">
1019
				<include name="*/**" />
1020
			</fileset>
1021
		</copy>
1022
	</target>
1023

    
1024
	<target name="getConversionXSL" depends="prepare"
1025
		unless="styles.not.needed"
1026
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1027

    
1028
		<svn>
1029
			<export srcUrl="${svn.eml2StyleUrl}"
1030
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1031
		</svn>
1032

    
1033
		<mkdir dir="lib/style/common/emlb6toeml2" />
1034
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1035
			<fileset
1036
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1037
				<include name="*.xsl" />
1038
				<include name="*.xml" />
1039
			</fileset>
1040
		</copy>
1041
	</target>
1042

    
1043
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1044
		<mkdir dir="${build.tests}" />
1045
		<copy todir="${build.tests}" encoding="UTF-8">
1046
			<fileset dir="${testdir}">
1047
				<include name="edu/**" />
1048
			</fileset>
1049
		</copy>
1050
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1051

    
1052
		<path id="test.classpath">
1053
			<path refid="compile.classpath" />
1054
			<fileset dir="${build.dir}">
1055
				<include name="${name}.jar" />
1056
				<include name="${name}-client.jar" />
1057
				<include name="harvester.jar" />
1058
			</fileset>
1059
		</path>
1060
		
1061
		<pathconvert pathsep="${line.separator}|  |--" 
1062
		             property="echo.test.classpath"
1063
		             refid="test.classpath">
1064
		</pathconvert>
1065
		<echo message="|--test classpath" />
1066
		<echo message="|  |" />
1067
		<echo message="|  |-- ${echo.test.classpath}" />
1068
		
1069
		<!-- copy and compile the tests into a jar file -->
1070
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1071
			debug="on" includes="**/*.java" encoding="UTF-8">
1072
			<classpath refid="test.classpath" />
1073
		</javac>
1074

    
1075
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1076
			basedir="${build.tests}" >
1077
			<include name="**/*.class"/>
1078
			<include name="**/*.xml"/>
1079
		</jar>	
1080
		
1081
	</target>
1082

    
1083
	<target name="test" depends="testprep"
1084
		description="Uses the ant junit task to run all JUnit tests">
1085

    
1086
		<!-- use the ant "junit" task to run JUnit tests. -->
1087
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1088
			haltonerror="no">
1089
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1090
			<classpath>
1091
				<path refid="test.classpath" />
1092
				<fileset dir="${build.dir}">
1093
					<include name="${name}.jar" />
1094
					<include name="${name}-client.jar" />
1095
					<include name="harvester.jar" />
1096
					<include name="${name}-junittests.jar" />
1097
				</fileset>
1098
			</classpath>
1099

    
1100
			<formatter type="plain" />
1101

    
1102
			<batchtest fork="yes" todir="${build.dir}">
1103
				<fileset dir="${build.tests}">
1104
					<include name="**/*.class" />
1105
					<exclude name="**/MCTestCase.class" />
1106
					<exclude name="**/ClientViewHelperTest.class" />
1107
					<!-- these are not test cases -->
1108
					<exclude name="**/MockCNode.class" />
1109
					<exclude name="**/D1NodeServiceTest.class" />
1110
				</fileset>
1111
			</batchtest>
1112
		</junit>
1113
	</target>
1114

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

    
1118
		<echo>testtorun: ${testtorun}</echo>
1119

    
1120
		<!-- use the ant "junit" task to run JUnit tests. -->
1121
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1122
			haltonerror="no" showoutput="yes">
1123
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1124
			<classpath>
1125
				<path refid="test.classpath" />
1126
				<fileset dir="${build.dir}">
1127
					<include name="${name}.jar" />
1128
					<include name="${name}-client.jar" />
1129
					<include name="harvester.jar" />
1130
					<include name="${name}-junittests.jar" />
1131
				</fileset>
1132
			</classpath>
1133

    
1134
			<formatter type="plain" />
1135

    
1136
			<batchtest fork="yes" todir="${build.dir}">
1137
				<fileset dir="${build.tests}">
1138
					<include name="**/${testtorun}.class" />
1139
				</fileset>
1140
			</batchtest>
1141
		</junit>
1142
	</target>
1143

    
1144
	<target name="testharvester" depends="testprep"
1145
		description="Uses the ant junit task to test only the Harvester code">
1146
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1147
			haltonerror="off">
1148
			<classpath>
1149
				<path refid="compile.classpath" />
1150
				<fileset dir="${build.dir}">
1151
					<include name="${name}.jar" />
1152
					<include name="${name}-client.jar" />
1153
					<include name="harvester.jar" />
1154
					<include name="${name}-junittests.jar" />
1155
				</fileset>
1156
			</classpath>
1157
			<formatter type="plain" />
1158
			<batchtest fork="yes" todir="${build.dir}">
1159
				<fileset dir="${build.tests}">
1160
					<include name="**/harvesterClient/*.class" />
1161
				</fileset>
1162
			</batchtest>
1163
		</junit>
1164
	</target>
1165

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

    
1170
		<echo>
1171
			*********************************** Please run ant
1172
			gethttpclient first! ***********************************
1173
		</echo>
1174
		<!-- copy and compile the tests into a jar file -->
1175
		<mkdir dir="${build.metacatnettest}" />
1176
		<javac srcdir="${junitnettestsdir}"
1177
			destdir="${build.metacatnettest}" includes="**/*.java">
1178
			<classpath>
1179
				<path refid="compile.classpath" />
1180
				<fileset dir="${build.dir}">
1181
					<include name="${name}.jar" />
1182
				</fileset>
1183
			</classpath>
1184
		</javac>
1185

    
1186
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1187
			basedir="${build.metacatnettest}" includes="**/*.class" />
1188

    
1189
		<!-- use the ant "junit" task to run JUnit tests. -->
1190
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1191
			haltonerror="no">
1192
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1193
			<classpath>
1194
				<path refid="compile.classpath" />
1195
				<fileset dir="${build.dir}">
1196
					<include name="${name}.jar" />
1197
					<include name="${name}-junitnettests.jar" />
1198
				</fileset>
1199
			</classpath>
1200

    
1201
			<formatter type="plain" />
1202

    
1203
			<batchtest fork="yes" todir="${build.dir}">
1204
				<fileset dir="${build.metacatnettest}">
1205
					<include name="**/*.class" />
1206
				</fileset>
1207
			</batchtest>
1208
		</junit>
1209
	</target>
1210

    
1211
	<target name="cleanweb" depends="clean"
1212
		description="deletes tomcat web context dir and all its contents">
1213
		<delete dir="${installdir}" />
1214
	</target>
1215

    
1216

    
1217
	<target name="clean" depends="init"
1218
		description="deletes build dir and files that can be regenerated form the release">
1219
		<delete dir="${build.dir}" />
1220
		<delete dir="${dist.dir}" />
1221
	</target>
1222

    
1223
	<target name="localclean" depends="clean"
1224
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1225
		<delete file="lib/utilities.jar" />
1226
	</target>
1227

    
1228
	<target name="fullclean" depends="localclean"
1229
		description="deletes code and eml">
1230
		<delete includeEmptyDirs="true" failonerror="false">
1231
			<fileset dir="${style-common-cvsrelpath}">
1232
				<include name="${eml-css}" />
1233
				<include name="eml-*/*.xsl" />
1234
				<include name="eml-*" />
1235
			</fileset>
1236
			<fileset dir="${schema-cvsrelpath}">
1237
				<include name="eml-*/*.xsd" />
1238
			</fileset>
1239
			<fileset dir="${ecogrid-dir}"/>
1240
			<fileset dir="lib/style/common/emlb6toeml2"/>
1241
			<fileset dir="lib/dtd"/>
1242
			<fileset dir="lib/schema"/>
1243
			<fileset dir="${utilitiesdir}"/>
1244
		</delete>
1245
	</target>
1246
	
1247
	<target name="documentation" depends="javadoc,admindoc"
1248
	    description="generates Javadoc API documentation and Admin Guide">
1249
    </target>
1250
	
1251
	<target name="admindoc" depends="prepare">
1252
		<!-- Build the administrator's guide, which is a Sphinx RST project
1253
		     For this to succeed, you must have Sphinx installed on your machine
1254
		     See: http://sphinx.pocoo.org/ for details
1255
		     And you must also have the 'make' build tool installed
1256
		-->
1257
		<exec dir="${docdir}/user/metacat" executable="make"> 
1258
		        <arg value="html"/> 
1259
		</exec>
1260
    </target>
1261

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1400
	<target name="spatial_option" depends="prepare"
1401
		description=" -- compiles code for the spatial option">
1402

    
1403
		<echo message="Compiling the metatcat shapefile creator" />
1404
		<echo message="using the shapelib at: ${shapelib.dir}" />
1405
		<exec dir="." executable="g++" os="Linux, Unix"
1406
			failonerror="true">
1407
			<arg
1408
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1409
		</exec>
1410

    
1411
		<exec dir="." executable="g++" os="Linux, Unix"
1412
			failonerror="true">
1413
			<arg
1414
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1415
		</exec>
1416
	</target>
1417

    
1418
	<!-- LSID Authority support -->
1419
	<patternset id="lsid.jars">
1420
		<include name="axis.jar" />
1421
		<include name="commons-discovery-0.2.jar" />
1422
		<include name="jaxrpc.jar" />
1423
		<include name="lsid-client-1.1.1.jar" />
1424
		<include name="lsid-server-1.1.1.jar" />
1425
		<include name="saaj.jar" />
1426
		<include name="wsdl4j-1.5.1.jar" />
1427
		<include name="activation.jar" />
1428
		<include name="castor-0.9.5.jar" />
1429
		<include name="dnsjava-1.3.2.jar" />
1430
		<include name="mail.jar" />
1431
		<include name="commons-logging-1.0.4.jar" />
1432
		<!-- These jars may be needed but seem to not actually be,
1433
			so leaving them out for now
1434
			<include name="axis-ant.jar" />
1435
		-->
1436
		<!--<include name="GenCastor.class" />-->
1437
	</patternset>
1438
	<patternset id="lib.jars">
1439
		<include name="log4j-1.2.12.jar" />
1440
		<include name="utilities.jar" />
1441
		<include name="xerces*.jar" />
1442
		<include name="xalan*.jar" />
1443
		<include name="xml-apis.jar" />
1444
	</patternset>
1445

    
1446
	<path id="lsid.classpath">
1447
		<fileset dir="${lsid.lib.dir}">
1448
			<patternset refid="lsid.jars" />
1449
		</fileset>
1450
		<fileset dir="${lib.dir}">
1451
			<patternset refid="lib.jars" />
1452
		</fileset>
1453
		<fileset dir="${build.dir}">
1454
			<include name="metacat-client.jar" />
1455
			<include name="metacat.jar" />
1456
		</fileset>
1457
	</path>
1458

    
1459
	<filterset id="configFilters">
1460
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1461
			value="${config.hostname}" / -->
1462
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1463
			value="${config.port}" / -->
1464
		<!-- MCD BYE filter token="METADATA_LABELS"
1465
			value="${config.metadataLabelLsid}" / -->
1466
		<!-- MCD BYE filter token="METACAT_SERVER"
1467
			value="${config.metacatserver}" / -->
1468
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1469
			value="${config.lsidauthority}" / -->
1470
	</filterset>
1471

    
1472
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1473
		description="Configure files prior to compilation">
1474
		<mkdir dir="${lsid.build.dir}" />
1475
		<!-- Copy the properties file into the build -->
1476
		<copy file="${conf.dir}/metacat-lsid.properties"
1477
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1478
			overwrite="true">
1479
			<filterset refid="configFilters" />
1480
		</copy>
1481
		<copy file="${conf.dir}/log4j.properties"
1482
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1483
			overwrite="true">
1484
			<filterset refid="configFilters" />
1485
		</copy>
1486
		<!-- Copy config files into the build -->
1487
		<copy todir="${lsid.build.dir}/WEB-INF">
1488
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1489
		</copy>
1490
		<!-- Copy the metadata configuration files into the build -->
1491
		<mkdir
1492
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1493
		<copy
1494
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1495
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1496
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1497
			<filterset refid="configFilters" />
1498
		</copy>
1499
		<!-- Copy services files into the build -->
1500
		<mkdir dir="${lsid.build.dir}/services" />
1501
		<copy todir="${lsid.build.dir}/services">
1502
			<fileset dir="${services.dir}" />
1503
			<filterset refid="configFilters" />
1504
		</copy>
1505
		<!-- Copy axis files into the build -->
1506
		<mkdir dir="${lsid.build.dir}" />
1507
		<copy todir="${lsid.build.dir}">
1508
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1509
		</copy>
1510
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1511
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1512
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1513
		</copy>
1514
	</target>
1515

    
1516
	<target name="compile-lsid" depends="prepare-lsid"
1517
		description="Compile Java sources">
1518
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1519
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1520
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1521
			deprecation="${compile.deprecation}"
1522
			optimize="${compile.optimize}">
1523
			<classpath refid="lsid.classpath" />
1524
		</javac>
1525
	</target>
1526

    
1527
	<target name="war-lsid" depends="compile-lsid"
1528
		description="Create a war file for the application">
1529
		<mkdir dir="${dist.dir}" />
1530
		<war destfile="${dist.dir}/${authority.context}.war"
1531
			webxml="${webinf.dir}/web.xml">
1532
			<fileset dir="${lsid.build.dir}" />
1533
			<lib dir="${lsid.lib.dir}">
1534
				<patternset refid="lsid.jars" />
1535
			</lib>
1536
			<lib dir="${lib.dir}">
1537
				<patternset refid="lib.jars" />
1538
			</lib>
1539
			<lib dir="${lib.dir}">
1540
				<include name="xalan.jar" />
1541
				<include name="xml-apis.jar" />
1542
			</lib>
1543
			<lib dir="${build.dir}">
1544
				<include name="metacat-client.jar" />
1545
			</lib>
1546
		</war>
1547
	</target>
1548

    
1549
	<target name="deploy-lsid" depends="war-lsid"
1550
		description="Deploy LSID war to servlet container">
1551
		<delete dir="${app.deploy.dir}/${authority.context}" />
1552
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1553
		<mkdir dir="${app.deploy.dir}" />
1554
		<copy todir="${app.deploy.dir}">
1555
			<fileset dir="${dist.dir}" />
1556
		</copy>
1557
	</target>
1558
	
1559
	<target name="change-metacat-properties" depends="warPrepare"
1560
        description="Chage some default values of metacat.properties">
1561
       <echo file="${metacat-properties-file}" append="true">
1562
		   configutil.propertiesConfigured=true
1563
		   configutil.authConfigured=true
1564
           configutil.skinsConfigured=true
1565
		   configutil.databaseConfigured=true
1566
		   configutil.geoserverConfigured=true
1567
	   </echo>
1568
  </target>
1569
	
1570
	<!-- This target will use default values in svn metacat.properties to build a configured 
1571
		metacat (except configuti.* properties, they will be set true). Those default settings
1572
		are for a test machine. It may not work on your system-->
1573
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1574
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1575
    </target>
1576
	
1577
</project>
(5-5/6)