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-08-01 15:23:37 -0700 (Thu, 01 Aug 2013) $'
11
	*    '$Revision: 8109 $'
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
	<!-- Allow integration with Git projects -->
52
	<macrodef name = "git">
53
	    <attribute name = "command" />
54
	    <attribute name = "dir" default = "" />
55
	    <element name = "args" optional = "true" />
56
	    <sequential>
57
	        <echo message = "git @{command}" />
58
	        <exec executable = "git" dir = "@{dir}">
59
	            <arg value = "@{command}" />
60
	            <args/>
61
	        </exec>
62
	    </sequential>
63
	</macrodef>
64
	<macrodef name = "git-clone-pull">
65
	    <attribute name = "repository" />
66
	    <attribute name = "dest" />
67
	    <sequential>
68
	        <git command = "clone">
69
	            <args>
70
	                <arg value = "@{repository}" />
71
	                <arg value = "@{dest}" />
72
	            </args>
73
	        </git>
74
	        <git command = "pull" dir = "@{dest}" />
75
	    </sequential>
76
	</macrodef>
77
    	
78
	<taskdef resource="axis-tasks.properties"
79
		classpathref="axis.ant.classpath" />
80
	
81
	<!-- Determine if ecogrid should be installed-->
82
	<condition property="enable.ecogrid">
83
		<equals arg1="${install.ecogrid}" arg2="true" />
84
	</condition>
85

    
86
	<!-- Determine if perl should be built-->
87
	<condition property="build.perl">
88
		<equals arg1="${make.perl.code}" arg2="true" />
89
	</condition>
90

    
91
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
92
			property="tomcat.common.exists" />
93

    
94
	<target name="config" depends="setTomcatCommon, setTomcatNoCommon">
95
		<!-- usr for client testing, generally you don't need change-->
96
		<property name="mcuser"
97
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
98
		<property name="mcpassword" value="kepler" />
99
		<property name="mcanotheruser"
100
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
101
		<property name="mcanotherpassword" value="yourpass" />
102
		<property name="piscouser"
103
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
104
		<property name="piscopassword" value="yourpass" />
105
		<property name="lteruser"
106
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
107
		<property name="lterpassword" value="yourpass" />
108

    
109
		<property name="debug" value="on" />
110
		<property name="morphosourcedir" value="../morpho" />
111
		<property name="utilitiesdir" value="../utilities" />
112
		<property name="installdir"
113
			value="${app.deploy.dir}/${metacat.context}" />
114

    
115
		<echo>*********** set jsdk to ${jsdk}</echo>
116
	</target>
117
	
118
	<target name="setTomcatCommon" if="tomcat.common.exists" >
119
		<property name="jsdk"
120
			value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
121
	</target>
122
	
123
	<target name="setTomcatNoCommon" unless="tomcat.common.exists" >
124
		<property name="jsdk"
125
			value="${build.tomcat.dir}/lib/servlet-api.jar" />
126
	</target>
127
	
128
	<target name="init" depends="config, build-metacat-common" unless="init.called">
129
		
130
	    <property name="libdir.mvn" value="lib/maven" />
131
		<mkdir dir="${libdir.mvn}"/>
132
		
133
		<path id="base.classpath">
134
			<pathelement location="${jsdk}" />
135
            <pathelement location="lib" />
136
			
137
			<fileset dir="lib">
138
				<include name="*.jar" />
139
			</fileset>
140
			
141
			<fileset dir="lib/lsid_lib">
142
				<include name="*.jar" />
143
			</fileset>
144

    
145
			<!-- Include everything from maven -->
146
			<fileset dir="${libdir.mvn}">
147
				<include name="*.jar" />
148
			</fileset>
149

    
150
		</path>
151
		
152
		<path id="test.classpath">
153
			<pathelement location="${jsdk}" />
154
			<pathelement location="lib" />
155
			<fileset dir="lib">
156
				<include name="*.jar" />
157
				<exclude name="maven-ant-tasks-2.1.0.jar" />
158
			</fileset>
159
			<fileset dir="lib/lsid_lib">
160
				<include name="*.jar" />
161
			</fileset>
162
			<!-- Include maven -->
163
			<fileset dir="${libdir.mvn}">
164
				<include name="*.jar" />
165
			</fileset>
166
		</path>
167
		
168
		<!-- define the maven tasks -->
169
		<taskdef uri="antlib:org.apache.maven.artifact.ant"
170
			       resource="org/apache/maven/artifact/ant/antlib.xml"
171
			       classpathref="base.classpath" />
172

    
173
	   	<!-- Resolve maven dependencies -->
174
		<artifact:pom id="metacatPom" file="pom.xml" />
175
		<artifact:dependencies filesetId="dependency.fileset" pomrefid="metacatPom" usescope="runtime"/>
176
		<artifact:dependencies pathId="dependency.classpath" pomrefid="metacatPom"/>
177
	   		   	
178
	   	<!-- combine base and dependencies for the classpath -->
179
	   	<path id="compile.classpath">
180
	   		<path refid="base.classpath" />	
181
	   		<path refid="dependency.classpath" />	
182
		</path>
183

    
184
		<!-- It is less likely you'll need to make any changes from here down,
185
			but customization is possible -->
186
		<property name="name" value="metacat" />
187
		<property name="Name" value="MetaCat" />
188
		<property name="debugprefix" value="${Name}:" />
189
		<property name="release" value="${metacat.version}" />
190
		<tstamp>
191
		    <format property="copyrightyear" pattern="yyyy" locale="en,US"/>
192
		</tstamp>
193
		<property name="copyright" value="${copyrightyear} Regents of the University of California" />
194
		<property name="style-common-relpath" value="/style/common" />
195
		<property name="style-shared-relpath" value="/style/shared" />
196
		<property name="schema-relpath" value="/schema" />
197
		<property name="style-common-cvsrelpath"
198
			value="lib${style-common-relpath}" />
199
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
200
		<property name="style-skins-relpath" value="/style/skins" />
201
		<property name="util-module" value="utilities" />
202
		<!--<property name="utilities-tag" value="trunk" />-->
203
		<property name="utilities-tag" value="tags/UTILITIES_1_3_0" />
204
		<property name="seek-tag" value="tags/ECOGRID_1_2_2" />
205
		<property name="eml-module" value="eml" />
206
		<property name="eml-version" value="2.0.0beta6" />
207
		<property name="eml-beta4-version" value="2.0.0beta4" />
208
		<property name="eml-beta-tag"
209
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
210
		<property name="eml-beta4-tag"
211
					value="RELEASE_EML_2_BETA_4" />
212
		<property name="eml2_0_0-schema-tag"
213
			value="RELEASE_EML_2_0_0_UPDATE_1" />
214
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
215
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
216
		<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
217
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_7" />
218
		<property name="eml2_0_0namespace"
219
			value="eml://ecoinformatics.org/eml-2.0.0" />
220
		<property name="eml2_0_1namespace"
221
			value="eml://ecoinformatics.org/eml-2.0.1" />
222
		<property name="eml2_1_0namespace"
223
			value="eml://ecoinformatics.org/eml-2.1.0" />
224
		<property name="eml2_1_1namespace"
225
			value="eml://ecoinformatics.org/eml-2.1.1" />
226
		<property name="stmmlnamespace"
227
			value="http://www.xml-cml.org/schema/stmml" />
228
		<property name="stmml11namespace"
229
			value="http://www.xml-cml.org/schema/stmml-1.1" />
230
		<property name="eml-css" value="eml_xsl.css" />
231
		<property name="eml-module.default.css" value="default.css" />
232
		<property name="systemidserver" value="" />
233
		<property name="html-path" value="" />
234
		<property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
235

    
236

    
237
		<!-- Config for registry variables -->
238
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
239
		<property name="scope" value="obfs" />
240
		<property name="responseForm" value="genericResponse.tmpl" />
241
		<property name="entryForm" value="entryForm.tmpl" />
242
		<property name="guide" value="genericGuide.tmpl" />
243
		<property name="loginForm" value="loginForm.tmpl" />
244
		<property name="confirmData" value="confirmData.tmpl" />
245
		<property name="deleteData" value="deleteData.tmpl" />
246
		<property name="genericHeader" value="genericHeader.tmpl" />
247
		<property name="genericFooter" value="genericFooter.tmpl" />
248

    
249
		<filter token="scope" value="${scope}" />
250
		<filter token="responseForm" value="${responseForm}" />
251
		<filter token="entryForm" value="${entryForm}" />
252
		<filter token="guide" value="${guide}" />
253
		<filter token="loginForm" value="${loginForm}" />
254
		<filter token="confirmData" value="${confirmData}" />
255
		<filter token="deleteData" value="${deleteData}" />
256
		<filter token="genericHeader" value="${genericHeader}" />
257
		<filter token="genericFooter" value="${genericFooter}" />
258
		<filter token="adminname" value="${adminname}" />
259
		<filter token="recipient" value="${recipient}" />
260
		<filter token="metacatVersion" value="${metacat.version}" />
261
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
262
		<filter token="build.context" value="${metacat.context}" />
263

    
264
		<filter token="docrooturl" value="./" />
265
		<filter token="mcuser" value="${mcuser}" />
266
		<filter token="mcpassword" value="${mcpassword}" />
267
		<filter token="mcanotheruser" value="${mcanotheruser}" />
268
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
269
		<filter token="eml-css" value="${eml-css}" />
270
		<filter token="style-skins-relpath"
271
			value="${style-skins-relpath}" />
272
		<filter token="style-common-relpath"
273
			value="${style-common-relpath}" />
274

    
275
		<filter token="eml-version" value="${eml-version}" />
276
		<filter token="eml-beta4-version" value="${eml-beta4-version}" />
277
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
278
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
279
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
280
		<filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
281
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
282
		<filter token="stmml11namespace" value="${stmml11namespace}" />
283
		<filter token="debugprefix" value="${debugprefix}" />
284

    
285
		<filter token="defaultStage" value="${defaultStage}" />
286
		<filter token="defaultHeader" value="${defaultHeader}" />
287
		<filter token="defaultFooter" value="${defaultFooter}" />
288
		<filter token="defaultChangePass" value="${defaultChangePass}" />
289
		<filter token="defaultResetPass" value="${defaultResetPass}" />
290
		<filter token="changePassSuccess" value="${changePassSuccess}" />
291
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
292
		<filter token="registerFailed" value="${registerFailed}" />
293
		<filter token="registerLter" value="${registerLter}" />
294
		<filter token="registerMatch" value="${registerMatch}" />
295
		<filter token="registerSuccess" value="${registerSuccess}" />
296
		<filter token="register" value="${register}" />
297
		<filter token="searchResults" value="${searchResults}" />
298
		<filter token="ldapMainServerFailure"
299
			value="${ldapMainServerFailure}" />
300
		<filter token="lter-user" value="${lteruser}" />
301
		<filter token="lter-pass" value="${lterpassword}" />
302
		<filter token="pisco-user" value="${piscouser}" />
303
		<filter token="pisco-pass" value="${piscopassword}" />
304

    
305

    
306
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
307
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
308
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
309

    
310
		<property name="srcdir" value="./src" />
311
		<property name="lib.dir" value="./lib" />
312
		<property name="docdir" value="./docs" />
313
		<property name="cgidir" value="./cgi-bin" />
314
		<property name="testdir" value="./test" />
315
		<property name="testtorun" value="MNodeServiceTest" />
316
		<property name="junittestsdir"
317
			value="./test/edu/ucsb/nceas/metacattest" />
318
		<property name="junitnettestsdir"
319
			value="./test/edu/ucsb/nceas/metacatnettest" />
320
		<property name="classtorun" value="edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateSystemMetadata" />
321
		<property name="build.dir" value="./build" />
322
		<property name="build.src" value="${build.dir}/src" />
323
		<property name="build.dest" value="${build.dir}/classes" />
324
		<property name="build.samples" value="${build.dir}/samples" />
325
		<property name="build.tests" value="${build.dir}/tests" />
326
		<property name="build.tmp" value="${build.dir}/tmp" />
327
		<property name="build.metacattest"
328
			value="${build.tests}/metacattest" />
329
		<property name="build.metacatnettest"
330
			value="${build.tests}/metacatnettest" />
331
		<property name="build.data" value="${build.dir}/data" />
332
		<property name="build.docs" value="${build.dir}/docs" />
333
		<property name="build.javadocs" value="${build.docs}/api" />
334
		<property name="build.war" value="${build.dir}/war" />
335
		<property name="dist.dir" value="dist" />
336
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
337
		<property name="ver.src" value="${ver.dir}/src" />
338
		<property name="util.dir" value="${dist.dir}/${util-module}" />
339
		<property name="test.dir" value="${dist.dir}/test" />
340
		<!-- directories for creating a Harvest List Editor distribution -->
341
		<property name="dist.dir.hle" value="disthle" />
342
		<property name="ver.dir.hle"
343
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
344
		<property name="pkg.dir" value="./package" />
345
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
346

    
347
		<property name="ecogrid-target-name" value="metacatImpl" />
348
		<property name="ecogrid-module-dest-dir" value=".." />
349
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
350
		<property name="ecogrid-dist-dir"
351
			value="${dist.dir}/${ecogrid-module}" />
352
		<property name="ecogrid-dir"
353
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
354

    
355
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
356

    
357
		<!-- set up svn -->
358
		<property name="svnant.lib" value="lib" />
359
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
360
		<property name="svnClientAdapter.jar"
361
			value="${svnant.lib}/svnClientAdapter.jar" />
362
		<property name="svnjavahl.jar"
363
			value="${svnant.lib}/svnjavahl.jar" />
364
		<property name="svn.utilitiesUrl"
365
			value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
366
		<property name="svn.ecogridUrl"
367
			value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
368
		<property name="svn.emlBetaUrl"
369
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
370
		<property name="svn.emlBeta4Url"
371
					value="https://code.ecoinformatics.org/code/eml/tags/${eml-beta4-tag}" />
372
		<property name="svn.eml200SchemaUrl"
373
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
374
		<property name="svn.eml201SchemaUrl"
375
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
376
		<property name="svn.eml210SchemaUrl"
377
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
378
		<property name="svn.eml211SchemaUrl"
379
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
380
		<property name="svn.eml2StyleUrl"
381
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
382
		
383
		<!-- the git repo -->
384
		<property name="metacatui.git.repository.url"
385
					value="https://github.com/NCEAS/metacatui.git" />
386
		<property name="metacatui.build.dir"
387
					value="${build.dir}/metacatui" />
388
		<property name="metacatui.resources.dir"
389
					value="${metacatui.build.dir}/metacatui/src/main/webapp" />
390
		
391
		<!-- load the svn task -->
392
		<path id="svn.classpath">
393
			<pathelement location="${svnjavahl.jar}" />
394
			<pathelement location="${svnant.jar}" />
395
			<pathelement location="${svnClientAdapter.jar}" />
396
		</path>
397
		<taskdef resource="svntask.properties"
398
			classpathref="svn.classpath" />
399

    
400
		<condition property="utilities.required">
401
			<not>
402
				<available file="lib/utilities.jar" />
403
			</not>				
404
		</condition>
405
		<!-- peer.utilities.required is used when there is no utilities 
406
			directory at ${utilitiesdir} -->
407
		<condition property="peer.utilities.required">
408
			<or>
409
				<not>
410
					<available file="${utilitiesdir}" type="dir" />
411
				</not>
412
			</or>
413
		</condition>
414
		<condition property="eml.required">
415
			<or>
416
				<not>
417
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
418
				</not>
419
				<not>
420
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
421
				</not>
422
				<not>
423
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
424
				</not>
425
				<not>
426
					<available
427
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
428
				</not>
429
			</or>
430
		</condition>
431

    
432
		<condition property="ecogrid.required">
433
			<or>
434
				<not>
435
					<available file="${ecogrid-dir}/build.properties" />
436
				</not>
437
				<not>
438
					<available
439
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
440
				</not>
441
			</or>
442
		</condition>
443
		
444
		<property name="init.called" value="true" />
445

    
446
	</target>
447
	
448
	<target name="resolveDependencies" depends="init" description="retrieve dependencies with maven">
449
			<echo>Moving Maven dependencies (${dependency.fileset}) to ${libdir.mvn} </echo>
450
			<!-- Clear out mvn dir -->
451
			<delete dir="${libdir.mvn}"></delete>
452
			<!-- Copy all dependencies to the correct location. -->
453
			<copy todir="${libdir.mvn}">
454
				<fileset refid="dependency.fileset" />
455
				<!-- This mapper strips off all leading directory information -->
456
				<mapper type="flatten" />
457
			</copy>
458
		</target>
459

    
460
	<target name="prepare" depends="init, resolveDependencies">
461
		<mkdir dir="${build.dir}" />
462
		<mkdir dir="${build.src}" />
463
		<mkdir dir="${build.dest}" />
464
		<mkdir dir="${build.docs}" />
465
		<mkdir dir="${build.javadocs}" />
466
		<mkdir dir="${build.tmp}" />
467

    
468
		<copy todir="${build.src}" filtering="yes">
469
			<fileset dir="${srcdir}">
470
				<include name="edu/**" />
471
				<include name="com/**" />
472
				<include name="org/**" />
473
				<!-- include name="java/**" / -->
474
				<include name="**/*.sql" />
475
				<exclude name="**/CVS*" />
476
				<exclude name="**/.#*" />
477
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
478
			</fileset>
479
		</copy>
480
		<available file="lib/style/common/emlb6toeml2" type="dir"
481
			property="styles.not.needed" />
482
	</target>
483

    
484
	<target name="generateStubs" depends="prepare">
485
		<echo
486
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
487
		<axis-wsdl2java verbose="true" output="${srcdir}"
488
			url="/tmp/KeplerWebService.wsdl" />
489
	</target>
490

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

    
494
		<javac srcdir="${build.src}" destdir="${build.dest}"
495
			debug="${debug}"
496
			excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
497
			<classpath>
498
				<path refid="compile.classpath" />
499
			</classpath>
500
		</javac>
501
	</target>
502

    
503
	<target name="jar" depends="compile,geteml"
504
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
505

    
506
		<delete file="${build.dir}/${name}.jar" />
507
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
508
			excludes="**/protocols/ **/harvesterClient/" />
509
	</target>
510

    
511
	<target name="protocol" depends="compile"
512
		description="Compiles and jars protocol java code to protocol.jar in build dir">
513
		<delete file="${build.dir}/protocol.jar" />
514
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
515
			includes="**/protocols/" />
516
	</target>
517

    
518
	<target name="utilities" depends="config,getpeerutilities"
519
		if="utilities.required">
520
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
521
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
522
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
523
	</target>
524

    
525
	<target name="getpeerutilities" depends="prepare"
526
		if="peer.utilities.required"
527
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
528
		<echo message="Exporting utilities files from svn repository:" />
529
		<svn>
530
			<export srcUrl="${svn.utilitiesUrl}"
531
				destPath="${utilitiesdir}" />
532
		</svn>
533

    
534
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
535
	</target>
536
	
537
	<target name="getutilities" depends="prepare"
538
		description="Checks utility out of svn and copies it to your metacat sandbox">
539
		<svn>
540
			<export srcUrl="${svn.utilitiesUrl}"
541
				destPath="${utilitiesdir}" force="true" />
542
		</svn>
543
	</target>
544

    
545
	<target name="client" depends="utilities, prepare"
546
		description="Compiles metacat-client java code to build dir">
547
		<javac srcdir="${build.src}" destdir="${build.dest}"
548
			includes="edu/ucsb/nceas/metacat/client/*">
549
			<classpath>
550
				<path refid="compile.classpath" />
551
			</classpath>
552
		</javac>
553
	</target>
554

    
555
	<target name="clientjar" depends="client"
556
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
557
		<delete file="${build.dir}/${name}-client.jar" />
558
		<jar jarfile="${build.dir}/${name}-client.jar"
559
			basedir="${build.dest}" includes="**/metacat/client/" />
560
	</target>
561

    
562
	<target name="advancedsearchjar" depends="compile"
563
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
564
		<delete file="${build.dir}/advancedsearch.jar" />
565
		<jar jarfile="${build.dir}/advancedsearch.jar"
566
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
567
	</target>
568

    
569
	<target name="harvester" depends="client"
570
		description="Compiles harvester java code to build dir">
571
		<javac srcdir="${build.src}" destdir="${build.dest}"
572
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
573
			<classpath>
574
				<path refid="compile.classpath" />
575
			</classpath>
576
		</javac>
577
	</target>
578
		
579
	<target name="harvesterjar" depends="harvester"
580
		description="Compiles and jars harvester java code to harvester.jar in build dir">
581
		<delete file="${build.dir}/harvester.jar" />
582
		<jar jarfile="${build.dir}/harvester.jar"
583
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
584
	</target>
585

    
586
	<target name="harvestListEditorDist" depends="harvesterjar"
587
		description="Prepares a distribution of the Harvest List Editor tool">
588
		<mkdir dir="${dist.dir.hle}" />
589
		<delete dir="${ver.dir.hle}" />
590
		<mkdir dir="${ver.dir.hle}" />
591
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
592
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
593
		<copy todir="${ver.dir.hle}"
594
			file="lib/harvester/harvestList.xsd" />
595
		<copy todir="${ver.dir.hle}"
596
			file="lib/harvester/harvestListEditor.bat" />
597
		<copy todir="${ver.dir.hle}"
598
			file="lib/harvester/harvestListEditor.sh" />
599
		<delete file="./harvest-list-editor-${release}.zip" />
600
		<zip zipfile="./harvest-list-editor-${release}.zip"
601
			basedir="${ver.dir.hle}" />
602
		<delete file="./harvest-list-editor-${release}.tar.gz" />
603
		<tar tarfile="./harvest-list-editor-${release}.tar"
604
			basedir="${ver.dir.hle}" />
605
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
606
			src="./harvest-list-editor-${release}.tar" />
607
		<delete file="./harvest-list-editor-${release}.tar" />
608
	</target>
609

    
610
	<target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
611
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
612

    
613
	<target name="getemlpre2" depends="prepare" if="eml.required"
614
		description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
615
		<svn>
616
			<export srcUrl="${svn.emlBetaUrl}"
617
				destPath="${build.tmp}/eml_${eml-beta-tag}" />
618
		</svn>
619
		<mkdir dir="lib/dtd" />
620
		<copy todir="lib/dtd" filtering="yes">
621
			<fileset
622
				dir="${build.tmp}/eml_${eml-beta-tag}">
623
				<include name="*.dtd" />
624
			</fileset>
625
			<mapper type="glob" from="eml-*.dtd"
626
				to="eml-*-${eml-version}.dtd" />
627
		</copy>
628

    
629
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
630
			<fileset
631
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
632
				<include name="**/*.xsl" />
633
			</fileset>
634
		</copy>
635
	</target>
636
	
637
	<target name="getemlpre2beta4" depends="prepare" if="eml.required"
638
			description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
639
			<svn>
640
				<export srcUrl="${svn.emlBeta4Url}"
641
					destPath="${build.tmp}/eml_${eml-beta4-tag}" />
642
			</svn>
643
			<mkdir dir="lib/dtd" />
644
			<copy todir="lib/dtd" filtering="yes">
645
				<fileset
646
					dir="${build.tmp}/eml_${eml-beta4-tag}">
647
					<include name="*.dtd" />
648
				</fileset>
649
				<mapper type="glob" from="eml-*.dtd"
650
					to="eml-*-${eml-beta4-version}.dtd" />
651
			</copy>
652

    
653
			<!--
654
			<copy todir="${style-common-cvsrelpath}" filtering="yes">
655
				<fileset
656
					dir="${build.tmp}/eml_${eml-beta4-tag}/style">
657
					<include name="**/*.xsl" />
658
				</fileset>
659
			</copy>
660
			-->
661
		</target>
662

    
663
	<target name="geteml2+" depends="prepare" if="eml.required"
664
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
665
		<svn>
666
			<export srcUrl="${svn.eml200SchemaUrl}"
667
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
668
		</svn>
669
		<mkdir dir="lib/schema/eml-2.0.0" />
670
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
671
			<fileset
672
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
673
				<include name="*.xsd" />
674
			</fileset>
675

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

    
682
		</copy>
683
		<!-- <antcall target="copyxsl">
684
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
685
			<param name="dirname" value="eml-2.0.0" />
686
			</antcall> -->
687

    
688
		<!-- Checkout eml201 for given schema tag-->
689
		<svn>
690
			<export srcUrl="${svn.eml201SchemaUrl}"
691
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
692
		</svn>
693
		<mkdir dir="lib/schema/eml-2.0.1" />
694
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
695
			<fileset
696
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
697
				<include name="*.xsd" />
698
			</fileset>
699
		</copy>
700

    
701
		<!-- Checkout eml201 again for given style sheet tag-->
702
		<!-- echo>Enter CVS password: </echo>
703
			<cvs cvsRoot="${cvsroot}"
704
			package="${eml-module}"
705
			tag="${eml2_0_1-style-tag}"
706
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
707
			<antcall target="copyxsl">
708
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
709
			<param name="dirname" value="eml-2.0.1" />
710
			</antcall -->
711

    
712
		<!-- Checkout eml210 for given schema tag-->
713
		<svn>
714
			<export srcUrl="${svn.eml210SchemaUrl}"
715
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
716
		</svn>
717
		<mkdir dir="lib/schema/eml-2.1.0" />
718
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
719
			<fileset
720
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
721
				<include name="*.xsd" />
722
			</fileset>
723
		</copy>
724

    
725
		<!-- Checkout eml210 for given style sheet tag-->
726
		<svn>
727
			<export srcUrl="${svn.eml2StyleUrl}"
728
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
729
		</svn>
730
		<antcall target="copyxsl">
731
			<param name="cvs.tagname" value="${eml2-style-tag}" />
732
			<!-- param name="dirname" value="eml-2.1.0" / -->
733
			<param name="dirname" value="eml-2" />
734
		</antcall>
735
		
736
		<!-- Checkout eml210 for given schema tag-->
737
		<svn>
738
			<export srcUrl="${svn.eml211SchemaUrl}"
739
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
740
		</svn>
741
		<mkdir dir="lib/schema/eml-2.1.1" />
742
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
743
			<fileset
744
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
745
				<include name="*.xsd" />
746
			</fileset>
747
		</copy>
748
	</target>
749

    
750
	<target name="copyxsl"
751
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
752

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

    
755
		<copy todir="${style-common-cvsrelpath}/${dirname}"
756
			filtering="yes">
757
			<fileset
758
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
759
				<include name="**/*.xsl" />
760
			</fileset>
761
		</copy>
762

    
763

    
764
		<!-- now copy default css from eml module and put it in style-common-path
765
			dir with a new name, so other skin-specific css can import it if reqd -->
766
		<copy
767
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
768
			tofile="${style-common-cvsrelpath}/${eml-css}" />
769

    
770
	</target>
771

    
772
	<target name="correctEML201Docs" depends="jar"
773
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
774
		<copy todir="${build.dir}" file="lib/metacat.properties"
775
			filtering="yes" />
776
		<java
777
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
778
			<classpath>
779
				<path refid="compile.classpath" />
780
				<fileset dir="${build.dir}">
781
					<include name="${name}.jar" />
782
				</fileset>
783
			</classpath>
784
		</java>
785
	</target>
786

    
787
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
788
		description="Installs spatial option for metacat">
789
		
790
		<copy todir="${dist.dir}">
791
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
792
		</copy>
793

    
794
	</target>
795

    
796
	<target name="install" depends="build-metacat"
797
		description="* Full Install For Development *">
798
		<copy file="${dist.dir}/${metacat.context}.war"
799
			todir="${app.deploy.dir}" />
800
               <!-- <copy file="${dist.dir}/${metacat.context}.war"
801
                        todir="${app.deploy.dir2}" />-->
802
		<delete dir="${app.deploy.dir}/${metacat.context}" />
803
		<!--<delete dir="${app.deploy.dir2}/${metacat.context}" />-->
804
		<copy file="${dist.dir}/geoserver.war"
805
					todir="${app.deploy.dir}" />
806
		<copy file="${dist.dir}/metacat-index.war"
807
					todir="${app.deploy.dir}" />
808
		<tstamp>
809
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
810
		</tstamp>
811
		<echo>Dev install completed at ${NOW}</echo>
812
	</target>
813

    
814
	<target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index"
815
		description="Build Metacat">
816
	</target>
817

    
818
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
819
		if="enable.ecogrid" description="Install Ecogrid Compentent">
820
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
821
			inheritall="false">
822
			<property name="context" value="${metacat.context}" />
823
			<property name="target" value="${ecogrid-target-name}" />
824
		</ant>
825
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
826
			inheritall="false">
827
			<property name="context" value="${metacat.context}" />
828
			<property name="target" value="${ecogrid-target-name}" />
829
			<property name="metacat.dir" value="${basedir}"/>
830
		</ant>
831
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
832
			<webinf dir="${ecogrid-dir}/lib">
833
			<include name="server-config.wsdd"/>
834
			</webinf>
835
			</war -->
836
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
837
			todir="${dist.dir}" overwrite="true" />
838

    
839

    
840
	</target>
841

    
842
	<target name="get-ecogrid" depends="init"
843
		description="Check out ecogrid module" if="ecogrid.required">
844
		<svn>
845
			<export srcUrl="${svn.ecogridUrl}" force="true"
846
				destPath="${ecogrid-dir}" />
847
		</svn>
848
	</target>
849

    
850
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
851
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
852
		<property name="context" value="${metacat.context}"/>
853
		<property name="target" value="${ecogrid-target-name}"/>
854
		<property name="metacat.dir" value="."/>
855
		<property name="hostname" value="${ecogrid.hostname}"/>
856
		<property name="port" value="${config.port}"/>
857
		</ant>
858
		</target -->
859

    
860
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
861
		description="Automately generate wsdd for ecogrid service">
862
		<delete
863
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
864
	</target>
865

    
866
	<target name="install-skin" depends="init"
867
		description="Install a Skin">
868

    
869
		<input message="Please enter name of the skin"
870
			addproperty="skin-name" />
871

    
872
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
873
		<copy todir="${installdir}/style/skins/${skin-name}"
874
			filtering="yes">
875
			<fileset dir="lib/style/skins/${skin-name}">
876
				<exclude name="**/*.png" />
877
				<exclude name="**/*.gif" />
878
				<exclude name="**/*.jpg" />
879
				<exclude name="**/CVS*" />
880
				<exclude name="**/.#*" />
881
			</fileset>
882
		</copy>
883
		<copy todir="${installdir}/style/skins/${skin-name}"
884
			filtering="no">
885
			<fileset dir="lib/style/skins/${skin-name}">
886
				<include name="**/*.png" />
887
				<include name="**/*.gif" />
888
				<include name="**/*.jpg" />
889
				<exclude name="**/CVS*" />
890
				<exclude name="**/.#*" />
891
			</fileset>
892
		</copy>
893
		<copy todir="${installdir}/style/common" filtering="yes">
894
			<fileset dir="lib/style/common">
895
				<include name="*.js" />
896
				<include name="*.jsp" />
897
				<include name="*.css" />
898
				<exclude name="*.png" />
899
				<exclude name="*.gif" />
900
				<exclude name="*.jpg" />
901
				<exclude name="**/CVS*" />
902
				<exclude name="**/.#*" />
903
			</fileset>
904
		</copy>
905
		<!--
906
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
907
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
908
			<fileset dir="lib/style/skins/${skin-name}/images">
909
			<include name="*.png"/>
910
			<include name="*.gif"/>
911
			<include name="*.jpg"/>
912
			</fileset>
913
			</copy>
914
		-->
915

    
916
		<echo message="Install Skin completed." />
917
	</target>
918

    
919
	<target name="war" depends="warPrepare,install-spatial, dist-metacat-index"
920
		description="Create a web archive (WAR) for servlet deployment">
921
		<mkdir dir="${dist.dir}" />
922
		<war destfile="${dist.dir}/${metacat.context}.war"
923
			webxml="${build.war}/web.xml">
924
			<fileset dir="${war.context}" />
925
			<lib dir="${war.lib}" />
926
			<webinf dir="${war.webinf}" />
927
		</war>
928
	</target>
929

    
930
	<target name="warPrepare"
931
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
932
		description="Prepare files for creating a web archive (WAR)">
933

    
934
		<property name="war.lib" value="${build.war}/lib" />
935
		<property name="war.webinf" value="${build.war}/WEB-INF" />
936
		<property name="war.context"
937
			value="${build.war}/${metacat.context}" />
938
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
939
		<property name="war.webinf.scripts"
940
			value="${war.webinf}/scripts" />
941
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
942
		<property name="war.context.docs" value="${war.context}/docs" />
943
		<property name="war.context.temp" value="${war.context}/temp" />
944
		<property name="war.context.templates"
945
			value="${war.context}${style-common-relpath}/templates" />
946
		<mkdir dir="${war.lib}" />
947
		<mkdir dir="${war.webinf}" />
948
		<mkdir dir="${war.context}" />
949
		<mkdir dir="${war.webinf.sql}" />
950
		<mkdir dir="${war.context.cgi}" />
951
		<mkdir dir="${war.context.docs}" />
952
		<mkdir dir="${war.context.temp}" />
953
		<mkdir dir="${war.context.templates}" />
954

    
955
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
956
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
957
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
958
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
959
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
960
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
961
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
962
		<copy todir="${war.lib}" filtering="no">
963
			<fileset dir="lib">
964
				<include name="*.jar" />
965
				<exclude name="maven-ant-tasks*.jar" />
966
			</fileset>
967
			<fileset dir="${libdir.mvn}" />			
968
		</copy>
969
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
970
			tofile="${build.war}/web.xml" / -->
971
		<!-- MCD added next - Remove the tomcat5 reference-->
972
		<copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
973
		<copy file="lib/metacat.properties" todir="${war.webinf}"
974
			filtering="yes" />
975
		<copy file="lib/solrQueryFieldDescriptions.properties" todir="${war.webinf}"/>
976
		<copy file="lib/metacat.properties.metadata.xml"
977
			todir="${war.webinf}" filtering="no" />
978
		<copy file="lib/org.properties.metadata.xml"
979
			todir="${war.webinf}" filtering="no" />
980
		<copy file="lib/auth.properties.metadata.xml"
981
			todir="${war.webinf}" filtering="no" />
982
		<copy todir="${war.webinf}" filtering="yes">
983
			<fileset dir="lib">
984
				<include name="skin.configs/**" />
985
			</fileset>
986
		</copy>
987
		<copy file="lib/log4j.properties" todir="${war.webinf}"
988
			filtering="yes" />
989
		<copy file="lib/hazelcast.xml" todir="${war.webinf}"
990
			filtering="yes" />
991
		<copy file="lib/oa4mp_client.xml" todir="${war.webinf}"
992
			filtering="yes" />
993
		<copy todir="${war.context}" filtering="no">
994
			<fileset dir="lib">
995
				<include name="**/*.jpg" />
996
				<include name="**/*.png" />
997
				<include name="**/*.gif" />
998
				<include name="LiveMap_30/**" />
999
				<include name="oaipmh/**" />
1000
			</fileset>
1001
		</copy>
1002
		<copy todir="${war.context}" filtering="yes">
1003
			<fileset dir="lib">
1004
				<exclude name="*.jar" />
1005
				<exclude name="*.properties" />
1006
				<exclude name="*.metadata.xml" />
1007
				<exclude name="web.xml" />
1008
				<exclude name="**/*.jpg" />
1009
				<exclude name="**/*.png" />
1010
				<exclude name="**/*.gif" />
1011
				<exclude name="lsid_lib/**" />
1012
				<exclude name="lsid_conf/**" />
1013
				<exclude name="LiveMap_30/**" />
1014
				<exclude name="oaipmh/**" />
1015
				<exclude name="maven/**" />
1016
				<exclude name="skin.configs/**" />
1017
				<exclude name="spatial/geoserver/**" />
1018
			</fileset>
1019
		</copy>
1020
		<copy todir="${war.context}" filtering="no">
1021
			<fileset dir="lib">
1022
				<include name="spatial/geoserver/data/**" />
1023
			</fileset>
1024
		</copy>
1025
		<copy todir="${war.context.docs}" filtering="no">
1026
			<fileset dir="${build.docs}" />
1027
		</copy>
1028
		<copy todir="${war.webinf.sql}" filtering="yes">
1029
			<fileset dir="src">
1030
				<include name="**/*.sql" />
1031
			</fileset>
1032
		</copy>
1033
		<copy todir="${war.webinf.scripts}" filtering="yes">
1034
			<fileset dir="src/scripts" />
1035
		</copy>
1036
		<copy todir="${war.webinf.scripts}"
1037
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1038
			failonerror="false" />
1039

    
1040
		<copy file="src/perl/register-dataset.cgi"
1041
			todir="${war.context.cgi}" />
1042
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1043
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1044

    
1045
		<!-- registry cgi section -->
1046
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1047
			used in readDocumentFromMetacat -->
1048
		<!-- TODO MCD copy temp files to actual location using config util?? -->
1049
		<copy todir="${war.context.temp}" filtering="yes">
1050
			<fileset dir="lib/style/common/emlb6toeml2">
1051
				<include name="*.xsl" />
1052
				<include name="*.xml" />
1053
			</fileset>
1054
		</copy>
1055
		<available file="lib/style/common/emlb6toeml2" type="dir"
1056
			property="styles.not.needed" />
1057

    
1058
		<!-- ldap cgi section -->
1059
		<copy todir="${war.context.templates}">
1060
			<fileset dir="lib/style/common/templates">
1061
				<!-- SCW: Copy all files -->
1062
			</fileset>
1063
		</copy>
1064
	</target>
1065

    
1066
	<target name="cgiPrepare" if="build.perl">
1067
		<exec dir="src/perl/Metacat/" executable="make">
1068
			<arg value="clean" />
1069
		</exec>
1070
		<exec dir="src/perl/Metacat/" executable="perl">
1071
			<arg value="Makefile.PL" />
1072
		</exec>
1073
		<exec dir="src/perl/Metacat/" executable="make" />
1074
	</target>
1075

    
1076
	<target name="testPrepare"
1077
		description="Copies test files into the war directories">
1078
		<echo>in testPrepare</echo>
1079
		<property name="war.context.test"
1080
			value="${build.war}/${metacat.context}/test" />
1081
		<mkdir dir="${war.context.test}" />
1082
		<copy todir="${war.context.test}" filtering="yes">
1083
			<fileset dir="test/servertestfiles">
1084
				<include name="*/**" />
1085
			</fileset>
1086
		</copy>
1087
	</target>
1088

    
1089
	<target name="getConversionXSL" depends="prepare"
1090
		unless="styles.not.needed"
1091
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1092

    
1093
		<svn>
1094
			<export srcUrl="${svn.eml2StyleUrl}"
1095
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1096
		</svn>
1097

    
1098
		<mkdir dir="lib/style/common/emlb6toeml2" />
1099
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1100
			<fileset
1101
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1102
				<include name="*.xsl" />
1103
				<include name="*.xml" />
1104
			</fileset>
1105
		</copy>
1106
	</target>
1107

    
1108
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1109
		<mkdir dir="${build.tests}" />
1110
		<copy todir="${build.tests}" encoding="UTF-8">
1111
			<fileset dir="${testdir}">
1112
				<include name="edu/**" />
1113
			</fileset>
1114
		</copy>
1115
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1116

    
1117
		<path id="test.classpath">
1118
			<path refid="compile.classpath" />
1119
			<fileset dir="${build.dir}">
1120
				<include name="${name}.jar" />
1121
				<include name="${name}-client.jar" />
1122
				<include name="harvester.jar" />
1123
			</fileset>
1124
		</path>
1125
		
1126
		<pathconvert pathsep="${line.separator}|  |--" 
1127
		             property="echo.test.classpath"
1128
		             refid="test.classpath">
1129
		</pathconvert>
1130
		<echo message="|--test classpath" />
1131
		<echo message="|  |" />
1132
		<echo message="|  |-- ${echo.test.classpath}" />
1133
		
1134
		<!-- copy and compile the tests into a jar file -->
1135
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1136
			debug="on" includes="**/*.java" encoding="UTF-8">
1137
			<classpath refid="test.classpath" />
1138
		</javac>
1139

    
1140
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1141
			basedir="${build.tests}" >
1142
			<include name="**/*.class"/>
1143
			<include name="**/*.xml"/>
1144
		</jar>	
1145
		
1146
	</target>
1147

    
1148
	<target name="runoneclass" depends="testprep"
1149
		description="Uses the ant to run a class">
1150
		
1151
		<java classname="${classtorun}" fork="true">
1152
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1153
			<classpath>
1154
				<path refid="test.classpath" />
1155
				<fileset dir="${build.dir}">
1156
					<include name="${name}.jar" />
1157
					<include name="${name}-client.jar" />
1158
					<include name="harvester.jar" />
1159
					<include name="${name}-junittests.jar" />
1160
				</fileset>
1161
			</classpath>
1162
		</java>
1163
	</target>
1164
	
1165
	<target name="test" depends="testprep"
1166
		description="Uses the ant junit task to run all JUnit tests">
1167

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

    
1182
			<formatter type="plain" />
1183

    
1184
			<batchtest fork="yes" todir="${build.dir}">
1185
				<fileset dir="${build.tests}">
1186
					<include name="**/*.class" />
1187
					<exclude name="**/MCTestCase.class" />
1188
					<exclude name="**/ClientViewHelperTest.class" />
1189
					<!-- these are not test cases -->
1190
					<exclude name="**/MockCNode.class" />
1191
					<exclude name="**/D1NodeServiceTest.class" />
1192
					<exclude name="**/QueryRunner.class" />
1193
					<exclude name="**/MockObjectPathMap.class" />
1194
					<exclude name="**/HzObjectPathMapTest$1.class" />
1195
					<exclude name="**/HzObjectPathMapTest$2.class" />
1196
				</fileset>
1197
			</batchtest>
1198
		</junit>
1199
	</target>
1200

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

    
1204
		<echo>testtorun: ${testtorun}</echo>
1205

    
1206
		<!-- use the ant "junit" task to run JUnit tests. -->
1207
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1208
			haltonerror="no" showoutput="yes">
1209
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1210
			<classpath>
1211
				<path refid="test.classpath" />
1212
				<fileset dir="${build.dir}">
1213
					<include name="${name}.jar" />
1214
					<include name="${name}-client.jar" />
1215
					<include name="harvester.jar" />
1216
					<include name="${name}-junittests.jar" />
1217
				</fileset>
1218
			</classpath>
1219

    
1220
			<formatter type="plain" />
1221

    
1222
			<batchtest fork="yes" todir="${build.dir}">
1223
				<fileset dir="${build.tests}">
1224
					<include name="**/${testtorun}.class" />
1225
				</fileset>
1226
			</batchtest>
1227
		</junit>
1228
	</target>
1229
	
1230
	<target name="run" depends="testprep"
1231
			description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1232

    
1233
			<echo>testtorun: ${testtorun}</echo>
1234

    
1235
			<!-- use the ant "junit" task to run JUnit tests. -->
1236
			<junit printsummary="yes" haltonfailure="no" fork="yes"
1237
				haltonerror="no" showoutput="yes">
1238
				<jvmarg value="-Dfile.encoding=UTF-8"/>
1239
				<classpath>
1240
					<path refid="test.classpath" />
1241
					<fileset dir="${build.dir}">
1242
						<include name="${name}.jar" />
1243
						<include name="${name}-client.jar" />
1244
						<include name="harvester.jar" />
1245
						<include name="${name}-junittests.jar" />
1246
					</fileset>
1247
				</classpath>
1248

    
1249
				<formatter type="plain" />
1250

    
1251
				<batchtest fork="yes" todir="${build.dir}">
1252
					<fileset dir="${build.tests}">
1253
						<include name="**/${testtorun}.class" />
1254
					</fileset>
1255
				</batchtest>
1256
			</junit>
1257
		</target>
1258

    
1259
	<target name="testharvester" depends="testprep"
1260
		description="Uses the ant junit task to test only the Harvester code">
1261
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1262
			haltonerror="off">
1263
			<classpath>
1264
				<path refid="compile.classpath" />
1265
				<fileset dir="${build.dir}">
1266
					<include name="${name}.jar" />
1267
					<include name="${name}-client.jar" />
1268
					<include name="harvester.jar" />
1269
					<include name="${name}-junittests.jar" />
1270
				</fileset>
1271
			</classpath>
1272
			<formatter type="plain" />
1273
			<batchtest fork="yes" todir="${build.dir}">
1274
				<fileset dir="${build.tests}">
1275
					<include name="**/harvesterClient/*.class" />
1276
				</fileset>
1277
			</batchtest>
1278
		</junit>
1279
	</target>
1280

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

    
1285
		<echo>
1286
			*********************************** Please run ant
1287
			gethttpclient first! ***********************************
1288
		</echo>
1289
		<!-- copy and compile the tests into a jar file -->
1290
		<mkdir dir="${build.metacatnettest}" />
1291
		<javac srcdir="${junitnettestsdir}"
1292
			destdir="${build.metacatnettest}" includes="**/*.java">
1293
			<classpath>
1294
				<path refid="compile.classpath" />
1295
				<fileset dir="${build.dir}">
1296
					<include name="${name}.jar" />
1297
				</fileset>
1298
			</classpath>
1299
		</javac>
1300

    
1301
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1302
			basedir="${build.metacatnettest}" includes="**/*.class" />
1303

    
1304
		<!-- use the ant "junit" task to run JUnit tests. -->
1305
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1306
			haltonerror="no">
1307
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1308
			<classpath>
1309
				<path refid="compile.classpath" />
1310
				<fileset dir="${build.dir}">
1311
					<include name="${name}.jar" />
1312
					<include name="${name}-junitnettests.jar" />
1313
				</fileset>
1314
			</classpath>
1315

    
1316
			<formatter type="plain" />
1317

    
1318
			<batchtest fork="yes" todir="${build.dir}">
1319
				<fileset dir="${build.metacatnettest}">
1320
					<include name="**/*.class" />
1321
				</fileset>
1322
			</batchtest>
1323
		</junit>
1324
	</target>
1325

    
1326
	<target name="cleanweb" depends="clean"
1327
		description="deletes tomcat web context dir and all its contents">
1328
		<delete dir="${installdir}" />
1329
	</target>
1330

    
1331

    
1332
	<target name="clean" depends="init"
1333
		description="deletes build dir and files that can be regenerated form the release">
1334
		<delete dir="${build.dir}" />
1335
		<delete dir="${dist.dir}" />
1336
	</target>
1337

    
1338
	<target name="localclean" depends="clean"
1339
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1340
		<delete file="lib/utilities.jar" />
1341
	</target>
1342

    
1343
	<target name="fullclean" depends="localclean"
1344
		description="deletes code and eml">
1345
		<delete includeEmptyDirs="true" failonerror="false">
1346
			<fileset dir="${style-common-cvsrelpath}">
1347
				<include name="${eml-css}" />
1348
				<include name="eml-*/*.xsl" />
1349
				<include name="eml-*" />
1350
			</fileset>
1351
			<fileset dir="${schema-cvsrelpath}">
1352
				<include name="eml-*/*.xsd" />
1353
			</fileset>
1354
			<fileset dir="${ecogrid-dir}"/>
1355
			<fileset dir="lib/style/common/emlb6toeml2"/>
1356
			<fileset dir="lib/dtd"/>
1357
			<fileset dir="lib/schema"/>
1358
			<fileset dir="${utilitiesdir}"/>
1359
			<fileset dir="${libdir.mvn}"/>
1360
		</delete>
1361
		<!-- clean up the distribution files if they exist-->
1362
		<delete file="./${name}-bin-${release}.tar.gz" />
1363
		<delete file="./${name}-src-${release}.tar.gz" />
1364
		<delete file="./${name}-bin-${release}.zip" />
1365
		<delete file="./${name}-src-${release}.zip" />
1366
	</target>
1367
	
1368
	<target name="documentation" depends="javadoc,admindoc"
1369
	    description="generates Javadoc API documentation and Admin Guide">
1370
    </target>
1371
	
1372
	<target name="admindoc" depends="prepare">
1373
		<!-- Build the administrator's guide, which is a Sphinx RST project
1374
		     For this to succeed, you must have Sphinx installed on your machine
1375
		     See: http://sphinx.pocoo.org/ for details
1376
		     And you must also have the 'make' build tool installed
1377
		-->
1378
		<exec dir="${docdir}/user/metacat" executable="make"> 
1379
		        <arg value="plantuml"/> 
1380
		</exec>
1381
		
1382
		<exec dir="${docdir}/user/metacat" executable="make"> 
1383
		        <arg value="html"/> 
1384
		</exec>
1385
		
1386
    </target>
1387

    
1388
	<target name="javadoc" depends="prepare"
1389
		description="generates Javadoc API documentation">
1390
		<javadoc packagenames="edu.ucsb.nceas.*"
1391
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1392
			version="true" use="true" windowtitle="${Name} API"
1393
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1394
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1395
			<classpath>
1396
				<path refid="compile.classpath" />
1397
			</classpath>
1398
		</javadoc>
1399
	</target>
1400

    
1401
	<target name="dist"
1402
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL,getutilities"
1403
		description="prepares a full release distribution">
1404
		<mkdir dir="${dist.dir}" />
1405
		<delete dir="${ver.dir}" />
1406
		<mkdir dir="${ver.dir}" />
1407
		<copy todir="${ver.dir}">
1408
			<fileset dir="."
1409
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1410
		</copy>
1411
		<copy todir="${ver.dir}" file="build.xml" />
1412
		<copy todir="${ver.dir}" file="build.properties" />
1413

    
1414
		<copy todir="${ver.dir}/docs" filtering="yes">
1415
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1416
		</copy>
1417
		<copy todir="${ver.dir}/docs" filtering="no">
1418
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1419
		</copy>
1420
		<copy todir="${ver.dir}/docs/dev">
1421
			<fileset dir="${build.dir}/docs" />
1422
		</copy>
1423
		<copy todir="${ver.dir}/src">
1424
			<fileset dir="${build.dir}/src" />
1425
		</copy>
1426

    
1427
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1428
		<copy todir="${ver.dir}/test/servertestfiles">
1429
			<fileset dir="./test/servertestfiles" />
1430
		</copy>
1431
	</target>
1432

    
1433
	<target name="fulldist" depends="distbin, distsrc"
1434
			description="full distribution - source and bin"/>
1435
		
1436
	<target name="distbin" depends="build-metacat,war-lsid"
1437
		description="prepares a binary distribution">
1438
		<copy todir="${dist.dir}">
1439
			<fileset dir="./src/scripts" />
1440
		</copy>
1441
		<delete file="./${name}-bin-${release}.zip" />
1442
		<zip zipfile="./${name}-bin-${release}.zip"
1443
			basedir="${dist.dir}" excludes="metacat-*/**" />
1444
		<delete file="./${name}-bin-${release}.tar.gz" />
1445
		<tar tarfile="./${name}-bin-${release}.tar"
1446
			basedir="${dist.dir}" excludes="metacat-*/**" />
1447
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1448
			src="./${name}-bin-${release}.tar" />
1449
		<delete file="./${name}-bin-${release}.tar" />
1450
	</target>
1451

    
1452
	<target name="distsrc" depends="dist"
1453
		description="prepares a source distribution">
1454
		<mkdir dir="${ver.src}" />
1455
		<copy todir="${ver.src}">
1456
			<fileset dir="./src" />
1457
		</copy>
1458
		<mkdir dir="${util.dir}" />
1459
		<copy todir="${util.dir}">
1460
			<fileset dir="${utilitiesdir}" excludes="**/CVS*" />
1461
		</copy>
1462

    
1463
		<mkdir dir="${ecogrid-dist-dir}" />
1464
		<copy todir="${ecogrid-dist-dir}">
1465
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1466
		</copy>
1467

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

    
1470
		<delete file="./${name}-src-${release}.zip" />
1471
		<zip zipfile="./${name}-src-${release}.zip"
1472
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1473
		<delete file="./${name}-src-${release}.tar.gz" />
1474
		<tar tarfile="./${name}-src-${release}.tar"
1475
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1476
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1477
			src="./${name}-src-${release}.tar" />
1478
		<delete file="./${name}-src-${release}.tar" />
1479
		<!--delete dir="${dist.dir}"/ -->
1480
	</target>
1481

    
1482
	<target name="deb-package" depends="distbin"
1483
		description="create a debian installation package">
1484
		<delete dir="${deb.pkg.dir}" />
1485
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1486
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1487
			<fileset dir="./src/scripts/debian"
1488
				includes="control postinst" />
1489
		</copy>
1490

    
1491
		<mkdir
1492
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1493
		<copy
1494
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1495
			filtering="yes">
1496
			<fileset dir="./src/scripts/debian"
1497
				excludes="control postinst" />
1498
		</copy>
1499
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1500

    
1501
		<copy file="${dist.dir}/knb.war"
1502
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1503
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1504
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1505

    
1506
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1507
			failonerror="true">
1508
			<arg line="--build debian" />
1509
		</exec>
1510

    
1511
		<move file="${pkg.dir}/debian.deb"
1512
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1513
	</target>
1514

    
1515
	<target name="stylesheettest">
1516
		<xslt in="${input}" out="eml.html"
1517
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1518
			<param name="displaymodule" expression="${displaymodule}" />
1519
			<param name="docid" expression="${input}" />
1520
			<param name="entitytype" expression="${entitytype}" />
1521
			<param name="entityindex" expression="${entityindex}" />
1522
			<outputproperty name="method" value="html" />
1523
			<outputproperty name="standalone" value="yes" />
1524
			<outputproperty name="encoding" value="iso8859_1" />
1525
			<outputproperty name="indent" value="yes" />
1526
		</xslt>
1527
	</target>
1528

    
1529
	<target name="spatial_option" depends="prepare"
1530
		description=" -- compiles code for the spatial option">
1531

    
1532
		<echo message="Compiling the metatcat shapefile creator" />
1533
		<echo message="using the shapelib at: ${shapelib.dir}" />
1534
		<exec dir="." executable="g++" os="Linux, Unix"
1535
			failonerror="true">
1536
			<arg
1537
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1538
		</exec>
1539

    
1540
		<exec dir="." executable="g++" os="Linux, Unix"
1541
			failonerror="true">
1542
			<arg
1543
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1544
		</exec>
1545
	</target>
1546

    
1547
	<!-- LSID Authority support -->
1548
	<patternset id="lsid.jars">
1549
		<include name="axis.jar" />
1550
		<include name="commons-discovery-0.2.jar" />
1551
		<include name="jaxrpc.jar" />
1552
		<include name="lsid-client-1.1.1.jar" />
1553
		<include name="lsid-server-1.1.1.jar" />
1554
		<include name="saaj.jar" />
1555
		<include name="wsdl4j-1.5.1.jar" />
1556
		<include name="activation.jar" />
1557
		<include name="castor-0.9.5.jar" />
1558
		<include name="dnsjava-1.3.2.jar" />
1559
		<include name="mail.jar" />
1560
		<include name="commons-logging-1.0.4.jar" />
1561
		<!-- These jars may be needed but seem to not actually be,
1562
			so leaving them out for now
1563
			<include name="axis-ant.jar" />
1564
		-->
1565
		<!--<include name="GenCastor.class" />-->
1566
	</patternset>
1567
	<patternset id="lib.jars">
1568
		<include name="log4j-1.2.12.jar" />
1569
		<include name="utilities.jar" />
1570
		<include name="xerces*.jar" />
1571
		<include name="xalan*.jar" />
1572
		<include name="xml-apis*.jar" />
1573
	</patternset>
1574

    
1575
	<path id="lsid.classpath">
1576
		<fileset dir="${lsid.lib.dir}">
1577
			<patternset refid="lsid.jars" />
1578
		</fileset>
1579
		<fileset dir="${lib.dir}">
1580
			<patternset refid="lib.jars" />
1581
		</fileset>
1582
		<fileset dir="${build.dir}">
1583
			<include name="metacat-client.jar" />
1584
			<include name="metacat.jar" />
1585
		</fileset>
1586
	</path>
1587

    
1588
	<filterset id="configFilters">
1589
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1590
			value="${config.hostname}" / -->
1591
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1592
			value="${config.port}" / -->
1593
		<!-- MCD BYE filter token="METADATA_LABELS"
1594
			value="${config.metadataLabelLsid}" / -->
1595
		<!-- MCD BYE filter token="METACAT_SERVER"
1596
			value="${config.metacatserver}" / -->
1597
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1598
			value="${config.lsidauthority}" / -->
1599
	</filterset>
1600

    
1601
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1602
		description="Configure files prior to compilation">
1603
		<mkdir dir="${lsid.build.dir}" />
1604
		<!-- Copy the properties file into the build -->
1605
		<copy file="${conf.dir}/metacat-lsid.properties"
1606
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1607
			overwrite="true">
1608
			<filterset refid="configFilters" />
1609
		</copy>
1610
		<copy file="${conf.dir}/log4j.properties"
1611
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1612
			overwrite="true">
1613
			<filterset refid="configFilters" />
1614
		</copy>
1615
		<!-- Copy config files into the build -->
1616
		<copy todir="${lsid.build.dir}/WEB-INF">
1617
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1618
		</copy>
1619
		<!-- Copy the metadata configuration files into the build -->
1620
		<mkdir
1621
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1622
		<copy
1623
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1624
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1625
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1626
			<filterset refid="configFilters" />
1627
		</copy>
1628
		<!-- Copy services files into the build -->
1629
		<mkdir dir="${lsid.build.dir}/services" />
1630
		<copy todir="${lsid.build.dir}/services">
1631
			<fileset dir="${services.dir}" />
1632
			<filterset refid="configFilters" />
1633
		</copy>
1634
		<!-- Copy axis files into the build -->
1635
		<mkdir dir="${lsid.build.dir}" />
1636
		<copy todir="${lsid.build.dir}">
1637
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1638
		</copy>
1639
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1640
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1641
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1642
		</copy>
1643
	</target>
1644

    
1645
	<target name="compile-lsid" depends="prepare-lsid"
1646
		description="Compile Java sources">
1647
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1648
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1649
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1650
			deprecation="${compile.deprecation}"
1651
			optimize="${compile.optimize}">
1652
			<classpath>
1653
				<path refid="compile.classpath" />
1654
				<fileset dir="${build.dir}">
1655
					<include name="${name}.jar" />
1656
				</fileset>
1657
			</classpath>
1658
		</javac>
1659
	</target>
1660

    
1661
	<target name="war-lsid" depends="compile-lsid"
1662
		description="Create a war file for the application">
1663
		<mkdir dir="${dist.dir}" />
1664
		<war destfile="${dist.dir}/${authority.context}.war"
1665
			webxml="${webinf.dir}/web.xml">
1666
			<fileset dir="${lsid.build.dir}" />
1667
			<lib dir="${lsid.lib.dir}">
1668
				<patternset refid="lsid.jars" />
1669
			</lib>
1670
			<lib dir="${lib.dir}">
1671
				<patternset refid="lib.jars" />
1672
			</lib>
1673
			<lib dir="${lib.dir}">
1674
				<include name="xalan.jar" />
1675
				<include name="xml-apis.jar" />
1676
			</lib>
1677
			<lib dir="${build.dir}">
1678
				<include name="metacat-client.jar" />
1679
			</lib>
1680
		</war>
1681
	</target>
1682

    
1683
	<target name="deploy-lsid" depends="war-lsid"
1684
		description="Deploy LSID war to servlet container">
1685
		<delete dir="${app.deploy.dir}/${authority.context}" />
1686
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1687
		<mkdir dir="${app.deploy.dir}" />
1688
		<copy todir="${app.deploy.dir}">
1689
			<fileset dir="${dist.dir}" />
1690
		</copy>
1691
	</target>
1692
	
1693
	<target name="change-metacat-properties" depends="warPrepare"
1694
        description="Chage some default values of metacat.properties">
1695
       <echo file="${metacat-properties-file}" append="true">
1696
		   configutil.propertiesConfigured=true
1697
		   configutil.authConfigured=true
1698
           configutil.skinsConfigured=true
1699
		   configutil.databaseConfigured=true
1700
		   configutil.geoserverConfigured=true
1701
	   </echo>
1702
  </target>
1703
	
1704
	<!-- This target will use default values in svn metacat.properties to build a configured 
1705
		metacat (except configuti.* properties, they will be set true). Those default settings
1706
		are for a test machine. It may not work on your system-->
1707
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1708
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1709
    </target>
1710
	
1711
	<!-- build metacat-common jar -->
1712
	<target name="build-metacat-common" description="Calls the Maven build for metacat-common jar" unless="build-metacat-common-called" >
1713
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1714
		            <arg value="clean"/>
1715
		</artifact:mvn>
1716
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1717
		   <arg value="install"/>
1718
		</artifact:mvn>
1719
		<property name="build-metacat-common-called" value="true"/>
1720
	</target>
1721

    
1722
	<!-- build metacat-index war -->
1723
	<target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >		
1724
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1725
			<arg value="clean"/>
1726
		</artifact:mvn>
1727
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1728
			<arg value="package"/>
1729
			<!--<arg value="-Dmaven.test.skip=true"/>-->
1730
		</artifact:mvn>
1731
	</target>
1732
	
1733
	<target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >		
1734
		<copy tofile="${dist.dir}/metacat-index.war" >
1735
			<fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1736
		</copy>	
1737
	</target>
1738
	
1739
	<target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >		
1740
		<copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1741
	</target>
1742
	
1743
</project>
(5-5/7)