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: 2013-04-25 14:18:57 -0700 (Thu, 25 Apr 2013) $'
11
	*    '$Revision: 7624 $'
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
	<property name="maven.home" value="/usr/share/maven" />
45
	
46
	<!-- defining the axis tasks -->
47
	<path id="axis.ant.classpath">
48
		<fileset dir="lib/lsid_lib">
49
			<include name="*.jar" />
50
		</fileset>
51
	</path>
52
    	
53
	<taskdef resource="axis-tasks.properties"
54
		classpathref="axis.ant.classpath" />
55
	
56
	<!-- Determine if ecogrid should be installed-->
57
	<condition property="enable.ecogrid">
58
		<equals arg1="${install.ecogrid}" arg2="true" />
59
	</condition>
60

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

    
66
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
67
			property="tomcat.common.exists" />
68

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

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

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

    
120
			<!-- Include everything from maven -->
121
			<fileset dir="${libdir.mvn}">
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/lsid_lib">
135
				<include name="*.jar" />
136
			</fileset>
137
			<!-- Include maven -->
138
			<fileset dir="${libdir.mvn}">
139
				<include name="*.jar" />
140
			</fileset>
141
		</path>
142
		
143
		<!-- define the maven tasks -->
144
		<taskdef uri="antlib:org.apache.maven.artifact.ant"
145
			       resource="org/apache/maven/artifact/ant/antlib.xml"
146
			       classpathref="base.classpath" />
147

    
148
	   	<!-- Resolve maven dependencies -->
149
		<artifact:pom id="metacatPom" file="pom.xml" />
150
		<artifact:dependencies filesetId="dependency.fileset" pomrefid="metacatPom" usescope="runtime"/>
151
		<artifact:dependencies pathId="dependency.classpath" pomrefid="metacatPom"/>
152
	   		   	
153
	   	<!-- combine base and dependencies for the classpath -->
154
	   	<path id="compile.classpath">
155
	   		<path refid="base.classpath" />	
156
	   		<path refid="dependency.classpath" />	
157
		</path>
158

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

    
211

    
212
		<!-- Config for registry variables -->
213
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
214
		<property name="scope" value="obfs" />
215
		<property name="responseForm" value="genericResponse.tmpl" />
216
		<property name="entryForm" value="entryForm.tmpl" />
217
		<property name="guide" value="genericGuide.tmpl" />
218
		<property name="loginForm" value="loginForm.tmpl" />
219
		<property name="confirmData" value="confirmData.tmpl" />
220
		<property name="deleteData" value="deleteData.tmpl" />
221
		<property name="genericHeader" value="genericHeader.tmpl" />
222
		<property name="genericFooter" value="genericFooter.tmpl" />
223

    
224
		<filter token="scope" value="${scope}" />
225
		<filter token="responseForm" value="${responseForm}" />
226
		<filter token="entryForm" value="${entryForm}" />
227
		<filter token="guide" value="${guide}" />
228
		<filter token="loginForm" value="${loginForm}" />
229
		<filter token="confirmData" value="${confirmData}" />
230
		<filter token="deleteData" value="${deleteData}" />
231
		<filter token="genericHeader" value="${genericHeader}" />
232
		<filter token="genericFooter" value="${genericFooter}" />
233
		<filter token="adminname" value="${adminname}" />
234
		<filter token="recipient" value="${recipient}" />
235
		<filter token="metacatVersion" value="${metacat.version}" />
236
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
237
		<filter token="build.context" value="${metacat.context}" />
238

    
239
		<filter token="docrooturl" value="./" />
240
		<filter token="mcuser" value="${mcuser}" />
241
		<filter token="mcpassword" value="${mcpassword}" />
242
		<filter token="mcanotheruser" value="${mcanotheruser}" />
243
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
244
		<filter token="eml-css" value="${eml-css}" />
245
		<filter token="style-skins-relpath"
246
			value="${style-skins-relpath}" />
247
		<filter token="style-common-relpath"
248
			value="${style-common-relpath}" />
249

    
250
		<filter token="eml-version" value="${eml-version}" />
251
		<filter token="eml-beta4-version" value="${eml-beta4-version}" />
252
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
253
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
254
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
255
		<filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
256
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
257
		<filter token="stmml11namespace" value="${stmml11namespace}" />
258
		<filter token="debugprefix" value="${debugprefix}" />
259

    
260
		<filter token="defaultStage" value="${defaultStage}" />
261
		<filter token="defaultHeader" value="${defaultHeader}" />
262
		<filter token="defaultFooter" value="${defaultFooter}" />
263
		<filter token="defaultChangePass" value="${defaultChangePass}" />
264
		<filter token="defaultResetPass" value="${defaultResetPass}" />
265
		<filter token="changePassSuccess" value="${changePassSuccess}" />
266
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
267
		<filter token="registerFailed" value="${registerFailed}" />
268
		<filter token="registerLter" value="${registerLter}" />
269
		<filter token="registerMatch" value="${registerMatch}" />
270
		<filter token="registerSuccess" value="${registerSuccess}" />
271
		<filter token="register" value="${register}" />
272
		<filter token="searchResults" value="${searchResults}" />
273
		<filter token="ldapMainServerFailure"
274
			value="${ldapMainServerFailure}" />
275
		<filter token="lter-user" value="${lteruser}" />
276
		<filter token="lter-pass" value="${lterpassword}" />
277
		<filter token="pisco-user" value="${piscouser}" />
278
		<filter token="pisco-pass" value="${piscopassword}" />
279

    
280

    
281
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
282
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
283
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
284

    
285
		<property name="srcdir" value="./src" />
286
		<property name="lib.dir" value="./lib" />
287
		<property name="docdir" value="./docs" />
288
		<property name="cgidir" value="./cgi-bin" />
289
		<property name="testdir" value="./test" />
290
		<property name="testtorun" value="MNodeServiceTest" />
291
		<property name="junittestsdir"
292
			value="./test/edu/ucsb/nceas/metacattest" />
293
		<property name="junitnettestsdir"
294
			value="./test/edu/ucsb/nceas/metacatnettest" />
295
		<property name="classtorun" value="edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateSystemMetadata" />
296
		<property name="build.dir" value="./build" />
297
		<property name="build.src" value="${build.dir}/src" />
298
		<property name="build.dest" value="${build.dir}/classes" />
299
		<property name="build.samples" value="${build.dir}/samples" />
300
		<property name="build.tests" value="${build.dir}/tests" />
301
		<property name="build.tmp" value="${build.dir}/tmp" />
302
		<property name="build.metacattest"
303
			value="${build.tests}/metacattest" />
304
		<property name="build.metacatnettest"
305
			value="${build.tests}/metacatnettest" />
306
		<property name="build.data" value="${build.dir}/data" />
307
		<property name="build.docs" value="${build.dir}/docs" />
308
		<property name="build.javadocs" value="${build.docs}/api" />
309
		<property name="build.war" value="${build.dir}/war" />
310
		<property name="dist.dir" value="dist" />
311
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
312
		<property name="ver.src" value="${ver.dir}/src" />
313
		<property name="util.dir" value="${dist.dir}/${util-module}" />
314
		<property name="test.dir" value="${dist.dir}/test" />
315
		<!-- directories for creating a Harvest List Editor distribution -->
316
		<property name="dist.dir.hle" value="disthle" />
317
		<property name="ver.dir.hle"
318
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
319
		<property name="pkg.dir" value="./package" />
320
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
321

    
322
		<property name="ecogrid-target-name" value="metacatImpl" />
323
		<property name="ecogrid-module-dest-dir" value=".." />
324
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
325
		<property name="ecogrid-dist-dir"
326
			value="${dist.dir}/${ecogrid-module}" />
327
		<property name="ecogrid-dir"
328
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
329

    
330
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
331

    
332
		<!-- set up svn -->
333
		<property name="svnant.lib" value="lib" />
334
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
335
		<property name="svnClientAdapter.jar"
336
			value="${svnant.lib}/svnClientAdapter.jar" />
337
		<property name="svnjavahl.jar"
338
			value="${svnant.lib}/svnjavahl.jar" />
339
		<property name="svn.utilitiesUrl"
340
			value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
341
		<property name="svn.ecogridUrl"
342
			value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
343
		<property name="svn.emlBetaUrl"
344
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
345
		<property name="svn.emlBeta4Url"
346
					value="https://code.ecoinformatics.org/code/eml/tags/${eml-beta4-tag}" />
347
		<property name="svn.eml200SchemaUrl"
348
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
349
		<property name="svn.eml201SchemaUrl"
350
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
351
		<property name="svn.eml210SchemaUrl"
352
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
353
		<property name="svn.eml211SchemaUrl"
354
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
355
		<property name="svn.eml2StyleUrl"
356
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
357

    
358
		<!-- load the svn task -->
359
		<path id="svn.classpath">
360
			<pathelement location="${svnjavahl.jar}" />
361
			<pathelement location="${svnant.jar}" />
362
			<pathelement location="${svnClientAdapter.jar}" />
363
		</path>
364
		<taskdef resource="svntask.properties"
365
			classpathref="svn.classpath" />
366

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

    
399
		<condition property="ecogrid.required">
400
			<or>
401
				<not>
402
					<available file="${ecogrid-dir}/build.properties" />
403
				</not>
404
				<not>
405
					<available
406
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
407
				</not>
408
			</or>
409
		</condition>
410
		
411
		<property name="init.called" value="true" />
412

    
413
	</target>
414
	
415
	<target name="resolveDependencies" depends="init" description="retrieve dependencies with maven">
416
			<echo>Moving Maven dependencies (${dependency.fileset}) to ${libdir.mvn} </echo>
417
			<!-- Clear out mvn dir -->
418
			<delete dir="${libdir.mvn}"></delete>
419
			<!-- Copy all dependencies to the correct location. -->
420
			<copy todir="${libdir.mvn}">
421
				<fileset refid="dependency.fileset" />
422
				<!-- This mapper strips off all leading directory information -->
423
				<mapper type="flatten" />
424
			</copy>
425
		</target>
426

    
427
	<target name="prepare" depends="init, resolveDependencies">
428
		<mkdir dir="${build.dir}" />
429
		<mkdir dir="${build.src}" />
430
		<mkdir dir="${build.dest}" />
431
		<mkdir dir="${build.docs}" />
432
		<mkdir dir="${build.javadocs}" />
433
		<mkdir dir="${build.tmp}" />
434

    
435
		<copy todir="${build.src}" filtering="yes">
436
			<fileset dir="${srcdir}">
437
				<include name="edu/**" />
438
				<include name="com/**" />
439
				<include name="org/**" />
440
				<!-- include name="java/**" / -->
441
				<include name="**/*.sql" />
442
				<exclude name="**/CVS*" />
443
				<exclude name="**/.#*" />
444
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
445
			</fileset>
446
		</copy>
447
		<available file="lib/style/common/emlb6toeml2" type="dir"
448
			property="styles.not.needed" />
449
	</target>
450

    
451
	<target name="generateStubs" depends="prepare">
452
		<echo
453
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
454
		<axis-wsdl2java verbose="true" output="${srcdir}"
455
			url="/tmp/KeplerWebService.wsdl" />
456
	</target>
457

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

    
461
		<javac srcdir="${build.src}" destdir="${build.dest}"
462
			debug="${debug}"
463
			excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
464
			<classpath>
465
				<path refid="compile.classpath" />
466
			</classpath>
467
		</javac>
468
	</target>
469

    
470
	<target name="jar" depends="compile,geteml"
471
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
472

    
473
		<delete file="${build.dir}/${name}.jar" />
474
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
475
			excludes="**/protocols/ **/harvesterClient/" />
476
	</target>
477

    
478
	<target name="protocol" depends="compile"
479
		description="Compiles and jars protocol java code to protocol.jar in build dir">
480
		<delete file="${build.dir}/protocol.jar" />
481
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
482
			includes="**/protocols/" />
483
	</target>
484

    
485
	<target name="utilities" depends="config,getpeerutilities"
486
		if="utilities.required">
487
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
488
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
489
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
490
	</target>
491

    
492
	<target name="getpeerutilities" depends="prepare"
493
		if="peer.utilities.required"
494
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
495
		<echo message="Exporting utilities files from svn repository:" />
496
		<svn>
497
			<export srcUrl="${svn.utilitiesUrl}"
498
				destPath="${utilitiesdir}" />
499
		</svn>
500

    
501
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
502
	</target>
503

    
504
	<target name="getutilities" depends="prepare"
505
		description="Checks utility out of svn and copies it to your metacat sandbox">
506
		<svn>
507
			<export srcUrl="${svn.utilitiesUrl}"
508
				destPath="${utilitiesdir}" force="true" />
509
		</svn>
510
	</target>
511

    
512
	<target name="client" depends="utilities, prepare"
513
		description="Compiles metacat-client java code to build dir">
514
		<javac srcdir="${build.src}" destdir="${build.dest}"
515
			includes="edu/ucsb/nceas/metacat/client/*">
516
			<classpath>
517
				<path refid="compile.classpath" />
518
			</classpath>
519
		</javac>
520
	</target>
521

    
522
	<target name="clientjar" depends="client"
523
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
524
		<delete file="${build.dir}/${name}-client.jar" />
525
		<jar jarfile="${build.dir}/${name}-client.jar"
526
			basedir="${build.dest}" includes="**/metacat/client/" />
527
	</target>
528

    
529
	<target name="advancedsearchjar" depends="compile"
530
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
531
		<delete file="${build.dir}/advancedsearch.jar" />
532
		<jar jarfile="${build.dir}/advancedsearch.jar"
533
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
534
	</target>
535

    
536
	<target name="harvester" depends="client"
537
		description="Compiles harvester java code to build dir">
538
		<javac srcdir="${build.src}" destdir="${build.dest}"
539
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
540
			<classpath>
541
				<path refid="compile.classpath" />
542
			</classpath>
543
		</javac>
544
	</target>
545
		
546
	<target name="harvesterjar" depends="harvester"
547
		description="Compiles and jars harvester java code to harvester.jar in build dir">
548
		<delete file="${build.dir}/harvester.jar" />
549
		<jar jarfile="${build.dir}/harvester.jar"
550
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
551
	</target>
552

    
553
	<target name="harvestListEditorDist" depends="harvesterjar"
554
		description="Prepares a distribution of the Harvest List Editor tool">
555
		<mkdir dir="${dist.dir.hle}" />
556
		<delete dir="${ver.dir.hle}" />
557
		<mkdir dir="${ver.dir.hle}" />
558
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
559
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
560
		<copy todir="${ver.dir.hle}"
561
			file="lib/harvester/harvestList.xsd" />
562
		<copy todir="${ver.dir.hle}"
563
			file="lib/harvester/harvestListEditor.bat" />
564
		<copy todir="${ver.dir.hle}"
565
			file="lib/harvester/harvestListEditor.sh" />
566
		<delete file="./harvest-list-editor-${release}.zip" />
567
		<zip zipfile="./harvest-list-editor-${release}.zip"
568
			basedir="${ver.dir.hle}" />
569
		<delete file="./harvest-list-editor-${release}.tar.gz" />
570
		<tar tarfile="./harvest-list-editor-${release}.tar"
571
			basedir="${ver.dir.hle}" />
572
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
573
			src="./harvest-list-editor-${release}.tar" />
574
		<delete file="./harvest-list-editor-${release}.tar" />
575
	</target>
576

    
577
	<target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
578
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
579

    
580
	<target name="getemlpre2" depends="prepare" if="eml.required"
581
		description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
582
		<svn>
583
			<export srcUrl="${svn.emlBetaUrl}"
584
				destPath="${build.tmp}/eml_${eml-beta-tag}" />
585
		</svn>
586
		<mkdir dir="lib/dtd" />
587
		<copy todir="lib/dtd" filtering="yes">
588
			<fileset
589
				dir="${build.tmp}/eml_${eml-beta-tag}">
590
				<include name="*.dtd" />
591
			</fileset>
592
			<mapper type="glob" from="eml-*.dtd"
593
				to="eml-*-${eml-version}.dtd" />
594
		</copy>
595

    
596
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
597
			<fileset
598
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
599
				<include name="**/*.xsl" />
600
			</fileset>
601
		</copy>
602
	</target>
603
	
604
	<target name="getemlpre2beta4" depends="prepare" if="eml.required"
605
			description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
606
			<svn>
607
				<export srcUrl="${svn.emlBeta4Url}"
608
					destPath="${build.tmp}/eml_${eml-beta4-tag}" />
609
			</svn>
610
			<mkdir dir="lib/dtd" />
611
			<copy todir="lib/dtd" filtering="yes">
612
				<fileset
613
					dir="${build.tmp}/eml_${eml-beta4-tag}">
614
					<include name="*.dtd" />
615
				</fileset>
616
				<mapper type="glob" from="eml-*.dtd"
617
					to="eml-*-${eml-beta4-version}.dtd" />
618
			</copy>
619

    
620
			<!--
621
			<copy todir="${style-common-cvsrelpath}" filtering="yes">
622
				<fileset
623
					dir="${build.tmp}/eml_${eml-beta4-tag}/style">
624
					<include name="**/*.xsl" />
625
				</fileset>
626
			</copy>
627
			-->
628
		</target>
629

    
630
	<target name="geteml2+" depends="prepare" if="eml.required"
631
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
632
		<svn>
633
			<export srcUrl="${svn.eml200SchemaUrl}"
634
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
635
		</svn>
636
		<mkdir dir="lib/schema/eml-2.0.0" />
637
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
638
			<fileset
639
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
640
				<include name="*.xsd" />
641
			</fileset>
642

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

    
649
		</copy>
650
		<!-- <antcall target="copyxsl">
651
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
652
			<param name="dirname" value="eml-2.0.0" />
653
			</antcall> -->
654

    
655
		<!-- Checkout eml201 for given schema tag-->
656
		<svn>
657
			<export srcUrl="${svn.eml201SchemaUrl}"
658
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
659
		</svn>
660
		<mkdir dir="lib/schema/eml-2.0.1" />
661
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
662
			<fileset
663
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
664
				<include name="*.xsd" />
665
			</fileset>
666
		</copy>
667

    
668
		<!-- Checkout eml201 again for given style sheet tag-->
669
		<!-- echo>Enter CVS password: </echo>
670
			<cvs cvsRoot="${cvsroot}"
671
			package="${eml-module}"
672
			tag="${eml2_0_1-style-tag}"
673
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
674
			<antcall target="copyxsl">
675
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
676
			<param name="dirname" value="eml-2.0.1" />
677
			</antcall -->
678

    
679
		<!-- Checkout eml210 for given schema tag-->
680
		<svn>
681
			<export srcUrl="${svn.eml210SchemaUrl}"
682
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
683
		</svn>
684
		<mkdir dir="lib/schema/eml-2.1.0" />
685
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
686
			<fileset
687
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
688
				<include name="*.xsd" />
689
			</fileset>
690
		</copy>
691

    
692
		<!-- Checkout eml210 for given style sheet tag-->
693
		<svn>
694
			<export srcUrl="${svn.eml2StyleUrl}"
695
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
696
		</svn>
697
		<antcall target="copyxsl">
698
			<param name="cvs.tagname" value="${eml2-style-tag}" />
699
			<!-- param name="dirname" value="eml-2.1.0" / -->
700
			<param name="dirname" value="eml-2" />
701
		</antcall>
702
		
703
		<!-- Checkout eml210 for given schema tag-->
704
		<svn>
705
			<export srcUrl="${svn.eml211SchemaUrl}"
706
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
707
		</svn>
708
		<mkdir dir="lib/schema/eml-2.1.1" />
709
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
710
			<fileset
711
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
712
				<include name="*.xsd" />
713
			</fileset>
714
		</copy>
715
	</target>
716

    
717
	<target name="copyxsl"
718
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
719

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

    
722
		<copy todir="${style-common-cvsrelpath}/${dirname}"
723
			filtering="yes">
724
			<fileset
725
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
726
				<include name="**/*.xsl" />
727
			</fileset>
728
		</copy>
729

    
730

    
731
		<!-- now copy default css from eml module and put it in style-common-path
732
			dir with a new name, so other skin-specific css can import it if reqd -->
733
		<copy
734
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
735
			tofile="${style-common-cvsrelpath}/${eml-css}" />
736

    
737
	</target>
738

    
739
	<target name="correctEML201Docs" depends="jar"
740
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
741
		<copy todir="${build.dir}" file="lib/metacat.properties"
742
			filtering="yes" />
743
		<java
744
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
745
			<classpath>
746
				<path refid="compile.classpath" />
747
				<fileset dir="${build.dir}">
748
					<include name="${name}.jar" />
749
				</fileset>
750
			</classpath>
751
		</java>
752
	</target>
753

    
754
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
755
		description="Installs spatial option for metacat">
756
		
757
		<copy todir="${dist.dir}">
758
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
759
		</copy>
760

    
761
	</target>
762

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

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

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

    
806

    
807
	</target>
808

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

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

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

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

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

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

    
883
		<echo message="Install Skin completed." />
884
	</target>
885

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1080
		<path id="test.classpath">
1081
			<path refid="compile.classpath" />
1082
			<fileset dir="${build.dir}">
1083
				<include name="${name}.jar" />
1084
				<include name="${name}-client.jar" />
1085
				<include name="harvester.jar" />
1086
			</fileset>
1087
		</path>
1088
		
1089
		<pathconvert pathsep="${line.separator}|  |--" 
1090
		             property="echo.test.classpath"
1091
		             refid="test.classpath">
1092
		</pathconvert>
1093
		<echo message="|--test classpath" />
1094
		<echo message="|  |" />
1095
		<echo message="|  |-- ${echo.test.classpath}" />
1096
		
1097
		<!-- copy and compile the tests into a jar file -->
1098
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1099
			debug="on" includes="**/*.java" encoding="UTF-8">
1100
			<classpath refid="test.classpath" />
1101
		</javac>
1102

    
1103
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1104
			basedir="${build.tests}" >
1105
			<include name="**/*.class"/>
1106
			<include name="**/*.xml"/>
1107
		</jar>	
1108
		
1109
	</target>
1110

    
1111
	<target name="runoneclass" depends="testprep"
1112
		description="Uses the ant to run a class">
1113
		
1114
		<java classname="${classtorun}" fork="true">
1115
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1116
			<classpath>
1117
				<path refid="test.classpath" />
1118
				<fileset dir="${build.dir}">
1119
					<include name="${name}.jar" />
1120
					<include name="${name}-client.jar" />
1121
					<include name="harvester.jar" />
1122
					<include name="${name}-junittests.jar" />
1123
				</fileset>
1124
			</classpath>
1125
		</java>
1126
	</target>
1127
	
1128
	<target name="test" depends="testprep"
1129
		description="Uses the ant junit task to run all JUnit tests">
1130

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

    
1145
			<formatter type="plain" />
1146

    
1147
			<batchtest fork="yes" todir="${build.dir}">
1148
				<fileset dir="${build.tests}">
1149
					<include name="**/*.class" />
1150
					<exclude name="**/MCTestCase.class" />
1151
					<exclude name="**/ClientViewHelperTest.class" />
1152
					<!-- these are not test cases -->
1153
					<exclude name="**/MockCNode.class" />
1154
					<exclude name="**/D1NodeServiceTest.class" />
1155
					<exclude name="**/QueryRunner.class" />
1156
					<exclude name="**/MockObjectPathMap.class" />
1157
					<exclude name="**/HzObjectPathMapTest$1.class" />
1158
					<exclude name="**/HzObjectPathMapTest$2.class" />
1159
				</fileset>
1160
			</batchtest>
1161
		</junit>
1162
	</target>
1163

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

    
1167
		<echo>testtorun: ${testtorun}</echo>
1168

    
1169
		<!-- use the ant "junit" task to run JUnit tests. -->
1170
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1171
			haltonerror="no" showoutput="yes">
1172
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1173
			<classpath>
1174
				<path refid="test.classpath" />
1175
				<fileset dir="${build.dir}">
1176
					<include name="${name}.jar" />
1177
					<include name="${name}-client.jar" />
1178
					<include name="harvester.jar" />
1179
					<include name="${name}-junittests.jar" />
1180
				</fileset>
1181
			</classpath>
1182

    
1183
			<formatter type="plain" />
1184

    
1185
			<batchtest fork="yes" todir="${build.dir}">
1186
				<fileset dir="${build.tests}">
1187
					<include name="**/${testtorun}.class" />
1188
				</fileset>
1189
			</batchtest>
1190
		</junit>
1191
	</target>
1192
	
1193
	<target name="run" depends="testprep"
1194
			description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1195

    
1196
			<echo>testtorun: ${testtorun}</echo>
1197

    
1198
			<!-- use the ant "junit" task to run JUnit tests. -->
1199
			<junit printsummary="yes" haltonfailure="no" fork="yes"
1200
				haltonerror="no" showoutput="yes">
1201
				<jvmarg value="-Dfile.encoding=UTF-8"/>
1202
				<classpath>
1203
					<path refid="test.classpath" />
1204
					<fileset dir="${build.dir}">
1205
						<include name="${name}.jar" />
1206
						<include name="${name}-client.jar" />
1207
						<include name="harvester.jar" />
1208
						<include name="${name}-junittests.jar" />
1209
					</fileset>
1210
				</classpath>
1211

    
1212
				<formatter type="plain" />
1213

    
1214
				<batchtest fork="yes" todir="${build.dir}">
1215
					<fileset dir="${build.tests}">
1216
						<include name="**/${testtorun}.class" />
1217
					</fileset>
1218
				</batchtest>
1219
			</junit>
1220
		</target>
1221

    
1222
	<target name="testharvester" depends="testprep"
1223
		description="Uses the ant junit task to test only the Harvester code">
1224
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1225
			haltonerror="off">
1226
			<classpath>
1227
				<path refid="compile.classpath" />
1228
				<fileset dir="${build.dir}">
1229
					<include name="${name}.jar" />
1230
					<include name="${name}-client.jar" />
1231
					<include name="harvester.jar" />
1232
					<include name="${name}-junittests.jar" />
1233
				</fileset>
1234
			</classpath>
1235
			<formatter type="plain" />
1236
			<batchtest fork="yes" todir="${build.dir}">
1237
				<fileset dir="${build.tests}">
1238
					<include name="**/harvesterClient/*.class" />
1239
				</fileset>
1240
			</batchtest>
1241
		</junit>
1242
	</target>
1243

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

    
1248
		<echo>
1249
			*********************************** Please run ant
1250
			gethttpclient first! ***********************************
1251
		</echo>
1252
		<!-- copy and compile the tests into a jar file -->
1253
		<mkdir dir="${build.metacatnettest}" />
1254
		<javac srcdir="${junitnettestsdir}"
1255
			destdir="${build.metacatnettest}" includes="**/*.java">
1256
			<classpath>
1257
				<path refid="compile.classpath" />
1258
				<fileset dir="${build.dir}">
1259
					<include name="${name}.jar" />
1260
				</fileset>
1261
			</classpath>
1262
		</javac>
1263

    
1264
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1265
			basedir="${build.metacatnettest}" includes="**/*.class" />
1266

    
1267
		<!-- use the ant "junit" task to run JUnit tests. -->
1268
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1269
			haltonerror="no">
1270
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1271
			<classpath>
1272
				<path refid="compile.classpath" />
1273
				<fileset dir="${build.dir}">
1274
					<include name="${name}.jar" />
1275
					<include name="${name}-junitnettests.jar" />
1276
				</fileset>
1277
			</classpath>
1278

    
1279
			<formatter type="plain" />
1280

    
1281
			<batchtest fork="yes" todir="${build.dir}">
1282
				<fileset dir="${build.metacatnettest}">
1283
					<include name="**/*.class" />
1284
				</fileset>
1285
			</batchtest>
1286
		</junit>
1287
	</target>
1288

    
1289
	<target name="cleanweb" depends="clean"
1290
		description="deletes tomcat web context dir and all its contents">
1291
		<delete dir="${installdir}" />
1292
	</target>
1293

    
1294

    
1295
	<target name="clean" depends="init"
1296
		description="deletes build dir and files that can be regenerated form the release">
1297
		<delete dir="${build.dir}" />
1298
		<delete dir="${dist.dir}" />
1299
	</target>
1300

    
1301
	<target name="localclean" depends="clean"
1302
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1303
		<delete file="lib/utilities.jar" />
1304
	</target>
1305

    
1306
	<target name="fullclean" depends="localclean"
1307
		description="deletes code and eml">
1308
		<delete includeEmptyDirs="true" failonerror="false">
1309
			<fileset dir="${style-common-cvsrelpath}">
1310
				<include name="${eml-css}" />
1311
				<include name="eml-*/*.xsl" />
1312
				<include name="eml-*" />
1313
			</fileset>
1314
			<fileset dir="${schema-cvsrelpath}">
1315
				<include name="eml-*/*.xsd" />
1316
			</fileset>
1317
			<fileset dir="${ecogrid-dir}"/>
1318
			<fileset dir="lib/style/common/emlb6toeml2"/>
1319
			<fileset dir="lib/dtd"/>
1320
			<fileset dir="lib/schema"/>
1321
			<fileset dir="${utilitiesdir}"/>
1322
			<fileset dir="${libdir.mvn}"/>
1323
		</delete>
1324
		<!-- clean up the distribution files if they exist-->
1325
		<delete file="./${name}-bin-${release}.tar.gz" />
1326
		<delete file="./${name}-src-${release}.tar.gz" />
1327
		<delete file="./${name}-bin-${release}.zip" />
1328
		<delete file="./${name}-src-${release}.zip" />
1329
	</target>
1330
	
1331
	<target name="documentation" depends="javadoc,admindoc"
1332
	    description="generates Javadoc API documentation and Admin Guide">
1333
    </target>
1334
	
1335
	<target name="admindoc" depends="prepare">
1336
		<!-- Build the administrator's guide, which is a Sphinx RST project
1337
		     For this to succeed, you must have Sphinx installed on your machine
1338
		     See: http://sphinx.pocoo.org/ for details
1339
		     And you must also have the 'make' build tool installed
1340
		-->
1341
		<exec dir="${docdir}/user/metacat" executable="make"> 
1342
		        <arg value="plantuml"/> 
1343
		</exec>
1344
		
1345
		<exec dir="${docdir}/user/metacat" executable="make"> 
1346
		        <arg value="html"/> 
1347
		</exec>
1348
		
1349
    </target>
1350

    
1351
	<target name="javadoc" depends="prepare"
1352
		description="generates Javadoc API documentation">
1353
		<javadoc packagenames="edu.ucsb.nceas.*"
1354
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1355
			version="true" use="true" windowtitle="${Name} API"
1356
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1357
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1358
			<classpath>
1359
				<path refid="compile.classpath" />
1360
			</classpath>
1361
		</javadoc>
1362
	</target>
1363

    
1364
	<target name="dist"
1365
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL,getutilities"
1366
		description="prepares a full release distribution">
1367
		<mkdir dir="${dist.dir}" />
1368
		<delete dir="${ver.dir}" />
1369
		<mkdir dir="${ver.dir}" />
1370
		<copy todir="${ver.dir}">
1371
			<fileset dir="."
1372
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1373
		</copy>
1374
		<copy todir="${ver.dir}" file="build.xml" />
1375
		<copy todir="${ver.dir}" file="build.properties" />
1376

    
1377
		<copy todir="${ver.dir}/docs" filtering="yes">
1378
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1379
		</copy>
1380
		<copy todir="${ver.dir}/docs" filtering="no">
1381
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1382
		</copy>
1383
		<copy todir="${ver.dir}/docs/dev">
1384
			<fileset dir="${build.dir}/docs" />
1385
		</copy>
1386
		<copy todir="${ver.dir}/src">
1387
			<fileset dir="${build.dir}/src" />
1388
		</copy>
1389

    
1390
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1391
		<copy todir="${ver.dir}/test/servertestfiles">
1392
			<fileset dir="./test/servertestfiles" />
1393
		</copy>
1394
	</target>
1395

    
1396
	<target name="fulldist" depends="distbin, distsrc"
1397
			description="full distribution - source and bin"/>
1398
		
1399
	<target name="distbin" depends="build-metacat,war-lsid"
1400
		description="prepares a binary distribution">
1401
		<copy todir="${dist.dir}">
1402
			<fileset dir="./src/scripts" />
1403
		</copy>
1404
		<delete file="./${name}-bin-${release}.zip" />
1405
		<zip zipfile="./${name}-bin-${release}.zip"
1406
			basedir="${dist.dir}" excludes="metacat-*/**" />
1407
		<delete file="./${name}-bin-${release}.tar.gz" />
1408
		<tar tarfile="./${name}-bin-${release}.tar"
1409
			basedir="${dist.dir}" excludes="metacat-*/**" />
1410
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1411
			src="./${name}-bin-${release}.tar" />
1412
		<delete file="./${name}-bin-${release}.tar" />
1413
	</target>
1414

    
1415
	<target name="distsrc" depends="dist"
1416
		description="prepares a source distribution">
1417
		<mkdir dir="${ver.src}" />
1418
		<copy todir="${ver.src}">
1419
			<fileset dir="./src" />
1420
		</copy>
1421
		<mkdir dir="${util.dir}" />
1422
		<copy todir="${util.dir}">
1423
			<fileset dir="${utilitiesdir}" excludes="**/CVS*" />
1424
		</copy>
1425

    
1426
		<mkdir dir="${ecogrid-dist-dir}" />
1427
		<copy todir="${ecogrid-dist-dir}">
1428
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1429
		</copy>
1430

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

    
1433
		<delete file="./${name}-src-${release}.zip" />
1434
		<zip zipfile="./${name}-src-${release}.zip"
1435
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1436
		<delete file="./${name}-src-${release}.tar.gz" />
1437
		<tar tarfile="./${name}-src-${release}.tar"
1438
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1439
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1440
			src="./${name}-src-${release}.tar" />
1441
		<delete file="./${name}-src-${release}.tar" />
1442
		<!--delete dir="${dist.dir}"/ -->
1443
	</target>
1444

    
1445
	<target name="deb-package" depends="distbin"
1446
		description="create a debian installation package">
1447
		<delete dir="${deb.pkg.dir}" />
1448
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1449
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1450
			<fileset dir="./src/scripts/debian"
1451
				includes="control postinst" />
1452
		</copy>
1453

    
1454
		<mkdir
1455
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1456
		<copy
1457
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1458
			filtering="yes">
1459
			<fileset dir="./src/scripts/debian"
1460
				excludes="control postinst" />
1461
		</copy>
1462
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1463

    
1464
		<copy file="${dist.dir}/knb.war"
1465
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1466
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1467
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1468

    
1469
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1470
			failonerror="true">
1471
			<arg line="--build debian" />
1472
		</exec>
1473

    
1474
		<move file="${pkg.dir}/debian.deb"
1475
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1476
	</target>
1477

    
1478
	<target name="stylesheettest">
1479
		<xslt in="${input}" out="eml.html"
1480
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1481
			<param name="displaymodule" expression="${displaymodule}" />
1482
			<param name="docid" expression="${input}" />
1483
			<param name="entitytype" expression="${entitytype}" />
1484
			<param name="entityindex" expression="${entityindex}" />
1485
			<outputproperty name="method" value="html" />
1486
			<outputproperty name="standalone" value="yes" />
1487
			<outputproperty name="encoding" value="iso8859_1" />
1488
			<outputproperty name="indent" value="yes" />
1489
		</xslt>
1490
	</target>
1491

    
1492
	<target name="spatial_option" depends="prepare"
1493
		description=" -- compiles code for the spatial option">
1494

    
1495
		<echo message="Compiling the metatcat shapefile creator" />
1496
		<echo message="using the shapelib at: ${shapelib.dir}" />
1497
		<exec dir="." executable="g++" os="Linux, Unix"
1498
			failonerror="true">
1499
			<arg
1500
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1501
		</exec>
1502

    
1503
		<exec dir="." executable="g++" os="Linux, Unix"
1504
			failonerror="true">
1505
			<arg
1506
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1507
		</exec>
1508
	</target>
1509

    
1510
	<!-- LSID Authority support -->
1511
	<patternset id="lsid.jars">
1512
		<include name="axis.jar" />
1513
		<include name="commons-discovery-0.2.jar" />
1514
		<include name="jaxrpc.jar" />
1515
		<include name="lsid-client-1.1.1.jar" />
1516
		<include name="lsid-server-1.1.1.jar" />
1517
		<include name="saaj.jar" />
1518
		<include name="wsdl4j-1.5.1.jar" />
1519
		<include name="activation.jar" />
1520
		<include name="castor-0.9.5.jar" />
1521
		<include name="dnsjava-1.3.2.jar" />
1522
		<include name="mail.jar" />
1523
		<include name="commons-logging-1.0.4.jar" />
1524
		<!-- These jars may be needed but seem to not actually be,
1525
			so leaving them out for now
1526
			<include name="axis-ant.jar" />
1527
		-->
1528
		<!--<include name="GenCastor.class" />-->
1529
	</patternset>
1530
	<patternset id="lib.jars">
1531
		<include name="log4j-1.2.12.jar" />
1532
		<include name="utilities.jar" />
1533
		<include name="xerces*.jar" />
1534
		<include name="xalan*.jar" />
1535
		<include name="xml-apis*.jar" />
1536
	</patternset>
1537

    
1538
	<path id="lsid.classpath">
1539
		<fileset dir="${lsid.lib.dir}">
1540
			<patternset refid="lsid.jars" />
1541
		</fileset>
1542
		<fileset dir="${lib.dir}">
1543
			<patternset refid="lib.jars" />
1544
		</fileset>
1545
		<fileset dir="${build.dir}">
1546
			<include name="metacat-client.jar" />
1547
			<include name="metacat.jar" />
1548
		</fileset>
1549
	</path>
1550

    
1551
	<filterset id="configFilters">
1552
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1553
			value="${config.hostname}" / -->
1554
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1555
			value="${config.port}" / -->
1556
		<!-- MCD BYE filter token="METADATA_LABELS"
1557
			value="${config.metadataLabelLsid}" / -->
1558
		<!-- MCD BYE filter token="METACAT_SERVER"
1559
			value="${config.metacatserver}" / -->
1560
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1561
			value="${config.lsidauthority}" / -->
1562
	</filterset>
1563

    
1564
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1565
		description="Configure files prior to compilation">
1566
		<mkdir dir="${lsid.build.dir}" />
1567
		<!-- Copy the properties file into the build -->
1568
		<copy file="${conf.dir}/metacat-lsid.properties"
1569
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1570
			overwrite="true">
1571
			<filterset refid="configFilters" />
1572
		</copy>
1573
		<copy file="${conf.dir}/log4j.properties"
1574
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1575
			overwrite="true">
1576
			<filterset refid="configFilters" />
1577
		</copy>
1578
		<!-- Copy config files into the build -->
1579
		<copy todir="${lsid.build.dir}/WEB-INF">
1580
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1581
		</copy>
1582
		<!-- Copy the metadata configuration files into the build -->
1583
		<mkdir
1584
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1585
		<copy
1586
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1587
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1588
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1589
			<filterset refid="configFilters" />
1590
		</copy>
1591
		<!-- Copy services files into the build -->
1592
		<mkdir dir="${lsid.build.dir}/services" />
1593
		<copy todir="${lsid.build.dir}/services">
1594
			<fileset dir="${services.dir}" />
1595
			<filterset refid="configFilters" />
1596
		</copy>
1597
		<!-- Copy axis files into the build -->
1598
		<mkdir dir="${lsid.build.dir}" />
1599
		<copy todir="${lsid.build.dir}">
1600
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1601
		</copy>
1602
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1603
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1604
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1605
		</copy>
1606
	</target>
1607

    
1608
	<target name="compile-lsid" depends="prepare-lsid"
1609
		description="Compile Java sources">
1610
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1611
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1612
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1613
			deprecation="${compile.deprecation}"
1614
			optimize="${compile.optimize}">
1615
			<classpath refid="lsid.classpath" />
1616
		</javac>
1617
	</target>
1618

    
1619
	<target name="war-lsid" depends="compile-lsid"
1620
		description="Create a war file for the application">
1621
		<mkdir dir="${dist.dir}" />
1622
		<war destfile="${dist.dir}/${authority.context}.war"
1623
			webxml="${webinf.dir}/web.xml">
1624
			<fileset dir="${lsid.build.dir}" />
1625
			<lib dir="${lsid.lib.dir}">
1626
				<patternset refid="lsid.jars" />
1627
			</lib>
1628
			<lib dir="${lib.dir}">
1629
				<patternset refid="lib.jars" />
1630
			</lib>
1631
			<lib dir="${lib.dir}">
1632
				<include name="xalan.jar" />
1633
				<include name="xml-apis.jar" />
1634
			</lib>
1635
			<lib dir="${build.dir}">
1636
				<include name="metacat-client.jar" />
1637
			</lib>
1638
		</war>
1639
	</target>
1640

    
1641
	<target name="deploy-lsid" depends="war-lsid"
1642
		description="Deploy LSID war to servlet container">
1643
		<delete dir="${app.deploy.dir}/${authority.context}" />
1644
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1645
		<mkdir dir="${app.deploy.dir}" />
1646
		<copy todir="${app.deploy.dir}">
1647
			<fileset dir="${dist.dir}" />
1648
		</copy>
1649
	</target>
1650
	
1651
	<target name="change-metacat-properties" depends="warPrepare"
1652
        description="Chage some default values of metacat.properties">
1653
       <echo file="${metacat-properties-file}" append="true">
1654
		   configutil.propertiesConfigured=true
1655
		   configutil.authConfigured=true
1656
           configutil.skinsConfigured=true
1657
		   configutil.databaseConfigured=true
1658
		   configutil.geoserverConfigured=true
1659
	   </echo>
1660
  </target>
1661
	
1662
	<!-- This target will use default values in svn metacat.properties to build a configured 
1663
		metacat (except configuti.* properties, they will be set true). Those default settings
1664
		are for a test machine. It may not work on your system-->
1665
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1666
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1667
    </target>
1668

    
1669
	<!-- build metacat-index war -->
1670
	<target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >		
1671
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1672
			<arg value="clean"/>
1673
		</artifact:mvn>
1674
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1675
			<arg value="package"/>
1676
			<!--<arg value="-Dmaven.test.skip=true"/>-->
1677
		</artifact:mvn>
1678
	</target>
1679
	
1680
	<target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >		
1681
		<copy tofile="${dist.dir}/metacat-index.war" >
1682
			<fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1683
		</copy>	
1684
	</target>
1685
	
1686
	<target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >		
1687
		<copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1688
	</target>
1689
	
1690
</project>
(5-5/7)