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-09-09 15:05:24 -0700 (Mon, 09 Sep 2013) $'
11
	*    '$Revision: 8174 $'
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
	<!-- get metacatUI project -->
79
	<target name="getMetacatUI" depends="init">
80
		<git-clone-pull repository="${metacatui.git.repository.url}" dest="${metacatui.build.dir}" />
81
	</target>
82
	
83
	<target name="build-metacat-ui" description="Calls the Maven build for metacatUI war" depends="getMetacatUI" >
84
		<artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
85
			<arg value="clean"/>
86
		</artifact:mvn>
87
		<artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
88
		   <arg value="package"/>
89
		</artifact:mvn>
90
	</target>
91
	
92
	<target name="dist-metacat-ui" depends="build-metacat-ui">
93
		<copy tofile="${dist.dir}/metacatui.war" >
94
			<fileset dir="${metacatui.build.dir}/metacatui/target" includes="*.war"></fileset>
95
		</copy>	
96
	</target>
97
    	
98
	<taskdef resource="axis-tasks.properties"
99
		classpathref="axis.ant.classpath" />
100
	
101
	<!-- Determine if ecogrid should be installed-->
102
	<condition property="enable.ecogrid">
103
		<equals arg1="${install.ecogrid}" arg2="true" />
104
	</condition>
105

    
106
	<!-- Determine if perl should be built-->
107
	<condition property="build.perl">
108
		<equals arg1="${make.perl.code}" arg2="true" />
109
	</condition>
110

    
111
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
112
			property="tomcat.common.exists" />
113

    
114
	<target name="config" depends="setTomcatCommon, setTomcatNoCommon">
115
		<!-- usr for client testing, generally you don't need change-->
116
		<property name="mcuser"
117
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
118
		<property name="mcpassword" value="kepler" />
119
		<property name="mcanotheruser"
120
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
121
		<property name="mcanotherpassword" value="yourpass" />
122
		<property name="piscouser"
123
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
124
		<property name="piscopassword" value="yourpass" />
125
		<property name="lteruser"
126
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
127
		<property name="lterpassword" value="yourpass" />
128

    
129
		<property name="debug" value="on" />
130
		<property name="morphosourcedir" value="../morpho" />
131
		<property name="utilitiesdir" value="../utilities" />
132
		<property name="installdir"
133
			value="${app.deploy.dir}/${metacat.context}" />
134

    
135
		<echo>*********** set jsdk to ${jsdk}</echo>
136
	</target>
137
	
138
	<target name="setTomcatCommon" if="tomcat.common.exists" >
139
		<property name="jsdk"
140
			value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
141
	</target>
142
	
143
	<target name="setTomcatNoCommon" unless="tomcat.common.exists" >
144
		<property name="jsdk"
145
			value="${build.tomcat.dir}/lib/servlet-api.jar" />
146
	</target>
147
	
148
	<target name="init" depends="config, build-metacat-common" unless="init.called">
149
		
150
	    <property name="libdir.mvn" value="lib/maven" />
151
		<mkdir dir="${libdir.mvn}"/>
152
		
153
		<path id="base.classpath">
154
			<pathelement location="${jsdk}" />
155
            <pathelement location="lib" />
156
			
157
			<fileset dir="lib">
158
				<include name="*.jar" />
159
			</fileset>
160
			
161
			<fileset dir="lib/lsid_lib">
162
				<include name="*.jar" />
163
			</fileset>
164

    
165
			<!-- Include everything from maven -->
166
			<fileset dir="${libdir.mvn}">
167
				<include name="*.jar" />
168
			</fileset>
169

    
170
		</path>
171
		
172
		<path id="test.classpath">
173
			<pathelement location="${jsdk}" />
174
			<pathelement location="lib" />
175
			<fileset dir="lib">
176
				<include name="*.jar" />
177
				<exclude name="maven-ant-tasks-2.1.0.jar" />
178
			</fileset>
179
			<fileset dir="lib/lsid_lib">
180
				<include name="*.jar" />
181
			</fileset>
182
			<!-- Include maven -->
183
			<fileset dir="${libdir.mvn}">
184
				<include name="*.jar" />
185
			</fileset>
186
		</path>
187
		
188
		<!-- define the maven tasks -->
189
		<taskdef uri="antlib:org.apache.maven.artifact.ant"
190
			       resource="org/apache/maven/artifact/ant/antlib.xml"
191
			       classpathref="base.classpath" />
192

    
193
	   	<!-- Resolve maven dependencies -->
194
		<artifact:pom id="metacatPom" file="pom.xml" />
195
		<artifact:dependencies filesetId="dependency.fileset" pomrefid="metacatPom" usescope="runtime"/>
196
		<artifact:dependencies pathId="dependency.classpath" pomrefid="metacatPom"/>
197
	   		   	
198
	   	<!-- combine base and dependencies for the classpath -->
199
	   	<path id="compile.classpath">
200
	   		<path refid="base.classpath" />	
201
	   		<path refid="dependency.classpath" />	
202
		</path>
203

    
204
		<!-- It is less likely you'll need to make any changes from here down,
205
			but customization is possible -->
206
		<property name="name" value="metacat" />
207
		<property name="Name" value="MetaCat" />
208
		<property name="debugprefix" value="${Name}:" />
209
		<property name="release" value="${metacat.version}" />
210
		<tstamp>
211
		    <format property="copyrightyear" pattern="yyyy" locale="en,US"/>
212
		</tstamp>
213
		<property name="copyright" value="${copyrightyear} Regents of the University of California" />
214
		<property name="style-common-relpath" value="/style/common" />
215
		<property name="style-shared-relpath" value="/style/shared" />
216
		<property name="schema-relpath" value="/schema" />
217
		<property name="style-common-cvsrelpath"
218
			value="lib${style-common-relpath}" />
219
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
220
		<property name="style-skins-relpath" value="/style/skins" />
221
		<property name="util-module" value="utilities" />
222
		<!--<property name="utilities-tag" value="trunk" />-->
223
		<property name="utilities-tag" value="tags/UTILITIES_1_3_0" />
224
		<property name="seek-tag" value="tags/ECOGRID_1_2_2" />
225
		<property name="eml-module" value="eml" />
226
		<property name="eml-version" value="2.0.0beta6" />
227
		<property name="eml-beta4-version" value="2.0.0beta4" />
228
		<property name="eml-beta-tag"
229
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
230
		<property name="eml-beta4-tag"
231
					value="RELEASE_EML_2_BETA_4" />
232
		<property name="eml2_0_0-schema-tag"
233
			value="RELEASE_EML_2_0_0_UPDATE_1" />
234
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
235
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
236
		<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
237
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_7" />
238
		<property name="eml2_0_0namespace"
239
			value="eml://ecoinformatics.org/eml-2.0.0" />
240
		<property name="eml2_0_1namespace"
241
			value="eml://ecoinformatics.org/eml-2.0.1" />
242
		<property name="eml2_1_0namespace"
243
			value="eml://ecoinformatics.org/eml-2.1.0" />
244
		<property name="eml2_1_1namespace"
245
			value="eml://ecoinformatics.org/eml-2.1.1" />
246
		<property name="stmmlnamespace"
247
			value="http://www.xml-cml.org/schema/stmml" />
248
		<property name="stmml11namespace"
249
			value="http://www.xml-cml.org/schema/stmml-1.1" />
250
		<property name="eml-css" value="eml_xsl.css" />
251
		<property name="eml-module.default.css" value="default.css" />
252
		<property name="systemidserver" value="" />
253
		<property name="html-path" value="" />
254
		<property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
255

    
256

    
257
		<!-- Config for registry variables -->
258
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
259
		<property name="scope" value="obfs" />
260
		<property name="responseForm" value="genericResponse.tmpl" />
261
		<property name="entryForm" value="entryForm.tmpl" />
262
		<property name="guide" value="genericGuide.tmpl" />
263
		<property name="loginForm" value="loginForm.tmpl" />
264
		<property name="confirmData" value="confirmData.tmpl" />
265
		<property name="deleteData" value="deleteData.tmpl" />
266
		<property name="genericHeader" value="genericHeader.tmpl" />
267
		<property name="genericFooter" value="genericFooter.tmpl" />
268

    
269
		<filter token="scope" value="${scope}" />
270
		<filter token="responseForm" value="${responseForm}" />
271
		<filter token="entryForm" value="${entryForm}" />
272
		<filter token="guide" value="${guide}" />
273
		<filter token="loginForm" value="${loginForm}" />
274
		<filter token="confirmData" value="${confirmData}" />
275
		<filter token="deleteData" value="${deleteData}" />
276
		<filter token="genericHeader" value="${genericHeader}" />
277
		<filter token="genericFooter" value="${genericFooter}" />
278
		<filter token="adminname" value="${adminname}" />
279
		<filter token="recipient" value="${recipient}" />
280
		<filter token="metacatVersion" value="${metacat.version}" />
281
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
282
		<filter token="build.context" value="${metacat.context}" />
283

    
284
		<filter token="docrooturl" value="./" />
285
		<filter token="mcuser" value="${mcuser}" />
286
		<filter token="mcpassword" value="${mcpassword}" />
287
		<filter token="mcanotheruser" value="${mcanotheruser}" />
288
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
289
		<filter token="eml-css" value="${eml-css}" />
290
		<filter token="style-skins-relpath"
291
			value="${style-skins-relpath}" />
292
		<filter token="style-common-relpath"
293
			value="${style-common-relpath}" />
294

    
295
		<filter token="eml-version" value="${eml-version}" />
296
		<filter token="eml-beta4-version" value="${eml-beta4-version}" />
297
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
298
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
299
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
300
		<filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
301
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
302
		<filter token="stmml11namespace" value="${stmml11namespace}" />
303
		<filter token="debugprefix" value="${debugprefix}" />
304

    
305
		<filter token="defaultStage" value="${defaultStage}" />
306
		<filter token="defaultHeader" value="${defaultHeader}" />
307
		<filter token="defaultFooter" value="${defaultFooter}" />
308
		<filter token="defaultChangePass" value="${defaultChangePass}" />
309
		<filter token="defaultResetPass" value="${defaultResetPass}" />
310
		<filter token="changePassSuccess" value="${changePassSuccess}" />
311
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
312
		<filter token="registerFailed" value="${registerFailed}" />
313
		<filter token="registerLter" value="${registerLter}" />
314
		<filter token="registerMatch" value="${registerMatch}" />
315
		<filter token="registerSuccess" value="${registerSuccess}" />
316
		<filter token="register" value="${register}" />
317
		<filter token="searchResults" value="${searchResults}" />
318
		<filter token="ldapMainServerFailure"
319
			value="${ldapMainServerFailure}" />
320
		<filter token="lter-user" value="${lteruser}" />
321
		<filter token="lter-pass" value="${lterpassword}" />
322
		<filter token="pisco-user" value="${piscouser}" />
323
		<filter token="pisco-pass" value="${piscopassword}" />
324

    
325

    
326
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
327
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
328
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
329

    
330
		<property name="srcdir" value="./src" />
331
		<property name="lib.dir" value="./lib" />
332
		<property name="docdir" value="./docs" />
333
		<property name="cgidir" value="./cgi-bin" />
334
		<property name="testdir" value="./test" />
335
		<property name="testtorun" value="MNodeServiceTest" />
336
		<property name="junittestsdir"
337
			value="./test/edu/ucsb/nceas/metacattest" />
338
		<property name="junitnettestsdir"
339
			value="./test/edu/ucsb/nceas/metacatnettest" />
340
		<property name="classtorun" value="edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateSystemMetadata" />
341
		<property name="build.dir" value="./build" />
342
		<property name="build.src" value="${build.dir}/src" />
343
		<property name="build.dest" value="${build.dir}/classes" />
344
		<property name="build.samples" value="${build.dir}/samples" />
345
		<property name="build.tests" value="${build.dir}/tests" />
346
		<property name="build.tmp" value="${build.dir}/tmp" />
347
		<property name="build.metacattest"
348
			value="${build.tests}/metacattest" />
349
		<property name="build.metacatnettest"
350
			value="${build.tests}/metacatnettest" />
351
		<property name="build.data" value="${build.dir}/data" />
352
		<property name="build.docs" value="${build.dir}/docs" />
353
		<property name="build.javadocs" value="${build.docs}/api" />
354
		<property name="build.war" value="${build.dir}/war" />
355
		<property name="dist.dir" value="dist" />
356
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
357
		<property name="ver.src" value="${ver.dir}/src" />
358
		<property name="util.dir" value="${dist.dir}/${util-module}" />
359
		<property name="test.dir" value="${dist.dir}/test" />
360
		<!-- directories for creating a Harvest List Editor distribution -->
361
		<property name="dist.dir.hle" value="disthle" />
362
		<property name="ver.dir.hle"
363
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
364
		<property name="pkg.dir" value="./package" />
365
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
366

    
367
		<property name="ecogrid-target-name" value="metacatImpl" />
368
		<property name="ecogrid-module-dest-dir" value=".." />
369
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
370
		<property name="ecogrid-dist-dir"
371
			value="${dist.dir}/${ecogrid-module}" />
372
		<property name="ecogrid-dir"
373
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
374

    
375
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
376

    
377
		<!-- set up svn -->
378
		<property name="svnant.lib" value="lib" />
379
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
380
		<property name="svnClientAdapter.jar"
381
			value="${svnant.lib}/svnClientAdapter.jar" />
382
		<property name="svnjavahl.jar"
383
			value="${svnant.lib}/svnjavahl.jar" />
384
		<property name="svn.utilitiesUrl"
385
			value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
386
		<property name="svn.ecogridUrl"
387
			value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
388
		<property name="svn.emlBetaUrl"
389
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
390
		<property name="svn.emlBeta4Url"
391
					value="https://code.ecoinformatics.org/code/eml/tags/${eml-beta4-tag}" />
392
		<property name="svn.eml200SchemaUrl"
393
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
394
		<property name="svn.eml201SchemaUrl"
395
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
396
		<property name="svn.eml210SchemaUrl"
397
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
398
		<property name="svn.eml211SchemaUrl"
399
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
400
		<property name="svn.eml2StyleUrl"
401
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
402
		
403
		<!-- the git repo -->
404
		<property name="metacatui.git.repository.url"
405
					value="https://github.com/NCEAS/metacatui.git" />
406
		<property name="metacatui.build.dir"
407
					value="${build.dir}/metacatui" />
408
		<property name="metacatui.resources.dir"
409
					value="${metacatui.build.dir}/metacatui/src/main/webapp" />
410
		
411
		<!-- load the svn task -->
412
		<path id="svn.classpath">
413
			<pathelement location="${svnjavahl.jar}" />
414
			<pathelement location="${svnant.jar}" />
415
			<pathelement location="${svnClientAdapter.jar}" />
416
		</path>
417
		<taskdef resource="svntask.properties"
418
			classpathref="svn.classpath" />
419

    
420
		<condition property="utilities.required">
421
			<not>
422
				<available file="lib/utilities.jar" />
423
			</not>				
424
		</condition>
425
		<!-- peer.utilities.required is used when there is no utilities 
426
			directory at ${utilitiesdir} -->
427
		<condition property="peer.utilities.required">
428
			<or>
429
				<not>
430
					<available file="${utilitiesdir}" type="dir" />
431
				</not>
432
			</or>
433
		</condition>
434
		<condition property="eml.required">
435
			<or>
436
				<not>
437
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
438
				</not>
439
				<not>
440
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
441
				</not>
442
				<not>
443
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
444
				</not>
445
				<not>
446
					<available
447
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
448
				</not>
449
			</or>
450
		</condition>
451

    
452
		<condition property="ecogrid.required">
453
			<or>
454
				<not>
455
					<available file="${ecogrid-dir}/build.properties" />
456
				</not>
457
				<not>
458
					<available
459
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
460
				</not>
461
			</or>
462
		</condition>
463
		
464
		<property name="init.called" value="true" />
465

    
466
	</target>
467
	
468
	<target name="resolveDependencies" depends="init" description="retrieve dependencies with maven">
469
			<echo>Moving Maven dependencies (${dependency.fileset}) to ${libdir.mvn} </echo>
470
			<!-- Clear out mvn dir -->
471
			<delete dir="${libdir.mvn}"></delete>
472
			<!-- Copy all dependencies to the correct location. -->
473
			<copy todir="${libdir.mvn}">
474
				<fileset refid="dependency.fileset" />
475
				<!-- This mapper strips off all leading directory information -->
476
				<mapper type="flatten" />
477
			</copy>
478
		</target>
479

    
480
	<target name="prepare" depends="init, resolveDependencies">
481
		<mkdir dir="${build.dir}" />
482
		<mkdir dir="${build.src}" />
483
		<mkdir dir="${build.dest}" />
484
		<mkdir dir="${build.docs}" />
485
		<mkdir dir="${build.javadocs}" />
486
		<mkdir dir="${build.tmp}" />
487

    
488
		<copy todir="${build.src}" filtering="yes">
489
			<fileset dir="${srcdir}">
490
				<include name="edu/**" />
491
				<include name="com/**" />
492
				<include name="org/**" />
493
				<!-- include name="java/**" / -->
494
				<include name="**/*.sql" />
495
				<exclude name="**/CVS*" />
496
				<exclude name="**/.#*" />
497
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
498
			</fileset>
499
		</copy>
500
		<available file="lib/style/common/emlb6toeml2" type="dir"
501
			property="styles.not.needed" />
502
	</target>
503

    
504
	<target name="generateStubs" depends="prepare">
505
		<echo
506
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
507
		<axis-wsdl2java verbose="true" output="${srcdir}"
508
			url="/tmp/KeplerWebService.wsdl" />
509
	</target>
510

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

    
514
		<javac srcdir="${build.src}" destdir="${build.dest}"
515
			debug="${debug}"
516
			excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
517
			<classpath>
518
				<path refid="compile.classpath" />
519
			</classpath>
520
		</javac>
521
	</target>
522

    
523
	<target name="jar" depends="compile,geteml"
524
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
525

    
526
		<delete file="${build.dir}/${name}.jar" />
527
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
528
			excludes="**/protocols/ **/harvesterClient/" />
529
	</target>
530

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

    
538
	<target name="utilities" depends="config,getpeerutilities"
539
		if="utilities.required">
540
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
541
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
542
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
543
	</target>
544

    
545
	<target name="getpeerutilities" depends="prepare"
546
		if="peer.utilities.required"
547
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
548
		<echo message="Exporting utilities files from svn repository:" />
549
		<svn>
550
			<export srcUrl="${svn.utilitiesUrl}"
551
				destPath="${utilitiesdir}" />
552
		</svn>
553

    
554
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
555
	</target>
556
	
557
	<target name="getutilities" depends="prepare"
558
		description="Checks utility out of svn and copies it to your metacat sandbox">
559
		<svn>
560
			<export srcUrl="${svn.utilitiesUrl}"
561
				destPath="${utilitiesdir}" force="true" />
562
		</svn>
563
	</target>
564

    
565
	<target name="client" depends="utilities, prepare"
566
		description="Compiles metacat-client java code to build dir">
567
		<javac srcdir="${build.src}" destdir="${build.dest}"
568
			includes="edu/ucsb/nceas/metacat/client/*">
569
			<classpath>
570
				<path refid="compile.classpath" />
571
			</classpath>
572
		</javac>
573
	</target>
574

    
575
	<target name="clientjar" depends="client"
576
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
577
		<delete file="${build.dir}/${name}-client.jar" />
578
		<jar jarfile="${build.dir}/${name}-client.jar"
579
			basedir="${build.dest}" includes="**/metacat/client/" />
580
	</target>
581

    
582
	<target name="advancedsearchjar" depends="compile"
583
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
584
		<delete file="${build.dir}/advancedsearch.jar" />
585
		<jar jarfile="${build.dir}/advancedsearch.jar"
586
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
587
	</target>
588

    
589
	<target name="harvester" depends="client"
590
		description="Compiles harvester java code to build dir">
591
		<javac srcdir="${build.src}" destdir="${build.dest}"
592
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
593
			<classpath>
594
				<path refid="compile.classpath" />
595
			</classpath>
596
		</javac>
597
	</target>
598
		
599
	<target name="harvesterjar" depends="harvester"
600
		description="Compiles and jars harvester java code to harvester.jar in build dir">
601
		<delete file="${build.dir}/harvester.jar" />
602
		<jar jarfile="${build.dir}/harvester.jar"
603
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
604
	</target>
605

    
606
	<target name="harvestListEditorDist" depends="harvesterjar"
607
		description="Prepares a distribution of the Harvest List Editor tool">
608
		<mkdir dir="${dist.dir.hle}" />
609
		<delete dir="${ver.dir.hle}" />
610
		<mkdir dir="${ver.dir.hle}" />
611
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
612
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
613
		<copy todir="${ver.dir.hle}"
614
			file="lib/harvester/harvestList.xsd" />
615
		<copy todir="${ver.dir.hle}"
616
			file="lib/harvester/harvestListEditor.bat" />
617
		<copy todir="${ver.dir.hle}"
618
			file="lib/harvester/harvestListEditor.sh" />
619
		<delete file="./harvest-list-editor-${release}.zip" />
620
		<zip zipfile="./harvest-list-editor-${release}.zip"
621
			basedir="${ver.dir.hle}" />
622
		<delete file="./harvest-list-editor-${release}.tar.gz" />
623
		<tar tarfile="./harvest-list-editor-${release}.tar"
624
			basedir="${ver.dir.hle}" />
625
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
626
			src="./harvest-list-editor-${release}.tar" />
627
		<delete file="./harvest-list-editor-${release}.tar" />
628
	</target>
629

    
630
	<target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
631
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
632

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

    
649
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
650
			<fileset
651
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
652
				<include name="**/*.xsl" />
653
			</fileset>
654
		</copy>
655
	</target>
656
	
657
	<target name="getemlpre2beta4" depends="prepare" if="eml.required"
658
			description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
659
			<svn>
660
				<export srcUrl="${svn.emlBeta4Url}"
661
					destPath="${build.tmp}/eml_${eml-beta4-tag}" />
662
			</svn>
663
			<mkdir dir="lib/dtd" />
664
			<copy todir="lib/dtd" filtering="yes">
665
				<fileset
666
					dir="${build.tmp}/eml_${eml-beta4-tag}">
667
					<include name="*.dtd" />
668
				</fileset>
669
				<mapper type="glob" from="eml-*.dtd"
670
					to="eml-*-${eml-beta4-version}.dtd" />
671
			</copy>
672

    
673
			<!--
674
			<copy todir="${style-common-cvsrelpath}" filtering="yes">
675
				<fileset
676
					dir="${build.tmp}/eml_${eml-beta4-tag}/style">
677
					<include name="**/*.xsl" />
678
				</fileset>
679
			</copy>
680
			-->
681
		</target>
682

    
683
	<target name="geteml2+" depends="prepare" if="eml.required"
684
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
685
		<svn>
686
			<export srcUrl="${svn.eml200SchemaUrl}"
687
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
688
		</svn>
689
		<mkdir dir="lib/schema/eml-2.0.0" />
690
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
691
			<fileset
692
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
693
				<include name="*.xsd" />
694
			</fileset>
695

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

    
702
		</copy>
703
		<!-- <antcall target="copyxsl">
704
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
705
			<param name="dirname" value="eml-2.0.0" />
706
			</antcall> -->
707

    
708
		<!-- Checkout eml201 for given schema tag-->
709
		<svn>
710
			<export srcUrl="${svn.eml201SchemaUrl}"
711
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
712
		</svn>
713
		<mkdir dir="lib/schema/eml-2.0.1" />
714
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
715
			<fileset
716
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
717
				<include name="*.xsd" />
718
			</fileset>
719
		</copy>
720

    
721
		<!-- Checkout eml201 again for given style sheet tag-->
722
		<!-- echo>Enter CVS password: </echo>
723
			<cvs cvsRoot="${cvsroot}"
724
			package="${eml-module}"
725
			tag="${eml2_0_1-style-tag}"
726
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
727
			<antcall target="copyxsl">
728
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
729
			<param name="dirname" value="eml-2.0.1" />
730
			</antcall -->
731

    
732
		<!-- Checkout eml210 for given schema tag-->
733
		<svn>
734
			<export srcUrl="${svn.eml210SchemaUrl}"
735
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
736
		</svn>
737
		<mkdir dir="lib/schema/eml-2.1.0" />
738
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
739
			<fileset
740
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
741
				<include name="*.xsd" />
742
			</fileset>
743
		</copy>
744

    
745
		<!-- Checkout eml210 for given style sheet tag-->
746
		<svn>
747
			<export srcUrl="${svn.eml2StyleUrl}"
748
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
749
		</svn>
750
		<antcall target="copyxsl">
751
			<param name="cvs.tagname" value="${eml2-style-tag}" />
752
			<!-- param name="dirname" value="eml-2.1.0" / -->
753
			<param name="dirname" value="eml-2" />
754
		</antcall>
755
		
756
		<!-- Checkout eml210 for given schema tag-->
757
		<svn>
758
			<export srcUrl="${svn.eml211SchemaUrl}"
759
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
760
		</svn>
761
		<mkdir dir="lib/schema/eml-2.1.1" />
762
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
763
			<fileset
764
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
765
				<include name="*.xsd" />
766
			</fileset>
767
		</copy>
768
	</target>
769

    
770
	<target name="copyxsl"
771
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
772

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

    
775
		<copy todir="${style-common-cvsrelpath}/${dirname}"
776
			filtering="yes">
777
			<fileset
778
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
779
				<include name="**/*.xsl" />
780
			</fileset>
781
		</copy>
782

    
783

    
784
		<!-- now copy default css from eml module and put it in style-common-path
785
			dir with a new name, so other skin-specific css can import it if reqd -->
786
		<copy
787
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
788
			tofile="${style-common-cvsrelpath}/${eml-css}" />
789

    
790
	</target>
791

    
792
	<target name="correctEML201Docs" depends="jar"
793
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
794
		<copy todir="${build.dir}" file="lib/metacat.properties"
795
			filtering="yes" />
796
		<java
797
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
798
			<classpath>
799
				<path refid="compile.classpath" />
800
				<fileset dir="${build.dir}">
801
					<include name="${name}.jar" />
802
				</fileset>
803
			</classpath>
804
		</java>
805
	</target>
806

    
807
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
808
		description="Installs spatial option for metacat">
809
		
810
		<copy todir="${dist.dir}">
811
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
812
		</copy>
813

    
814
	</target>
815

    
816
	<target name="install" depends="build-metacat"
817
		description="* Full Install For Development *">
818
		<copy file="${dist.dir}/${metacat.context}.war"
819
			todir="${app.deploy.dir}" />
820
               <!-- <copy file="${dist.dir}/${metacat.context}.war"
821
                        todir="${app.deploy.dir2}" />-->
822
		<delete dir="${app.deploy.dir}/${metacat.context}" />
823
		<!--<delete dir="${app.deploy.dir2}/${metacat.context}" />-->
824
		<copy file="${dist.dir}/geoserver.war"
825
					todir="${app.deploy.dir}" />
826
		<copy file="${dist.dir}/metacat-index.war"
827
					todir="${app.deploy.dir}" />
828
		<tstamp>
829
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
830
		</tstamp>
831
		<echo>Dev install completed at ${NOW}</echo>
832
	</target>
833

    
834
	<target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index, dist-metacat-ui"
835
		description="Build Metacat">
836
	</target>
837

    
838
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
839
		if="enable.ecogrid" description="Install Ecogrid Compentent">
840
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
841
			inheritall="false">
842
			<property name="context" value="${metacat.context}" />
843
			<property name="target" value="${ecogrid-target-name}" />
844
		</ant>
845
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
846
			inheritall="false">
847
			<property name="context" value="${metacat.context}" />
848
			<property name="target" value="${ecogrid-target-name}" />
849
			<property name="metacat.dir" value="${basedir}"/>
850
		</ant>
851
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
852
			<webinf dir="${ecogrid-dir}/lib">
853
			<include name="server-config.wsdd"/>
854
			</webinf>
855
			</war -->
856
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
857
			todir="${dist.dir}" overwrite="true" />
858

    
859

    
860
	</target>
861

    
862
	<target name="get-ecogrid" depends="init"
863
		description="Check out ecogrid module" if="ecogrid.required">
864
		<svn>
865
			<export srcUrl="${svn.ecogridUrl}" force="true"
866
				destPath="${ecogrid-dir}" />
867
		</svn>
868
	</target>
869

    
870
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
871
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
872
		<property name="context" value="${metacat.context}"/>
873
		<property name="target" value="${ecogrid-target-name}"/>
874
		<property name="metacat.dir" value="."/>
875
		<property name="hostname" value="${ecogrid.hostname}"/>
876
		<property name="port" value="${config.port}"/>
877
		</ant>
878
		</target -->
879

    
880
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
881
		description="Automately generate wsdd for ecogrid service">
882
		<delete
883
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
884
	</target>
885

    
886
	<target name="install-skin" depends="init"
887
		description="Install a Skin">
888

    
889
		<input message="Please enter name of the skin"
890
			addproperty="skin-name" />
891

    
892
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
893
		<copy todir="${installdir}/style/skins/${skin-name}"
894
			filtering="yes">
895
			<fileset dir="lib/style/skins/${skin-name}">
896
				<exclude name="**/*.png" />
897
				<exclude name="**/*.gif" />
898
				<exclude name="**/*.jpg" />
899
				<exclude name="**/CVS*" />
900
				<exclude name="**/.#*" />
901
			</fileset>
902
		</copy>
903
		<copy todir="${installdir}/style/skins/${skin-name}"
904
			filtering="no">
905
			<fileset dir="lib/style/skins/${skin-name}">
906
				<include name="**/*.png" />
907
				<include name="**/*.gif" />
908
				<include name="**/*.jpg" />
909
				<exclude name="**/CVS*" />
910
				<exclude name="**/.#*" />
911
			</fileset>
912
		</copy>
913
		<copy todir="${installdir}/style/common" filtering="yes">
914
			<fileset dir="lib/style/common">
915
				<include name="*.js" />
916
				<include name="*.jsp" />
917
				<include name="*.css" />
918
				<exclude name="*.png" />
919
				<exclude name="*.gif" />
920
				<exclude name="*.jpg" />
921
				<exclude name="**/CVS*" />
922
				<exclude name="**/.#*" />
923
			</fileset>
924
		</copy>
925
		<!--
926
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
927
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
928
			<fileset dir="lib/style/skins/${skin-name}/images">
929
			<include name="*.png"/>
930
			<include name="*.gif"/>
931
			<include name="*.jpg"/>
932
			</fileset>
933
			</copy>
934
		-->
935

    
936
		<echo message="Install Skin completed." />
937
	</target>
938

    
939
	<target name="war" depends="warPrepare,install-spatial, dist-metacat-index, dist-metacat-ui"
940
		description="Create a web archive (WAR) for servlet deployment">
941
		<mkdir dir="${dist.dir}" />
942
		<war destfile="${dist.dir}/${metacat.context}.war"
943
			webxml="${build.war}/web.xml">
944
			<fileset dir="${war.context}" />
945
			<lib dir="${war.lib}" />
946
			<webinf dir="${war.webinf}" />
947
		</war>
948
	</target>
949

    
950
	<target name="warPrepare"
951
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
952
		description="Prepare files for creating a web archive (WAR)">
953

    
954
		<property name="war.lib" value="${build.war}/lib" />
955
		<property name="war.webinf" value="${build.war}/WEB-INF" />
956
		<property name="war.context"
957
			value="${build.war}/${metacat.context}" />
958
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
959
		<property name="war.webinf.scripts"
960
			value="${war.webinf}/scripts" />
961
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
962
		<property name="war.context.docs" value="${war.context}/docs" />
963
		<property name="war.context.temp" value="${war.context}/temp" />
964
		<property name="war.context.templates"
965
			value="${war.context}${style-common-relpath}/templates" />
966
		<mkdir dir="${war.lib}" />
967
		<mkdir dir="${war.webinf}" />
968
		<mkdir dir="${war.context}" />
969
		<mkdir dir="${war.webinf.sql}" />
970
		<mkdir dir="${war.context.cgi}" />
971
		<mkdir dir="${war.context.docs}" />
972
		<mkdir dir="${war.context.temp}" />
973
		<mkdir dir="${war.context.templates}" />
974

    
975
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
976
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
977
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
978
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
979
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
980
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
981
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
982
		<copy todir="${war.lib}" filtering="no">
983
			<fileset dir="lib">
984
				<include name="*.jar" />
985
				<exclude name="maven-ant-tasks*.jar" />
986
			</fileset>
987
			<fileset dir="${libdir.mvn}" />			
988
		</copy>
989
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
990
			tofile="${build.war}/web.xml" / -->
991
		<!-- MCD added next - Remove the tomcat5 reference-->
992
		<copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
993
		<copy file="lib/metacat.properties" todir="${war.webinf}"
994
			filtering="yes" />
995
		<copy file="lib/solrQueryFieldDescriptions.properties" todir="${war.webinf}"/>
996
		<copy file="lib/metacat.properties.metadata.xml"
997
			todir="${war.webinf}" filtering="no" />
998
		<copy file="lib/org.properties.metadata.xml"
999
			todir="${war.webinf}" filtering="no" />
1000
		<copy file="lib/auth.properties.metadata.xml"
1001
			todir="${war.webinf}" filtering="no" />
1002
		<copy todir="${war.webinf}" filtering="yes">
1003
			<fileset dir="lib">
1004
				<include name="skin.configs/**" />
1005
			</fileset>
1006
		</copy>
1007
		<copy file="lib/log4j.properties" todir="${war.webinf}"
1008
			filtering="yes" />
1009
		<copy file="lib/hazelcast.xml" todir="${war.webinf}"
1010
			filtering="yes" />
1011
		<copy file="lib/oa4mp_client.xml" todir="${war.webinf}"
1012
			filtering="yes" />
1013
		<copy todir="${war.context}" filtering="no">
1014
			<fileset dir="lib">
1015
				<include name="**/*.jpg" />
1016
				<include name="**/*.png" />
1017
				<include name="**/*.gif" />
1018
				<include name="LiveMap_30/**" />
1019
				<include name="oaipmh/**" />
1020
			</fileset>
1021
		</copy>
1022
		<copy todir="${war.context}" filtering="yes">
1023
			<fileset dir="lib">
1024
				<exclude name="*.jar" />
1025
				<exclude name="*.properties" />
1026
				<exclude name="*.metadata.xml" />
1027
				<exclude name="web.xml" />
1028
				<exclude name="**/*.jpg" />
1029
				<exclude name="**/*.png" />
1030
				<exclude name="**/*.gif" />
1031
				<exclude name="lsid_lib/**" />
1032
				<exclude name="lsid_conf/**" />
1033
				<exclude name="LiveMap_30/**" />
1034
				<exclude name="oaipmh/**" />
1035
				<exclude name="maven/**" />
1036
				<exclude name="skin.configs/**" />
1037
				<exclude name="spatial/geoserver/**" />
1038
			</fileset>
1039
		</copy>
1040
		<copy todir="${war.context}" filtering="no">
1041
			<fileset dir="lib">
1042
				<include name="spatial/geoserver/data/**" />
1043
			</fileset>
1044
		</copy>
1045
		<copy todir="${war.context.docs}" filtering="no">
1046
			<fileset dir="${build.docs}" />
1047
		</copy>
1048
		<copy todir="${war.webinf.sql}" filtering="yes">
1049
			<fileset dir="src">
1050
				<include name="**/*.sql" />
1051
			</fileset>
1052
		</copy>
1053
		<copy todir="${war.webinf.scripts}" filtering="yes">
1054
			<fileset dir="src/scripts" />
1055
		</copy>
1056
		<copy todir="${war.webinf.scripts}"
1057
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1058
			failonerror="false" />
1059

    
1060
		<copy file="src/perl/register-dataset.cgi"
1061
			todir="${war.context.cgi}" />
1062
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1063
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1064

    
1065
		<!-- registry cgi section -->
1066
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1067
			used in readDocumentFromMetacat -->
1068
		<!-- TODO MCD copy temp files to actual location using config util?? -->
1069
		<copy todir="${war.context.temp}" filtering="yes">
1070
			<fileset dir="lib/style/common/emlb6toeml2">
1071
				<include name="*.xsl" />
1072
				<include name="*.xml" />
1073
			</fileset>
1074
		</copy>
1075
		<available file="lib/style/common/emlb6toeml2" type="dir"
1076
			property="styles.not.needed" />
1077

    
1078
		<!-- ldap cgi section -->
1079
		<copy todir="${war.context.templates}">
1080
			<fileset dir="lib/style/common/templates">
1081
				<!-- SCW: Copy all files -->
1082
			</fileset>
1083
		</copy>
1084
	</target>
1085

    
1086
	<target name="cgiPrepare" if="build.perl">
1087
		<exec dir="src/perl/Metacat/" executable="make">
1088
			<arg value="clean" />
1089
		</exec>
1090
		<exec dir="src/perl/Metacat/" executable="perl">
1091
			<arg value="Makefile.PL" />
1092
		</exec>
1093
		<exec dir="src/perl/Metacat/" executable="make" />
1094
	</target>
1095

    
1096
	<target name="testPrepare"
1097
		description="Copies test files into the war directories">
1098
		<echo>in testPrepare</echo>
1099
		<property name="war.context.test"
1100
			value="${build.war}/${metacat.context}/test" />
1101
		<mkdir dir="${war.context.test}" />
1102
		<copy todir="${war.context.test}" filtering="yes">
1103
			<fileset dir="test/servertestfiles">
1104
				<include name="*/**" />
1105
			</fileset>
1106
		</copy>
1107
	</target>
1108

    
1109
	<target name="getConversionXSL" depends="prepare"
1110
		unless="styles.not.needed"
1111
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1112

    
1113
		<svn>
1114
			<export srcUrl="${svn.eml2StyleUrl}"
1115
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1116
		</svn>
1117

    
1118
		<mkdir dir="lib/style/common/emlb6toeml2" />
1119
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1120
			<fileset
1121
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1122
				<include name="*.xsl" />
1123
				<include name="*.xml" />
1124
			</fileset>
1125
		</copy>
1126
	</target>
1127

    
1128
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1129
		<mkdir dir="${build.tests}" />
1130
		<copy todir="${build.tests}" encoding="UTF-8">
1131
			<fileset dir="${testdir}">
1132
				<include name="edu/**" />
1133
			</fileset>
1134
		</copy>
1135
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1136

    
1137
		<path id="test.classpath">
1138
			<path refid="compile.classpath" />
1139
			<fileset dir="${build.dir}">
1140
				<include name="${name}.jar" />
1141
				<include name="${name}-client.jar" />
1142
				<include name="harvester.jar" />
1143
			</fileset>
1144
		</path>
1145
		
1146
		<pathconvert pathsep="${line.separator}|  |--" 
1147
		             property="echo.test.classpath"
1148
		             refid="test.classpath">
1149
		</pathconvert>
1150
		<echo message="|--test classpath" />
1151
		<echo message="|  |" />
1152
		<echo message="|  |-- ${echo.test.classpath}" />
1153
		
1154
		<!-- copy and compile the tests into a jar file -->
1155
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1156
			debug="on" includes="**/*.java" encoding="UTF-8">
1157
			<classpath refid="test.classpath" />
1158
		</javac>
1159

    
1160
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1161
			basedir="${build.tests}" >
1162
			<include name="**/*.class"/>
1163
			<include name="**/*.xml"/>
1164
		</jar>	
1165
		
1166
	</target>
1167

    
1168
	<target name="runoneclass" depends="testprep"
1169
		description="Uses the ant to run a class">
1170
		
1171
		<java classname="${classtorun}" fork="true">
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
		</java>
1183
	</target>
1184
	
1185
	<target name="test" depends="testprep"
1186
		description="Uses the ant junit task to run all JUnit tests">
1187

    
1188
		<!-- use the ant "junit" task to run JUnit tests. -->
1189
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1190
			haltonerror="no">
1191
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1192
			<classpath>
1193
				<path refid="test.classpath" />
1194
				<fileset dir="${build.dir}">
1195
					<include name="${name}.jar" />
1196
					<include name="${name}-client.jar" />
1197
					<include name="harvester.jar" />
1198
					<include name="${name}-junittests.jar" />
1199
				</fileset>
1200
			</classpath>
1201

    
1202
			<formatter type="plain" />
1203

    
1204
			<batchtest fork="yes" todir="${build.dir}">
1205
				<fileset dir="${build.tests}">
1206
					<include name="**/*.class" />
1207
					<exclude name="**/MCTestCase.class" />
1208
					<exclude name="**/ClientViewHelperTest.class" />
1209
					<!-- these are not test cases -->
1210
					<exclude name="**/MockCNode.class" />
1211
					<exclude name="**/D1NodeServiceTest.class" />
1212
					<exclude name="**/QueryRunner.class" />
1213
					<exclude name="**/MockObjectPathMap.class" />
1214
					<exclude name="**/HzObjectPathMapTest$1.class" />
1215
					<exclude name="**/HzObjectPathMapTest$2.class" />
1216
				</fileset>
1217
			</batchtest>
1218
		</junit>
1219
	</target>
1220

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

    
1224
		<echo>testtorun: ${testtorun}</echo>
1225

    
1226
		<!-- use the ant "junit" task to run JUnit tests. -->
1227
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1228
			haltonerror="no" showoutput="yes">
1229
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1230
			<classpath>
1231
				<path refid="test.classpath" />
1232
				<fileset dir="${build.dir}">
1233
					<include name="${name}.jar" />
1234
					<include name="${name}-client.jar" />
1235
					<include name="harvester.jar" />
1236
					<include name="${name}-junittests.jar" />
1237
				</fileset>
1238
			</classpath>
1239

    
1240
			<formatter type="plain" />
1241

    
1242
			<batchtest fork="yes" todir="${build.dir}">
1243
				<fileset dir="${build.tests}">
1244
					<include name="**/${testtorun}.class" />
1245
				</fileset>
1246
			</batchtest>
1247
		</junit>
1248
	</target>
1249
	
1250
	<target name="run" depends="testprep"
1251
			description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1252

    
1253
			<echo>testtorun: ${testtorun}</echo>
1254

    
1255
			<!-- use the ant "junit" task to run JUnit tests. -->
1256
			<junit printsummary="yes" haltonfailure="no" fork="yes"
1257
				haltonerror="no" showoutput="yes">
1258
				<jvmarg value="-Dfile.encoding=UTF-8"/>
1259
				<classpath>
1260
					<path refid="test.classpath" />
1261
					<fileset dir="${build.dir}">
1262
						<include name="${name}.jar" />
1263
						<include name="${name}-client.jar" />
1264
						<include name="harvester.jar" />
1265
						<include name="${name}-junittests.jar" />
1266
					</fileset>
1267
				</classpath>
1268

    
1269
				<formatter type="plain" />
1270

    
1271
				<batchtest fork="yes" todir="${build.dir}">
1272
					<fileset dir="${build.tests}">
1273
						<include name="**/${testtorun}.class" />
1274
					</fileset>
1275
				</batchtest>
1276
			</junit>
1277
		</target>
1278

    
1279
	<target name="testharvester" depends="testprep"
1280
		description="Uses the ant junit task to test only the Harvester code">
1281
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1282
			haltonerror="off">
1283
			<classpath>
1284
				<path refid="compile.classpath" />
1285
				<fileset dir="${build.dir}">
1286
					<include name="${name}.jar" />
1287
					<include name="${name}-client.jar" />
1288
					<include name="harvester.jar" />
1289
					<include name="${name}-junittests.jar" />
1290
				</fileset>
1291
			</classpath>
1292
			<formatter type="plain" />
1293
			<batchtest fork="yes" todir="${build.dir}">
1294
				<fileset dir="${build.tests}">
1295
					<include name="**/harvesterClient/*.class" />
1296
				</fileset>
1297
			</batchtest>
1298
		</junit>
1299
	</target>
1300

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

    
1305
		<echo>
1306
			*********************************** Please run ant
1307
			gethttpclient first! ***********************************
1308
		</echo>
1309
		<!-- copy and compile the tests into a jar file -->
1310
		<mkdir dir="${build.metacatnettest}" />
1311
		<javac srcdir="${junitnettestsdir}"
1312
			destdir="${build.metacatnettest}" includes="**/*.java">
1313
			<classpath>
1314
				<path refid="compile.classpath" />
1315
				<fileset dir="${build.dir}">
1316
					<include name="${name}.jar" />
1317
				</fileset>
1318
			</classpath>
1319
		</javac>
1320

    
1321
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1322
			basedir="${build.metacatnettest}" includes="**/*.class" />
1323

    
1324
		<!-- use the ant "junit" task to run JUnit tests. -->
1325
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1326
			haltonerror="no">
1327
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1328
			<classpath>
1329
				<path refid="compile.classpath" />
1330
				<fileset dir="${build.dir}">
1331
					<include name="${name}.jar" />
1332
					<include name="${name}-junitnettests.jar" />
1333
				</fileset>
1334
			</classpath>
1335

    
1336
			<formatter type="plain" />
1337

    
1338
			<batchtest fork="yes" todir="${build.dir}">
1339
				<fileset dir="${build.metacatnettest}">
1340
					<include name="**/*.class" />
1341
				</fileset>
1342
			</batchtest>
1343
		</junit>
1344
	</target>
1345

    
1346
	<target name="cleanweb" depends="clean"
1347
		description="deletes tomcat web context dir and all its contents">
1348
		<delete dir="${installdir}" />
1349
	</target>
1350

    
1351

    
1352
	<target name="clean" depends="init"
1353
		description="deletes build dir and files that can be regenerated form the release">
1354
		<delete dir="${build.dir}" />
1355
		<delete dir="${dist.dir}" />
1356
	</target>
1357

    
1358
	<target name="localclean" depends="clean"
1359
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1360
		<delete file="lib/utilities.jar" />
1361
	</target>
1362

    
1363
	<target name="fullclean" depends="localclean"
1364
		description="deletes code and eml">
1365
		<delete includeEmptyDirs="true" failonerror="false">
1366
			<fileset dir="${style-common-cvsrelpath}">
1367
				<include name="${eml-css}" />
1368
				<include name="eml-*/*.xsl" />
1369
				<include name="eml-*" />
1370
			</fileset>
1371
			<fileset dir="${schema-cvsrelpath}">
1372
				<include name="eml-*/*.xsd" />
1373
			</fileset>
1374
			<fileset dir="${ecogrid-dir}"/>
1375
			<fileset dir="lib/style/common/emlb6toeml2"/>
1376
			<fileset dir="lib/dtd"/>
1377
			<fileset dir="lib/schema"/>
1378
			<fileset dir="${utilitiesdir}"/>
1379
			<fileset dir="${libdir.mvn}"/>
1380
		</delete>
1381
		<!-- clean up the distribution files if they exist-->
1382
		<delete file="./${name}-bin-${release}.tar.gz" />
1383
		<delete file="./${name}-src-${release}.tar.gz" />
1384
		<delete file="./${name}-bin-${release}.zip" />
1385
		<delete file="./${name}-src-${release}.zip" />
1386
	</target>
1387
	
1388
	<target name="documentation" depends="javadoc,admindoc"
1389
	    description="generates Javadoc API documentation and Admin Guide">
1390
    </target>
1391
	
1392
	<target name="admindoc" depends="prepare">
1393
		<!-- Build the administrator's guide, which is a Sphinx RST project
1394
		     For this to succeed, you must have Sphinx installed on your machine
1395
		     See: http://sphinx.pocoo.org/ for details
1396
		     And you must also have the 'make' build tool installed
1397
		-->
1398
		<exec dir="${docdir}/user/metacat" executable="make"> 
1399
		        <arg value="plantuml"/> 
1400
		</exec>
1401
		
1402
		<exec dir="${docdir}/user/metacat" executable="make"> 
1403
		        <arg value="html"/> 
1404
		</exec>
1405
		
1406
    </target>
1407

    
1408
	<target name="javadoc" depends="prepare"
1409
		description="generates Javadoc API documentation">
1410
		<javadoc packagenames="edu.ucsb.nceas.*"
1411
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1412
			version="true" use="true" windowtitle="${Name} API"
1413
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1414
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1415
			<classpath>
1416
				<path refid="compile.classpath" />
1417
			</classpath>
1418
		</javadoc>
1419
	</target>
1420

    
1421
	<target name="dist"
1422
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL,getutilities"
1423
		description="prepares a full release distribution">
1424
		<mkdir dir="${dist.dir}" />
1425
		<delete dir="${ver.dir}" />
1426
		<mkdir dir="${ver.dir}" />
1427
		<copy todir="${ver.dir}">
1428
			<fileset dir="."
1429
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1430
		</copy>
1431
		<copy todir="${ver.dir}" file="build.xml" />
1432
		<copy todir="${ver.dir}" file="build.properties" />
1433

    
1434
		<copy todir="${ver.dir}/docs" filtering="yes">
1435
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1436
		</copy>
1437
		<copy todir="${ver.dir}/docs" filtering="no">
1438
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1439
		</copy>
1440
		<copy todir="${ver.dir}/docs/dev">
1441
			<fileset dir="${build.dir}/docs" />
1442
		</copy>
1443
		<copy todir="${ver.dir}/src">
1444
			<fileset dir="${build.dir}/src" />
1445
		</copy>
1446

    
1447
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1448
		<copy todir="${ver.dir}/test/servertestfiles">
1449
			<fileset dir="./test/servertestfiles" />
1450
		</copy>
1451
	</target>
1452

    
1453
	<target name="fulldist" depends="distbin, distsrc"
1454
			description="full distribution - source and bin"/>
1455
		
1456
	<target name="distbin" depends="build-metacat,war-lsid"
1457
		description="prepares a binary distribution">
1458
		<copy todir="${dist.dir}">
1459
			<fileset dir="./src/scripts" />
1460
		</copy>
1461
		<delete file="./${name}-bin-${release}.zip" />
1462
		<zip zipfile="./${name}-bin-${release}.zip"
1463
			basedir="${dist.dir}" />
1464
		<delete file="./${name}-bin-${release}.tar.gz" />
1465
		<tar tarfile="./${name}-bin-${release}.tar"
1466
			basedir="${dist.dir}" />
1467
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1468
			src="./${name}-bin-${release}.tar" />
1469
		<delete file="./${name}-bin-${release}.tar" />
1470
	</target>
1471

    
1472
	<target name="distsrc" depends="dist"
1473
		description="prepares a source distribution">
1474
		<mkdir dir="${ver.src}" />
1475
		<copy todir="${ver.src}">
1476
			<fileset dir="./src" />
1477
		</copy>
1478
		<mkdir dir="${util.dir}" />
1479
		<copy todir="${util.dir}">
1480
			<fileset dir="${utilitiesdir}" excludes="**/CVS*" />
1481
		</copy>
1482

    
1483
		<mkdir dir="${ecogrid-dist-dir}" />
1484
		<copy todir="${ecogrid-dist-dir}">
1485
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1486
		</copy>
1487

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

    
1490
		<delete file="./${name}-src-${release}.zip" />
1491
		<zip zipfile="./${name}-src-${release}.zip"
1492
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1493
		<delete file="./${name}-src-${release}.tar.gz" />
1494
		<tar tarfile="./${name}-src-${release}.tar"
1495
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1496
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1497
			src="./${name}-src-${release}.tar" />
1498
		<delete file="./${name}-src-${release}.tar" />
1499
		<!--delete dir="${dist.dir}"/ -->
1500
	</target>
1501

    
1502
	<target name="deb-package" depends="distbin"
1503
		description="create a debian installation package">
1504
		<delete dir="${deb.pkg.dir}" />
1505
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1506
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1507
			<fileset dir="./src/scripts/debian"
1508
				includes="control postinst" />
1509
		</copy>
1510

    
1511
		<mkdir
1512
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1513
		<copy
1514
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1515
			filtering="yes">
1516
			<fileset dir="./src/scripts/debian"
1517
				excludes="control postinst" />
1518
		</copy>
1519
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1520

    
1521
		<copy file="${dist.dir}/knb.war"
1522
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1523
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1524
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1525

    
1526
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1527
			failonerror="true">
1528
			<arg line="--build debian" />
1529
		</exec>
1530

    
1531
		<move file="${pkg.dir}/debian.deb"
1532
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1533
	</target>
1534

    
1535
	<target name="stylesheettest">
1536
		<xslt in="${input}" out="eml.html"
1537
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1538
			<param name="displaymodule" expression="${displaymodule}" />
1539
			<param name="docid" expression="${input}" />
1540
			<param name="entitytype" expression="${entitytype}" />
1541
			<param name="entityindex" expression="${entityindex}" />
1542
			<outputproperty name="method" value="html" />
1543
			<outputproperty name="standalone" value="yes" />
1544
			<outputproperty name="encoding" value="iso8859_1" />
1545
			<outputproperty name="indent" value="yes" />
1546
		</xslt>
1547
	</target>
1548

    
1549
	<target name="spatial_option" depends="prepare"
1550
		description=" -- compiles code for the spatial option">
1551

    
1552
		<echo message="Compiling the metatcat shapefile creator" />
1553
		<echo message="using the shapelib at: ${shapelib.dir}" />
1554
		<exec dir="." executable="g++" os="Linux, Unix"
1555
			failonerror="true">
1556
			<arg
1557
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1558
		</exec>
1559

    
1560
		<exec dir="." executable="g++" os="Linux, Unix"
1561
			failonerror="true">
1562
			<arg
1563
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1564
		</exec>
1565
	</target>
1566

    
1567
	<!-- LSID Authority support -->
1568
	<patternset id="lsid.jars">
1569
		<include name="axis.jar" />
1570
		<include name="commons-discovery-0.2.jar" />
1571
		<include name="jaxrpc.jar" />
1572
		<include name="lsid-client-1.1.1.jar" />
1573
		<include name="lsid-server-1.1.1.jar" />
1574
		<include name="saaj.jar" />
1575
		<include name="wsdl4j-1.5.1.jar" />
1576
		<include name="activation.jar" />
1577
		<include name="castor-0.9.5.jar" />
1578
		<include name="dnsjava-1.3.2.jar" />
1579
		<include name="mail.jar" />
1580
		<include name="commons-logging-1.0.4.jar" />
1581
		<!-- These jars may be needed but seem to not actually be,
1582
			so leaving them out for now
1583
			<include name="axis-ant.jar" />
1584
		-->
1585
		<!--<include name="GenCastor.class" />-->
1586
	</patternset>
1587
	<patternset id="lib.jars">
1588
		<include name="log4j-1.2.12.jar" />
1589
		<include name="utilities.jar" />
1590
		<include name="xerces*.jar" />
1591
		<include name="xalan*.jar" />
1592
		<include name="xml-apis*.jar" />
1593
	</patternset>
1594

    
1595
	<path id="lsid.classpath">
1596
		<fileset dir="${lsid.lib.dir}">
1597
			<patternset refid="lsid.jars" />
1598
		</fileset>
1599
		<fileset dir="${lib.dir}">
1600
			<patternset refid="lib.jars" />
1601
		</fileset>
1602
		<fileset dir="${build.dir}">
1603
			<include name="metacat-client.jar" />
1604
			<include name="metacat.jar" />
1605
		</fileset>
1606
	</path>
1607

    
1608
	<filterset id="configFilters">
1609
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1610
			value="${config.hostname}" / -->
1611
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1612
			value="${config.port}" / -->
1613
		<!-- MCD BYE filter token="METADATA_LABELS"
1614
			value="${config.metadataLabelLsid}" / -->
1615
		<!-- MCD BYE filter token="METACAT_SERVER"
1616
			value="${config.metacatserver}" / -->
1617
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1618
			value="${config.lsidauthority}" / -->
1619
	</filterset>
1620

    
1621
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1622
		description="Configure files prior to compilation">
1623
		<mkdir dir="${lsid.build.dir}" />
1624
		<!-- Copy the properties file into the build -->
1625
		<copy file="${conf.dir}/metacat-lsid.properties"
1626
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1627
			overwrite="true">
1628
			<filterset refid="configFilters" />
1629
		</copy>
1630
		<copy file="${conf.dir}/log4j.properties"
1631
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1632
			overwrite="true">
1633
			<filterset refid="configFilters" />
1634
		</copy>
1635
		<!-- Copy config files into the build -->
1636
		<copy todir="${lsid.build.dir}/WEB-INF">
1637
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1638
		</copy>
1639
		<!-- Copy the metadata configuration files into the build -->
1640
		<mkdir
1641
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1642
		<copy
1643
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1644
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1645
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1646
			<filterset refid="configFilters" />
1647
		</copy>
1648
		<!-- Copy services files into the build -->
1649
		<mkdir dir="${lsid.build.dir}/services" />
1650
		<copy todir="${lsid.build.dir}/services">
1651
			<fileset dir="${services.dir}" />
1652
			<filterset refid="configFilters" />
1653
		</copy>
1654
		<!-- Copy axis files into the build -->
1655
		<mkdir dir="${lsid.build.dir}" />
1656
		<copy todir="${lsid.build.dir}">
1657
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1658
		</copy>
1659
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1660
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1661
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1662
		</copy>
1663
	</target>
1664

    
1665
	<target name="compile-lsid" depends="prepare-lsid"
1666
		description="Compile Java sources">
1667
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1668
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1669
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1670
			deprecation="${compile.deprecation}"
1671
			optimize="${compile.optimize}">
1672
			<classpath>
1673
				<path refid="compile.classpath" />
1674
				<fileset dir="${build.dir}">
1675
					<include name="${name}.jar" />
1676
				</fileset>
1677
			</classpath>
1678
		</javac>
1679
	</target>
1680

    
1681
	<target name="war-lsid" depends="compile-lsid"
1682
		description="Create a war file for the application">
1683
		<mkdir dir="${dist.dir}" />
1684
		<war destfile="${dist.dir}/${authority.context}.war"
1685
			webxml="${webinf.dir}/web.xml">
1686
			<fileset dir="${lsid.build.dir}" />
1687
			<lib dir="${lsid.lib.dir}">
1688
				<patternset refid="lsid.jars" />
1689
			</lib>
1690
			<lib dir="${lib.dir}">
1691
				<patternset refid="lib.jars" />
1692
			</lib>
1693
			<lib dir="${lib.dir}">
1694
				<include name="xalan.jar" />
1695
				<include name="xml-apis.jar" />
1696
			</lib>
1697
			<lib dir="${build.dir}">
1698
				<include name="metacat-client.jar" />
1699
			</lib>
1700
		</war>
1701
	</target>
1702

    
1703
	<target name="deploy-lsid" depends="war-lsid"
1704
		description="Deploy LSID war to servlet container">
1705
		<delete dir="${app.deploy.dir}/${authority.context}" />
1706
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1707
		<mkdir dir="${app.deploy.dir}" />
1708
		<copy todir="${app.deploy.dir}">
1709
			<fileset dir="${dist.dir}" />
1710
		</copy>
1711
	</target>
1712
	
1713
	<target name="change-metacat-properties" depends="warPrepare"
1714
        description="Chage some default values of metacat.properties">
1715
       <echo file="${metacat-properties-file}" append="true">
1716
		   configutil.propertiesConfigured=true
1717
		   configutil.authConfigured=true
1718
           configutil.skinsConfigured=true
1719
		   configutil.databaseConfigured=true
1720
		   configutil.geoserverConfigured=true
1721
	   </echo>
1722
  </target>
1723
	
1724
	<!-- This target will use default values in svn metacat.properties to build a configured 
1725
		metacat (except configuti.* properties, they will be set true). Those default settings
1726
		are for a test machine. It may not work on your system-->
1727
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1728
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1729
    </target>
1730
	
1731
	<!-- build metacat-common jar -->
1732
	<target name="build-metacat-common" description="Calls the Maven build for metacat-common jar" unless="build-metacat-common-called" >
1733
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1734
		            <arg value="clean"/>
1735
		</artifact:mvn>
1736
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1737
		   <arg value="install"/>
1738
		</artifact:mvn>
1739
		<property name="build-metacat-common-called" value="true"/>
1740
	</target>
1741

    
1742
	<!-- build metacat-index war -->
1743
	<target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >		
1744
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1745
			<arg value="clean"/>
1746
		</artifact:mvn>
1747
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1748
			<arg value="package"/>
1749
			<!--<arg value="-Dmaven.test.skip=true"/>-->
1750
		</artifact:mvn>
1751
	</target>
1752
	
1753
	<target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >		
1754
		<copy tofile="${dist.dir}/metacat-index.war" >
1755
			<fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1756
		</copy>	
1757
	</target>
1758
	
1759
	<target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >		
1760
		<copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1761
	</target>
1762
	
1763
</project>
(5-5/7)